1683
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1683
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include <cassert> |
|
28 #include <csetjmp> |
|
29 #include <csignal> |
|
30 #include <cstdlib> |
|
31 #include <cstring> |
|
32 #include <ctime> |
|
33 |
1728
|
34 #include <string> |
|
35 |
1683
|
36 #include <fstream.h> |
|
37 #include <iostream.h> |
|
38 #include <strstream.h> |
|
39 |
|
40 #ifdef HAVE_UNISTD_H |
2442
|
41 #ifdef HAVE_SYS_TYPES_H |
1683
|
42 #include <sys/types.h> |
2442
|
43 #endif |
1683
|
44 #include <unistd.h> |
|
45 #endif |
|
46 |
2926
|
47 #include "cmd-edit.h" |
|
48 #include "file-ops.h" |
1683
|
49 #include "lo-error.h" |
2370
|
50 #include "lo-mappers.h" |
3020
|
51 #include "oct-env.h" |
1755
|
52 #include "str-vec.h" |
1683
|
53 |
2492
|
54 #include <defaults.h> |
1683
|
55 #include "defun.h" |
|
56 #include "dynamic-ld.h" |
|
57 #include "error.h" |
|
58 #include "file-io.h" |
|
59 #include "input.h" |
|
60 #include "lex.h" |
2492
|
61 #include <oct-conf.h> |
1742
|
62 #include "oct-hist.h" |
2162
|
63 #include "oct-map.h" |
2862
|
64 #include "oct-obj.h" |
1683
|
65 #include "pager.h" |
|
66 #include "parse.h" |
|
67 #include "pathsearch.h" |
|
68 #include "procstream.h" |
2370
|
69 #include "ov.h" |
2985
|
70 #include "pt-jump.h" |
1750
|
71 #include "pt-plot.h" |
2982
|
72 #include "pt-stmt.h" |
1683
|
73 #include "sighandlers.h" |
|
74 #include "sysdep.h" |
2693
|
75 #include "syswait.h" |
1750
|
76 #include "toplev.h" |
1683
|
77 #include "unwind-prot.h" |
|
78 #include "utils.h" |
|
79 #include "variables.h" |
2492
|
80 #include <version.h> |
1683
|
81 |
3020
|
82 // TRUE means we are exiting via the builtin exit or quit functions. |
|
83 static bool quitting_gracefully = false; |
1683
|
84 |
|
85 // Current command to execute. |
|
86 tree_statement_list *global_command = 0; |
|
87 |
|
88 // Pointer to function that is currently being evaluated. |
2891
|
89 octave_user_function *curr_function = 0; |
1683
|
90 |
1907
|
91 // Top level context (?) |
|
92 jmp_buf toplevel; |
|
93 |
|
94 int |
|
95 main_loop (void) |
|
96 { |
|
97 // Allow the user to interrupt us without exiting. |
|
98 |
2016
|
99 octave_save_signal_mask (); |
|
100 |
1907
|
101 if (setjmp (toplevel) != 0) |
|
102 { |
|
103 raw_mode (0); |
|
104 |
|
105 cout << "\n"; |
2016
|
106 |
|
107 octave_restore_signal_mask (); |
1907
|
108 } |
|
109 |
3020
|
110 can_interrupt = true; |
1907
|
111 |
2554
|
112 octave_catch_interrupts (); |
1907
|
113 |
|
114 // The big loop. |
|
115 |
|
116 int retval; |
|
117 do |
|
118 { |
|
119 curr_sym_tab = top_level_sym_tab; |
|
120 |
|
121 reset_parser (); |
|
122 |
|
123 retval = yyparse (); |
|
124 |
|
125 if (retval == 0 && global_command) |
|
126 { |
2898
|
127 global_command->eval (); |
2299
|
128 |
1907
|
129 delete global_command; |
2299
|
130 |
2620
|
131 global_command = 0; |
|
132 |
|
133 if (! (interactive || forced_interactive)) |
|
134 { |
2985
|
135 bool quit = (tree_return_command::returning |
|
136 || tree_break_command::breaking); |
2620
|
137 |
2985
|
138 if (tree_return_command::returning) |
|
139 tree_return_command::returning = 0; |
2620
|
140 |
2985
|
141 if (tree_break_command::breaking) |
|
142 tree_break_command::breaking--; |
2620
|
143 |
|
144 if (quit) |
|
145 break; |
|
146 } |
|
147 |
|
148 if (error_state) |
|
149 { |
|
150 if (! (interactive || forced_interactive)) |
|
151 break; |
|
152 } |
2299
|
153 else |
2620
|
154 { |
|
155 if (octave_completion_matches_called) |
|
156 octave_completion_matches_called = false; |
|
157 else |
2973
|
158 command_editor::increment_current_command_number (); |
2620
|
159 } |
1907
|
160 } |
|
161 } |
|
162 while (retval == 0); |
|
163 |
|
164 return retval; |
|
165 } |
|
166 |
1683
|
167 // Fix up things before exiting. |
|
168 |
|
169 void |
|
170 clean_up_and_exit (int retval) |
|
171 { |
2926
|
172 command_editor::restore_terminal_state (); |
|
173 |
|
174 // XXX FIXME XXX -- is this needed? Can it cause any trouble? |
1683
|
175 raw_mode (0); |
|
176 |
2926
|
177 command_history::clean_up_and_save (); |
1683
|
178 |
|
179 close_plot_stream (); |
|
180 |
|
181 close_files (); |
|
182 |
|
183 cleanup_tmp_files (); |
|
184 |
|
185 if (!quitting_gracefully && (interactive || forced_interactive)) |
|
186 cout << "\n"; |
|
187 |
|
188 if (retval == EOF) |
|
189 retval = 0; |
|
190 |
|
191 exit (retval); |
|
192 |
|
193 // This is bogus but should prevent g++ from giving a warning saying |
|
194 // that this volatile function does return. |
|
195 |
|
196 panic_impossible (); |
|
197 } |
|
198 |
1957
|
199 DEFUN_TEXT (casesen, args, , |
1683
|
200 "casesen [on|off]") |
|
201 { |
2086
|
202 octave_value_list retval; |
1683
|
203 |
1755
|
204 int argc = args.length () + 1; |
|
205 |
1965
|
206 string_vector argv = args.make_argv ("casesen"); |
1683
|
207 |
1755
|
208 if (error_state) |
|
209 return retval; |
|
210 |
|
211 if (argc == 1 || (argc > 1 && argv[1] == "off")) |
1683
|
212 warning ("casesen: sorry, Octave is always case sensitive"); |
1755
|
213 else if (argc > 1 && argv[1] == "on") |
1683
|
214 ; // ok. |
|
215 else |
|
216 print_usage ("casesen"); |
|
217 |
|
218 return retval; |
|
219 } |
|
220 |
1957
|
221 DEFUN (computer, args, nargout, |
1683
|
222 "computer ():\n\ |
|
223 \n\ |
|
224 Have Octave ask the system, \"What kind of computer are you?\"") |
|
225 { |
2086
|
226 octave_value_list retval; |
1683
|
227 |
|
228 int nargin = args.length (); |
|
229 |
|
230 if (nargin != 0) |
|
231 warning ("computer: ignoring extra arguments"); |
|
232 |
2095
|
233 string msg; |
1683
|
234 |
|
235 if (strcmp (TARGET_HOST_TYPE, "unknown") == 0) |
2095
|
236 msg = "Hi Dave, I'm a HAL-9000"; |
1683
|
237 else |
2095
|
238 msg = TARGET_HOST_TYPE; |
1683
|
239 |
|
240 if (nargout == 0) |
2095
|
241 octave_stdout << msg << "\n"; |
1683
|
242 else |
2095
|
243 retval = msg; |
1683
|
244 |
|
245 return retval; |
|
246 } |
|
247 |
2068
|
248 DEFUN (quit, args, , |
|
249 "quit (STATUS): exit Octave gracefully, returning STATUS to the system.\n\ |
|
250 \n\ |
|
251 STATUS should be an integer value. If STATUS is missing, 0 is assumed.") |
1683
|
252 { |
2086
|
253 octave_value_list retval; |
2068
|
254 |
|
255 int exit_status = 0; |
|
256 |
3020
|
257 quitting_gracefully = true; |
2068
|
258 |
1683
|
259 int nargin = args.length (); |
|
260 |
|
261 if (nargin > 0) |
2068
|
262 { |
|
263 // XXX FIXME XXX -- need a safe uniform way to do this. |
1683
|
264 |
2068
|
265 double tmp = args(0).double_value (); |
1683
|
266 |
2068
|
267 if (! error_state && ! xisnan (tmp)) |
|
268 exit_status = NINT (tmp); |
|
269 } |
|
270 |
|
271 clean_up_and_exit (exit_status); |
|
272 |
1683
|
273 return retval; |
|
274 } |
|
275 |
|
276 DEFALIAS (exit, quit); |
|
277 |
1957
|
278 DEFUN (warranty, , , |
1683
|
279 "warranty (): describe copying conditions") |
|
280 { |
2086
|
281 octave_value_list retval; |
1683
|
282 |
2095
|
283 octave_stdout << "\n" OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\n\ |
1683
|
284 This program is free software; you can redistribute it and/or modify\n\ |
|
285 it under the terms of the GNU General Public License as published by\n\ |
|
286 the Free Software Foundation; either version 2 of the License, or\n\ |
|
287 (at your option) any later version.\n\ |
|
288 \n\ |
|
289 This program is distributed in the hope that it will be useful,\n\ |
|
290 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ |
|
291 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ |
|
292 GNU General Public License for more details.\n\ |
|
293 \n\ |
|
294 You should have received a copy of the GNU General Public License\n\ |
|
295 along with this program. If not, write to the Free Software\n\ |
|
296 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\ |
|
297 \n"; |
|
298 |
|
299 return retval; |
|
300 } |
|
301 |
|
302 // Execute a shell command. |
|
303 |
3060
|
304 static int cmd_status = 0; |
|
305 |
|
306 static void |
|
307 cmd_death_handler (pid_t, int status) |
|
308 { |
|
309 cmd_status = status; |
|
310 } |
|
311 |
1965
|
312 static void |
|
313 cleanup_iprocstream (void *p) |
|
314 { |
3060
|
315 iprocstream *cmd = static_cast<iprocstream *> (p); |
|
316 |
|
317 octave_child_list::remove (cmd->pid ()); |
|
318 |
|
319 delete cmd; |
1965
|
320 } |
|
321 |
2086
|
322 static octave_value_list |
2321
|
323 run_command_and_return_output (const string& cmd_str) |
2083
|
324 { |
2086
|
325 octave_value_list retval; |
2083
|
326 |
|
327 iprocstream *cmd = new iprocstream (cmd_str.c_str ()); |
|
328 |
3060
|
329 cmd_status = -1; |
2083
|
330 |
3060
|
331 if (cmd) |
2083
|
332 { |
3060
|
333 octave_child_list::insert (cmd->pid (), cmd_death_handler); |
|
334 |
|
335 unwind_protect::add (cleanup_iprocstream, cmd); |
|
336 |
|
337 if (*cmd) |
|
338 { |
|
339 ostrstream output_buf; |
2095
|
340 |
3060
|
341 char ch; |
|
342 while (cmd->get (ch)) |
|
343 output_buf.put (ch); |
2083
|
344 |
3060
|
345 cmd->close (); |
|
346 |
|
347 // One way or another, cmd_death_handler should be called |
|
348 // when the process exits, and it will save the exit status |
|
349 // of the command in cmd_status. |
2083
|
350 |
3060
|
351 // The value in cmd_status is as returned by waitpid. If |
|
352 // the process exited normally, extract the actual exit |
|
353 // status of the command. Otherwise, return 127 as a |
|
354 // failure code. |
2083
|
355 |
3060
|
356 if (WIFEXITED (cmd_status)) |
|
357 cmd_status = WEXITSTATUS (cmd_status); |
|
358 else |
|
359 cmd_status = 127; |
2083
|
360 |
3060
|
361 output_buf << ends; |
2145
|
362 |
3060
|
363 char *msg = output_buf.str (); |
2083
|
364 |
3060
|
365 retval(1) = (double) cmd_status; |
|
366 retval(0) = msg; |
2083
|
367 |
3060
|
368 delete [] msg; |
|
369 } |
|
370 |
|
371 unwind_protect::run (); |
2083
|
372 } |
|
373 else |
|
374 error ("unable to start subprocess for `%s'", cmd_str.c_str ()); |
|
375 |
|
376 return retval; |
|
377 } |
|
378 |
1957
|
379 DEFUN (system, args, nargout, |
2083
|
380 "system (STRING [, RETURN_OUTPUT] [, TYPE])\n\ |
|
381 \n\ |
|
382 Execute the shell command specified by STRING.\n\ |
|
383 \n\ |
|
384 If TYPE is \"async\", the process is started in the background and the\n\ |
|
385 pid of the child proces is returned immediately. Otherwise, the\n\ |
|
386 process is started, and Octave waits until it exits. If TYPE argument\n\ |
|
387 is omitted, a value of \"sync\" is assumed.\n\ |
|
388 \n\ |
|
389 If NARGIN == 2 (the actual value of RETURN_OUTPUT is irrelevant) and\n\ |
|
390 the subprocess is started synchronously, or if system() is called with\n\ |
|
391 NARGIN == 1 and NARGOUT > 0, the output from the command is returned.\n\ |
|
392 Otherwise, if the subprocess is executed synchronously, it's output is\n\ |
2321
|
393 sent to the standard output. To send the output of a command executed\n\ |
|
394 with system() through the pager, use a command like\n\ |
|
395 \n\ |
|
396 disp (system (CMD, 1));\n\ |
|
397 \n\ |
|
398 or\n\ |
|
399 \n\ |
2322
|
400 printf (\"%s\\n\", system (CMD, 1));") |
1683
|
401 { |
2086
|
402 octave_value_list retval; |
1683
|
403 |
|
404 int nargin = args.length (); |
|
405 |
2083
|
406 if (nargin > 0 && nargin < 4) |
1683
|
407 { |
2083
|
408 bool return_output = (nargout > 0 || nargin > 1); |
|
409 |
|
410 string cmd_str = args(0).string_value (); |
|
411 |
|
412 enum exec_type { sync, async }; |
|
413 |
|
414 exec_type type = sync; |
|
415 |
|
416 if (! error_state) |
|
417 { |
|
418 if (nargin > 2) |
|
419 { |
|
420 string type_str = args(2).string_value (); |
1683
|
421 |
2083
|
422 if (! error_state) |
|
423 { |
|
424 if (type_str == "sync") |
|
425 type = sync; |
|
426 else if (type_str == "async") |
|
427 type = async; |
|
428 else |
|
429 error ("system: third arg must be \"sync\" or \"async\""); |
|
430 } |
|
431 else |
|
432 error ("system: third argument must be a string"); |
|
433 } |
|
434 } |
|
435 else |
|
436 error ("system: expecting string as first argument"); |
1683
|
437 |
2083
|
438 if (! error_state) |
|
439 { |
|
440 if (type == async) |
|
441 { |
|
442 pid_t pid = fork (); |
|
443 |
|
444 if (pid < 0) |
|
445 error ("system: fork failed -- can't create child process"); |
|
446 else if (pid == 0) |
|
447 { |
|
448 system (cmd_str.c_str ()); |
|
449 exit (0); |
|
450 retval(0) = 0.0; |
|
451 } |
|
452 else |
2800
|
453 retval(0) = static_cast<double> (pid); |
2083
|
454 } |
2321
|
455 else if (return_output) |
|
456 retval = run_command_and_return_output (cmd_str); |
2083
|
457 else |
2321
|
458 { |
|
459 int status = system (cmd_str.c_str ()); |
|
460 |
|
461 // The value in status is as returned by waitpid. If |
|
462 // the process exited normally, extract the actual exit |
|
463 // status of the command. Otherwise, return 127 as a |
|
464 // failure code. |
|
465 |
2693
|
466 if (WIFEXITED (status)) |
|
467 status = WEXITSTATUS (status); |
2321
|
468 |
2800
|
469 retval = static_cast<double> (status); |
2321
|
470 } |
2083
|
471 } |
1683
|
472 } |
|
473 else |
2083
|
474 print_usage ("system"); |
1683
|
475 |
|
476 return retval; |
|
477 } |
|
478 |
|
479 DEFALIAS (shell_cmd, system); |
|
480 |
2614
|
481 // XXX FIXME XXX -- this should really be static, but that causes |
|
482 // problems on some systems. |
|
483 SLStack<string> octave_atexit_functions; |
2077
|
484 |
|
485 void |
|
486 do_octave_atexit (void) |
|
487 { |
|
488 while (! octave_atexit_functions.empty ()) |
|
489 { |
2086
|
490 octave_value_list fcn = octave_atexit_functions.pop (); |
2077
|
491 |
2942
|
492 feval (fcn, 0); |
2077
|
493 } |
|
494 } |
|
495 |
2162
|
496 DEFUN (atexit, args, , |
2077
|
497 "atexit (NAME): register NAME as a function to call when Octave exits\n\ |
|
498 \n\ |
2802
|
499 Functions are called with no arguments in the reverse of the order in\n\ |
2077
|
500 which they were registered with atexit()") |
|
501 { |
2086
|
502 octave_value_list retval; |
2077
|
503 |
|
504 int nargin = args.length (); |
|
505 |
|
506 if (nargin == 1) |
|
507 { |
2475
|
508 #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT) |
2077
|
509 string arg = args(0).string_value (); |
|
510 |
|
511 if (! error_state) |
|
512 octave_atexit_functions.push (arg); |
|
513 else |
|
514 error ("atexit: argument must be a string"); |
2475
|
515 #else |
|
516 gripe_not_supported ("atexit"); |
|
517 #endif |
2077
|
518 } |
|
519 else |
|
520 print_usage ("atexit"); |
|
521 |
|
522 return retval; |
|
523 } |
|
524 |
2689
|
525 DEFUN (octave_config_info, args, , |
|
526 "octave_config_info (OPTION)\n\ |
|
527 \n\ |
|
528 If OPTION is a string, return the configuration information for the\n\ |
|
529 specified option.\n\ |
|
530 \n\ |
|
531 With no arguments, return a structure containing configuration\n\ |
|
532 information.") |
2162
|
533 { |
2689
|
534 octave_value retval; |
|
535 |
2696
|
536 #if defined (WITH_DYNAMIC_LINKING) && (defined (WITH_DL) || defined (WITH_SHL)) |
2689
|
537 bool octave_supports_dynamic_linking = true; |
|
538 #else |
|
539 bool octave_supports_dynamic_linking = false; |
|
540 #endif |
|
541 |
2162
|
542 Octave_map m; |
|
543 |
|
544 m ["default_pager"] = DEFAULT_PAGER; |
|
545 m ["prefix"] = OCTAVE_PREFIX; |
|
546 m ["exec_prefix"] = OCTAVE_EXEC_PREFIX; |
|
547 m ["datadir"] = OCTAVE_DATADIR; |
2800
|
548 m ["dld"] = static_cast<double> (octave_supports_dynamic_linking); |
2162
|
549 m ["libdir"] = OCTAVE_LIBDIR; |
|
550 m ["bindir"] = OCTAVE_BINDIR; |
|
551 m ["infodir"] = OCTAVE_INFODIR; |
|
552 m ["fcnfiledir"] = OCTAVE_FCNFILEDIR; |
|
553 m ["localfcnfiledir"] = OCTAVE_LOCALFCNFILEDIR; |
|
554 m ["localstartupfiledir"] = OCTAVE_LOCALSTARTUPFILEDIR; |
|
555 m ["startupfiledir"] = OCTAVE_STARTUPFILEDIR; |
|
556 m ["localfcnfilepath"] = OCTAVE_LOCALFCNFILEPATH; |
|
557 m ["archlibdir"] = OCTAVE_ARCHLIBDIR; |
2439
|
558 m ["localarchlibdir"] = OCTAVE_LOCALARCHLIBDIR; |
2162
|
559 m ["octfiledir"] = OCTAVE_OCTFILEDIR; |
|
560 m ["localoctfilepath"] = OCTAVE_LOCALOCTFILEPATH; |
|
561 m ["fcnfilepath"] = OCTAVE_FCNFILEPATH; |
|
562 m ["imagepath"] = OCTAVE_IMAGEPATH; |
|
563 m ["target_host_type"] = TARGET_HOST_TYPE; |
|
564 m ["configure_options"] = config_opts; |
|
565 m ["F77"] = F77; |
|
566 m ["FFLAGS"] = FFLAGS; |
|
567 m ["FPICFLAG"] = FPICFLAG; |
|
568 m ["F2C"] = F2C; |
|
569 m ["F2CFLAGS"] = F2CFLAGS; |
|
570 m ["FLIBS"] = FLIBS; |
|
571 m ["CPPFLAGS"] = CPPFLAGS; |
|
572 m ["INCFLAGS"] = INCFLAGS; |
|
573 m ["CC"] = CC " " CC_VERSION; |
|
574 m ["CFLAGS"] = CFLAGS; |
|
575 m ["CPICFLAG"] = CPICFLAG; |
|
576 m ["CXX"] = CXX " " CXX_VERSION; |
|
577 m ["CXXFLAGS"] = CXXFLAGS; |
|
578 m ["CXXPICFLAG"] = CXXPICFLAG; |
|
579 m ["LDFLAGS"] = LDFLAGS; |
|
580 m ["LIBFLAGS"] = LIBFLAGS; |
2675
|
581 m ["RLD_FLAG"] = RLD_FLAG; |
2162
|
582 m ["TERMLIBS"] = TERMLIBS; |
|
583 m ["LIBS"] = LIBS; |
|
584 m ["LEXLIB"] = LEXLIB; |
|
585 m ["LIBPLPLOT"] = LIBPLPLOT; |
|
586 m ["LIBDLFCN"] = LIBDLFCN; |
|
587 m ["DEFS"] = DEFS; |
|
588 |
2689
|
589 int nargin = args.length (); |
|
590 |
|
591 if (nargin == 1) |
|
592 { |
|
593 string arg = args(0).string_value (); |
|
594 |
|
595 if (! error_state) |
|
596 retval = octave_value (m [arg.c_str ()]); |
|
597 } |
|
598 else if (nargin == 0) |
|
599 retval = octave_value (m); |
|
600 else |
|
601 print_usage ("octave_config_info"); |
|
602 |
|
603 return retval; |
2162
|
604 } |
|
605 |
1683
|
606 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE) |
2806
|
607 |
1683
|
608 int debug_new_delete = 0; |
|
609 |
|
610 typedef void (*vfp)(void); |
|
611 extern vfp __new_handler; |
|
612 |
|
613 void * |
|
614 __builtin_new (size_t sz) |
|
615 { |
|
616 void *p; |
|
617 |
|
618 /* malloc (0) is unpredictable; avoid it. */ |
|
619 if (sz == 0) |
|
620 sz = 1; |
2800
|
621 p = malloc (sz); |
1683
|
622 while (p == 0) |
|
623 { |
|
624 (*__new_handler) (); |
2800
|
625 p = malloc (sz); |
1683
|
626 } |
|
627 |
|
628 if (debug_new_delete) |
|
629 cout << "__builtin_new: " << p << endl; |
|
630 |
|
631 return p; |
|
632 } |
|
633 |
|
634 void |
|
635 __builtin_delete (void *ptr) |
|
636 { |
|
637 if (debug_new_delete) |
|
638 cout << "__builtin_delete: " << ptr << endl; |
|
639 |
|
640 if (ptr) |
|
641 free (ptr); |
|
642 } |
2806
|
643 |
1683
|
644 #endif |
|
645 |
2806
|
646 void |
|
647 symbols_of_toplev (void) |
|
648 { |
3020
|
649 DEFCONST (argv, , 0, 0, |
|
650 "the command line arguments this program was invoked with"); |
2806
|
651 |
3020
|
652 DEFCONST (program_invocation_name, |
|
653 octave_env::get_program_invocation_name (), 0, 0, |
|
654 "the full name of the current program or script, including the\n\ |
|
655 directory specification"); |
|
656 |
|
657 DEFCONST (program_name, octave_env::get_program_name (), 0, 0, |
|
658 "the name of the current program or script"); |
2806
|
659 } |
|
660 |
1683
|
661 /* |
|
662 ;;; Local Variables: *** |
|
663 ;;; mode: C++ *** |
|
664 ;;; End: *** |
|
665 */ |