/usr/share/doc/octave3.2-headers/examples/globaldemo.cc is in octave3.2-headers 3.2.4-12.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <octave/oct.h>
DEFUN_DLD (globaldemo, args, , "Global demo.")
{
int nargin = args.length ();
octave_value retval;
if (nargin != 1)
print_usage ();
else
{
std::string s = args(0).string_value ();
if (! error_state)
{
octave_value tmp = get_global_value (s, true);
if (tmp.is_defined ())
retval = tmp;
else
retval = "Global variable not found";
set_global_value ("a", 42.0);
}
}
return retval;
}
|