comparison libinterp/octave.cc @ 15838:009984ecf419 classdef

maint: periodic merge of default to classdef
author Michael Goffioul <michael.goffioul@gmail.com>
date Sun, 23 Dec 2012 13:00:02 -0500
parents 6ea536cb7360 534b6f7108b7
children 622f3f794162
comparison
equal deleted inserted replaced
15576:6ea536cb7360 15838:009984ecf419
169 // The code to evaluate at startup (--eval CODE) 169 // The code to evaluate at startup (--eval CODE)
170 static std::string code_to_eval; 170 static std::string code_to_eval;
171 171
172 // If TRUE, don't exit after evaluating code given by --eval option. 172 // If TRUE, don't exit after evaluating code given by --eval option.
173 static bool persist = false; 173 static bool persist = false;
174
175 // If TRUE, the GUI should be started.
176 static bool start_gui = false;
174 177
175 // Long options. See the comments in getopt.h for the meanings of the 178 // Long options. See the comments in getopt.h for the meanings of the
176 // fields in this structure. 179 // fields in this structure.
177 #define BUILT_IN_DOCSTRINGS_FILE_OPTION 1 180 #define BUILT_IN_DOCSTRINGS_FILE_OPTION 1
178 #define DOC_CACHE_FILE_OPTION 2 181 #define DOC_CACHE_FILE_OPTION 2
1029 clean_up_and_exit (retval); 1032 clean_up_and_exit (retval);
1030 1033
1031 return 0; 1034 return 0;
1032 } 1035 }
1033 1036
1034 // Return int instead of bool because this function is declared 1037 static bool
1035 // extern "C". 1038 check_starting_gui (void)
1036
1037 int
1038 octave_starting_gui (void)
1039 { 1039 {
1040 if (no_window_system || ! display_info::display_available ()) 1040 if (no_window_system || ! display_info::display_available ())
1041 return false; 1041 return false;
1042 1042
1043 if (force_gui_option) 1043 if (force_gui_option)
1067 if (! code_to_eval.empty () || remaining_args > 0) 1067 if (! code_to_eval.empty () || remaining_args > 0)
1068 return false; 1068 return false;
1069 1069
1070 return true; 1070 return true;
1071 } 1071 }
1072
1073 // Return int instead of bool because this function is declared
1074 // extern "C".
1075
1076 int
1077 octave_starting_gui (void)
1078 {
1079 start_gui = check_starting_gui ();
1080 return start_gui;
1081 }
1082
1083 DEFUN (isguirunning, args, ,
1084 "-*- texinfo -*-\n\
1085 @deftypefn {Built-in Function} {} isguirunning ()\n\
1086 Return true if Octave is running in GUI mode and false otherwise.\n\
1087 @end deftypefn")
1088 {
1089 octave_value retval;
1090
1091 if (args.length () == 0)
1092 retval = start_gui;
1093 else
1094 print_usage ();
1095
1096 return retval;
1097 }
1098
1099 /*
1100 %!assert (islogical (isguirunning ()))
1101 %!error isguirunning (1)
1102 */
1072 1103
1073 DEFUN (argv, args, , 1104 DEFUN (argv, args, ,
1074 "-*- texinfo -*-\n\ 1105 "-*- texinfo -*-\n\
1075 @deftypefn {Built-in Function} {} argv ()\n\ 1106 @deftypefn {Built-in Function} {} argv ()\n\
1076 Return the command line arguments passed to Octave. For example,\n\ 1107 Return the command line arguments passed to Octave. For example,\n\