annotate examples/code/globaldemo.cc @ 20654:b65888ec820e draft default tip gccjit

dmalcom gcc jit import
author Stefan Mahr <dac922@gmx.de>
date Fri, 27 Feb 2015 16:59:36 +0100
parents 2f8500ca91d3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
1 #include <octave/oct.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
2
16867
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 9053
diff changeset
3 DEFUN_DLD (globaldemo, args, , "Global Demo")
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
4 {
16867
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 9053
diff changeset
5 octave_value retval;
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
6
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
7 if (args.length () != 1)
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
8 print_usage ();
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
9
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
10 std::string s = args(0).string_value ();
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
11
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
12 octave_value tmp = get_global_value (s, true);
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
13
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
14 if (tmp.is_defined ())
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
15 retval = tmp;
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
16 else
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
17 retval = "Global variable not found";
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
18
20578
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
19 set_global_value ("a", 42.0);
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19067
diff changeset
20
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
21 return retval;
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
22 }