view examples/globaldemo.cc @ 19624:3c038da18218 gui-release

cleanup of focus function in gui editor * file-editor-interface.h: remove function set_focus * file-editor.cc (focus): call common function and extra code for the editor; (set_focus): removed, all code now in focus (); (request_new_file, request_open_file): replaced set_focus by focus * file-editor.h: removed set_focus
author Torsten <ttl@justmail.de>
date Thu, 25 Dec 2014 08:31:31 +0100
parents be41c30bcb44
children
line wrap: on
line source

#include <octave/oct.h>

DEFUN_DLD (globaldemo, args, , "Global Demo")
{
  octave_value retval;
  int nargin = args.length ();

  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;
}