GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
toplev.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1995-2015 John W. Eaton
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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <cassert>
28 #include <cerrno>
29 #include <cstdlib>
30 #include <cstring>
31 #include <new>
32 
33 #include <fstream>
34 #include <iostream>
35 #include <sstream>
36 #include <string>
37 
38 #include <sys/select.h>
39 #include <sys/types.h>
40 #include <unistd.h>
41 
42 #include "cmd-edit.h"
43 #include "cmd-hist.h"
44 #include "file-ops.h"
45 #include "lo-error.h"
46 #include "lo-mappers.h"
47 #include "oct-env.h"
48 #include "oct-locbuf.h"
49 #include "quit.h"
50 #include "singleton-cleanup.h"
51 #include "str-vec.h"
52 
53 #include "defaults.h"
54 #include "defun.h"
55 #include "error.h"
56 #include "file-io.h"
57 #include "graphics.h"
58 #include "input.h"
59 #include "lex.h"
60 #include "load-save.h"
61 #include "octave-link.h"
62 #include "oct-conf.h"
63 #include "oct-conf-features.h"
64 #include "oct-hist.h"
65 #include "oct-map.h"
66 #include "oct-obj.h"
67 #include "ov.h"
68 #include "pager.h"
69 #include "parse.h"
70 #include "pathsearch.h"
71 #include "procstream.h"
72 #include "pt-eval.h"
73 #include "pt-jump.h"
74 #include "pt-stmt.h"
75 #include "sighandlers.h"
76 #include "sysdep.h"
77 #include "syswait.h"
78 #include "toplev.h"
79 #include "unwind-prot.h"
80 #include "utils.h"
81 #include "variables.h"
82 #include "version.h"
83 
84 #ifndef SHELL_PATH
85 #define SHELL_PATH "/bin/sh"
86 #endif
87 
88 void (*octave_exit) (int) = ::exit;
89 
90 // TRUE means the quit() call is allowed.
91 bool quit_allowed = true;
92 
93 // TRUE means we are exiting via the builtin exit or quit functions.
94 bool quitting_gracefully = false;
95 // This stores the exit status.
96 int exit_status = 0;
97 
98 // TRUE means we are ready to interpret commands, but not everything
99 // is ready for interactive use.
101 
102 // TRUE means we've processed all the init code and we are good to go.
103 bool octave_initialized = false;
104 
106 
107 std::string
109 {
110  return m_fcn ? m_fcn->fcn_file_name () : std::string ();
111 }
112 
113 std::string
115 {
116  std::string retval;
117 
118  if (m_fcn)
119  {
120  std::string parent_fcn_name = m_fcn->parent_fcn_name ();
121 
122  if (print_subfn && ! parent_fcn_name.empty ())
123  retval = parent_fcn_name + Vfilemarker;
124 
125  retval += m_fcn->name ();
126  }
127  else
128  retval = "<unknown>";
129 
130  return retval;
131 }
132 
133 void
135 {
136  instance = new octave_call_stack ();
137 
138  if (instance)
139  {
141 
143  }
144 }
145 
146 int
148 {
149  int retval = -1;
150 
151  if (! cs.empty ())
152  {
153  const stack_frame& elt = cs[curr_frame];
154  retval = elt.m_line;
155  }
156 
157  return retval;
158 }
159 
160 int
162 {
163  int retval = -1;
164 
165  if (! cs.empty ())
166  {
167  const stack_frame& elt = cs[curr_frame];
168  retval = elt.m_column;
169  }
170 
171  return retval;
172 }
173 
174 int
176 {
177  int retval = -1;
178 
179  const_iterator p = cs.end ();
180 
181  while (p != cs.begin ())
182  {
183  const stack_frame& elt = *(--p);
184 
185  octave_function *f = elt.m_fcn;
186 
187  if (f && f->is_user_code ())
188  {
189  if (elt.m_line > 0)
190  {
191  retval = elt.m_line;
192  break;
193  }
194  }
195  }
196 
197  return retval;
198 }
199 
200 int
202 {
203  int retval = -1;
204 
205  const_iterator p = cs.end ();
206 
207  while (p != cs.begin ())
208  {
209  const stack_frame& elt = *(--p);
210 
211  octave_function *f = elt.m_fcn;
212 
213  if (f && f->is_user_code ())
214  {
215  if (elt.m_column)
216  {
217  retval = elt.m_column;
218  break;
219  }
220  }
221  }
222 
223  return retval;
224 }
225 
226 size_t
228  (octave_idx_type& curr_user_frame) const
229 {
230  size_t retval = 0;
231 
232  curr_user_frame = 0;
233 
234  // Look for the caller of dbstack.
235  size_t xframe = cs[curr_frame].m_prev;
236 
237  bool found = false;
238 
239  size_t k = cs.size ();
240 
241  for (const_reverse_iterator p = cs.rbegin (); p != cs.rend (); p++)
242  {
243  octave_function *f = (*p).m_fcn;
244 
245  if (--k == xframe)
246  found = true;
247 
248  if (f && f->is_user_code ())
249  {
250  if (! found)
251  curr_user_frame++;
252 
253  retval++;
254  }
255  }
256 
257  // We counted how many user frames were not the one, in reverse.
258  // Now set curr_user_frame to be the index in the other direction.
259  curr_user_frame = retval - curr_user_frame - 1;
260 
261  return retval;
262 }
263 
266 {
267  octave_user_code *retval = 0;
268 
269  const_iterator p = cs.end ();
270 
271  while (p != cs.begin ())
272  {
273  const stack_frame& elt = *(--p);
274 
275  octave_function *f = elt.m_fcn;
276 
277  if (f && f->is_user_code ())
278  {
279  if (nskip > 0)
280  nskip--;
281  else
282  {
283  retval = dynamic_cast<octave_user_code *> (f);
284  break;
285  }
286  }
287  }
288 
289  return retval;
290 }
291 
292 bool
294 {
295  bool retval = true;
296 
297  const_iterator p = cs.end ();
298 
299  while (p != cs.begin ())
300  {
301  const stack_frame& elt = *(--p);
302 
303  octave_function *f = elt.m_fcn;
304 
305  if (f && ! f->is_user_script ())
306  {
307  retval = false;
308  break;
309  }
310  }
311 
312  return retval;
313 }
314 
315 // Use static fields for the best efficiency.
316 // NOTE: C++0x will allow these two to be merged into one.
317 static const char *bt_fieldnames[] = { "file", "name", "line",
318  "column", "scope", "context", 0
319  };
320 static const octave_fields bt_fields (bt_fieldnames);
321 
324 {
325  return octave_map (dim_vector (0, 1), bt_fields);
326 }
327 
328 std::list<octave_call_stack::stack_frame>
330  octave_idx_type& curr_user_frame) const
331 {
332  std::list<octave_call_stack::stack_frame> retval;
333 
334  size_t user_code_frames = do_num_user_code_frames (curr_user_frame);
335 
336  size_t nframes = nskip <= user_code_frames ? user_code_frames - nskip : 0;
337 
338  // Our list is reversed.
339  curr_user_frame = nframes - curr_user_frame - 1;
340 
341  if (nframes > 0)
342  {
343  for (const_reverse_iterator p = cs.rbegin (); p != cs.rend (); p++)
344  {
345  const stack_frame& elt = *p;
346 
347  octave_function *f = elt.m_fcn;
348 
349  if (f && f->is_user_code ())
350  {
351  if (nskip > 0)
352  nskip--;
353  else
354  retval.push_back (elt);
355  }
356  }
357  }
358 
359  return retval;
360 }
361 
364  octave_idx_type& curr_user_frame,
365  bool print_subfn) const
366 {
367  std::list<octave_call_stack::stack_frame> frames
368  = do_backtrace_frames (nskip, curr_user_frame);
369 
370  size_t nframes = frames.size ();
371 
372  octave_map retval (dim_vector (nframes, 1), bt_fields);
373 
374  Cell& file = retval.contents (0);
375  Cell& name = retval.contents (1);
376  Cell& line = retval.contents (2);
377  Cell& column = retval.contents (3);
378  Cell& scope = retval.contents (4);
379  Cell& context = retval.contents (5);
380 
381  octave_idx_type k = 0;
382 
383  for (std::list<octave_call_stack::stack_frame>::const_iterator p = frames.begin ();
384  p != frames.end (); p++)
385  {
386  const stack_frame& elt = *p;
387 
388  scope(k) = elt.m_scope;
389  context(k) = elt.m_context;
390  file(k) = elt.fcn_file_name ();
391  name(k) = elt.fcn_name (print_subfn);
392  line(k) = elt.m_line;
393  column(k) = elt.m_column;
394 
395  k++;
396  }
397 
398  return retval;
399 }
400 
401 bool
402 octave_call_stack::do_goto_frame (size_t n, bool verbose)
403 {
404  bool retval = false;
405 
406  if (n < cs.size ())
407  {
408  retval = true;
409 
410  curr_frame = n;
411 
412  const stack_frame& elt = cs[n];
413 
415 
416  if (verbose)
417  octave_stdout << "stopped in " << elt.fcn_name ()
418  << " at line " << elt.m_line
419  << " column " << elt.m_column
420  << " (" << elt.m_scope << "[" << elt.m_context << "])"
421  << std::endl;
422  }
423 
424  return retval;
425 }
426 
427 bool
429 {
430  bool retval = false;
431 
432  int incr = 0;
433 
434  if (nskip < 0)
435  incr = -1;
436  else if (nskip > 0)
437  incr = 1;
438 
439  // Start looking with the caller of dbup/dbdown/keyboard.
440  size_t xframe = cs[curr_frame].m_prev;
441 
442  while (true)
443  {
444  if ((incr < 0 && xframe == 0) || (incr > 0 && xframe == cs.size () - 1))
445  break;
446 
447  xframe += incr;
448 
449  const stack_frame& elt = cs[xframe];
450 
451  octave_function *f = elt.m_fcn;
452 
453  if (xframe == 0 || (f && f->is_user_code ()))
454  {
455  if (nskip > 0)
456  nskip--;
457  else if (nskip < 0)
458  nskip++;
459 
460  if (nskip == 0)
461  {
462  curr_frame = xframe;
463  cs[cs.size () - 1].m_prev = curr_frame;
464 
466 
467  if (verbose)
468  {
469  std::ostringstream buf;
470 
471  if (f)
472  buf << "stopped in " << f->name ()
473  << " at line " << elt.m_line << std::endl;
474  else
475  buf << "at top level" << std::endl;
476 
477  octave_stdout << buf.str ();
478  }
479 
480  retval = true;
481  break;
482  }
483  }
484  else if (incr == 0) // Break out of infinite loop by choosing an incr.
485  incr = -1;
486 
487  // There is no need to set scope and context here. That will
488  // happen when the dbup/dbdown/keyboard frame is popped and we
489  // jump to the new "prev" frame set above.
490  }
491 
492  return retval;
493 }
494 
495 void
497 {
498  size_t xframe = curr_frame;
499 
500  bool skipped = false;
501 
502  while (xframe != 0)
503  {
504  xframe = cs[xframe].m_prev;
505 
506  const stack_frame& elt = cs[xframe];
507 
508  octave_function *f = elt.m_fcn;
509 
510  if (elt.m_scope == cs[0].m_scope || (f && f->is_user_code ()))
511  {
512  if (! skipped)
513  // We found the current user code frame, so skip it.
514  skipped = true;
515  else
516  {
517  // We found the caller user code frame.
518  stack_frame tmp (elt);
519  tmp.m_prev = curr_frame;
520 
521  curr_frame = cs.size ();
522 
523  cs.push_back (tmp);
524 
526 
527  break;
528  }
529  }
530  }
531 }
532 
533 void
535 {
536  stack_frame tmp (cs[0]);
537  tmp.m_prev = curr_frame;
538 
539  curr_frame = cs.size ();
540 
541  cs.push_back (tmp);
542 
544 }
545 
546 void
548 {
549  can_interrupt = true;
556 }
557 
558 int
559 main_loop (void)
560 {
562 
563  can_interrupt = true;
564 
568 
570 
571  octave_initialized = true;
572 
573  // The big loop.
574 
575  octave_lexer *lxr = (interactive
576  ? new octave_lexer ()
577  : new octave_lexer (stdin));
578 
579  octave_parser parser (*lxr);
580 
581  int retval = 0;
582  do
583  {
584  try
585  {
587 
588  parser.reset ();
589 
592 
593  retval = parser.run ();
594 
595  if (retval == 0)
596  {
597  if (parser.stmt_list)
598  {
600 
601  octave_quit ();
602 
603  if (! interactive)
604  {
605  bool quit = (tree_return_command::returning
607 
610 
613 
614  if (quit)
615  break;
616  }
617 
618  if (error_state)
619  {
620  if (! interactive)
621  {
622  // We should exit with a nonzero status.
623  retval = 1;
624  break;
625  }
626  }
627  else
628  {
631  else
633  }
634  }
635  else if (parser.lexer.end_of_input)
636  break;
637  }
638  }
639  catch (octave_interrupt_exception)
640  {
642  octave_stdout << "\n";
644  return exit_status;
645  }
646  catch (octave_execution_exception)
647  {
649  std::cerr << "error: unhandled execution exception -- trying to return to prompt"
650  << std::endl;
651  }
652  catch (std::bad_alloc)
653  {
655  std::cerr << "error: out of memory -- trying to return to prompt"
656  << std::endl;
657  }
658  }
659  while (retval == 0);
660 
661  octave_stdout << "\n";
662 
663  if (retval == EOF)
664  retval = 0;
665 
666  return retval;
667 }
668 
669 // Fix up things before exiting.
670 
671 static std::list<std::string> octave_atexit_functions;
672 
673 static void
675 {
676  static bool deja_vu = false;
677 
679 
680  while (! octave_atexit_functions.empty ())
681  {
682  std::string fcn = octave_atexit_functions.front ();
683 
684  octave_atexit_functions.pop_front ();
685 
687 
688  OCTAVE_SAFE_CALL (feval, (fcn, octave_value_list (), 0));
689 
691  }
692 
693  if (! deja_vu)
694  {
695  deja_vu = true;
696 
697  // Process pending events and disasble octave_link event
698  // processing with this call.
699 
701 
702  // Do this explicitly so that destructors for mex file objects
703  // are called, so that functions registered with mexAtExit are
704  // called.
706 
708 
709  // FIXME: is this needed? Can it cause any trouble?
710  OCTAVE_SAFE_CALL (raw_mode, (0));
711 
713 
716 
718 
720 
722 
724 
726 
728 
730 
732 
734  {
735  octave_stdout << "\n";
736 
737  // Yes, we want this to be separate from the call to
738  // flush_octave_stdout above.
739 
741  }
742 
743  // Don't call singleton_cleanup_list::cleanup until we have the
744  // problems with registering/unregistering types worked out. For
745  // example, uncomment the following line, then use the make_int
746  // function from the examples directory to create an integer
747  // object and then exit Octave. Octave should crash with a
748  // segfault when cleaning up the typinfo singleton. We need some
749  // way to force new octave_value_X types that are created in
750  // .oct files to be unregistered when the .oct file shared library
751  // is unloaded.
752  //
753  // OCTAVE_SAFE_CALL (singleton_cleanup_list::cleanup, ());
754 
756  }
757 }
758 
759 void
760 clean_up_and_exit (int status, bool safe_to_return)
761 {
762  do_octave_atexit ();
763 
764  if (octave_link::exit (status))
765  {
766  if (safe_to_return)
767  return;
768  else
769  {
770  // What should we do here? We might be called from some
771  // location other than the end of octave_execute_interpreter,
772  // so it might not be safe to return.
773 
774  // We have nothing else to do at this point, and the
775  // octave_link::exit function is supposed to take care of
776  // exiting for us. Assume that job won't take more than a
777  // day...
778 
779  gnulib::sleep (86400);
780  }
781  }
782  else
783  {
784  if (octave_exit)
785  (*octave_exit) (status);
786  }
787 }
788 
789 DEFUN (quit, args, ,
790  "-*- texinfo -*-\n\
791 @deftypefn {Built-in Function} {} exit\n\
792 @deftypefnx {Built-in Function} {} exit (@var{status})\n\
793 @deftypefnx {Built-in Function} {} quit\n\
794 @deftypefnx {Built-in Function} {} quit (@var{status})\n\
795 Exit the current Octave session.\n\
796 \n\
797 If the optional integer value @var{status} is supplied, pass that value to\n\
798 the operating system as Octave's exit status. The default value is zero.\n\
799 \n\
800 When exiting, Octave will attempt to run the m-file @file{finish.m} if it\n\
801 exists. User commands to save the workspace or clean up temporary files\n\
802 may be placed in that file. Alternatively, another m-file may be scheduled\n\
803 to run using @code{atexit}.\n\
804 @seealso{atexit}\n\
805 @end deftypefn")
806 {
807  octave_value_list retval;
808 
809  // Confirm OK to shutdown. Note: A dynamic function installation similar
810  // to overriding polymorphism for which the GUI can install its own "quit"
811  // yet call this base "quit" could be nice. No link would be needed here.
813  return retval;
814 
815  if (! quit_allowed)
816  error ("quit: not supported in embedded mode");
817  else
818  {
819  if (args.length () > 0)
820  {
821  int tmp = args(0).nint_value ();
822 
823  if (! error_state)
824  exit_status = tmp;
825  }
826 
827  if (! error_state)
828  {
829  // Instead of simply calling exit, we simulate an interrupt
830  // with a request to exit cleanly so that no matter where the
831  // call to quit occurs, we will run the unwind_protect stack,
832  // clear the OCTAVE_LOCAL_BUFFER allocations, etc. before
833  // exiting.
834 
835  quitting_gracefully = true;
836 
838 
840  }
841  }
842 
843  return retval;
844 }
845 
846 DEFALIAS (exit, quit);
847 
848 DEFUN (warranty, , ,
849  "-*- texinfo -*-\n\
850 @deftypefn {Built-in Function} {} warranty ()\n\
851 Describe the conditions for copying and distributing Octave.\n\
852 @end deftypefn")
853 {
854  octave_value_list retval;
855 
857 \n\
858 GNU Octave is free software; you can redistribute it and/or modify\n\
859 it under the terms of the GNU General Public License as published by\n\
860 the Free Software Foundation; either version 3 of the License, or\n\
861 (at your option) any later version.\n\
862 \n\
863 GNU Octave is distributed in the hope that it will be useful,\n\
864 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
865 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
866 GNU General Public License for more details.\n\
867 \n\
868 You should have received a copy of the GNU General Public License\n\
869 along with this program. If not, see <http://www.gnu.org/licenses/>.\n\
870 \n";
871 
872  return retval;
873 }
874 
875 // Execute a shell command.
876 
877 static int
878 wait_for_input (int fid)
879 {
880  int retval = -1;
881 
882 #if defined (HAVE_SELECT)
883  if (fid >= 0)
884  {
885  fd_set set;
886 
887  FD_ZERO (&set);
888  FD_SET (fid, &set);
889 
890  retval = gnulib::select (FD_SETSIZE, &set, 0, 0, 0);
891  }
892 #else
893  retval = 1;
894 #endif
895 
896  return retval;
897 }
898 
899 static octave_value_list
900 run_command_and_return_output (const std::string& cmd_str)
901 {
902  octave_value_list retval;
903  unwind_protect frame;
904 
905  iprocstream *cmd = new iprocstream (cmd_str.c_str ());
906 
907  frame.add_delete (cmd);
908  frame.add_fcn (octave_child_list::remove, cmd->pid ());
909 
910  if (*cmd)
911  {
912  int fid = cmd->file_number ();
913 
914  std::ostringstream output_buf;
915 
916  char ch;
917 
918  for (;;)
919  {
920  if (cmd->get (ch))
921  output_buf.put (ch);
922  else
923  {
924  if (! cmd->eof () && errno == EAGAIN)
925  {
926  cmd->clear ();
927 
928  if (wait_for_input (fid) != 1)
929  break;
930  }
931  else
932  break;
933  }
934  }
935 
936  int cmd_status = cmd->close ();
937 
938  if (octave_wait::ifexited (cmd_status))
939  cmd_status = octave_wait::exitstatus (cmd_status);
940  else
941  cmd_status = 127;
942 
943  retval(1) = output_buf.str ();
944  retval(0) = cmd_status;
945  }
946  else
947  error ("unable to start subprocess for '%s'", cmd_str.c_str ());
948 
949  return retval;
950 }
951 
953 
954 DEFUN (system, args, nargout,
955  "-*- texinfo -*-\n\
956 @deftypefn {Built-in Function} {} system (\"@var{string}\")\n\
957 @deftypefnx {Built-in Function} {} system (\"@var{string}\", @var{return_output})\n\
958 @deftypefnx {Built-in Function} {} system (\"@var{string}\", @var{return_output}, @var{type})\n\
959 @deftypefnx {Built-in Function} {[@var{status}, @var{output}] =} system (@dots{})\n\
960 Execute a shell command specified by @var{string}.\n\
961 \n\
962 If the optional argument @var{type} is @qcode{\"async\"}, the process is\n\
963 started in the background and the process ID of the child process is\n\
964 returned immediately. Otherwise, the child process is started and Octave\n\
965 waits until it exits. If the @var{type} argument is omitted, it defaults to\n\
966 the value @qcode{\"sync\"}.\n\
967 \n\
968 If @var{system} is called with one or more output arguments, or if the\n\
969 optional argument @var{return_output} is true and the subprocess is started\n\
970 synchronously, then the output from the command is returned as a variable.\n\
971 Otherwise, if the subprocess is executed synchronously, its output is sent\n\
972 to the standard output. To send the output of a command executed with\n\
973 @code{system} through the pager, use a command like\n\
974 \n\
975 @example\n\
976 @group\n\
977 [output, text] = system (\"cmd\");\n\
978 disp (text);\n\
979 @end group\n\
980 @end example\n\
981 \n\
982 @noindent\n\
983 or\n\
984 \n\
985 @example\n\
986 printf (\"%s\\n\", nthargout (2, \"system\", \"cmd\"));\n\
987 @end example\n\
988 \n\
989 The @code{system} function can return two values. The first is the\n\
990 exit status of the command and the second is any output from the\n\
991 command that was written to the standard output stream. For example,\n\
992 \n\
993 @example\n\
994 [status, output] = system (\"echo foo; exit 2\");\n\
995 @end example\n\
996 \n\
997 @noindent\n\
998 will set the variable @code{output} to the string @samp{foo}, and the\n\
999 variable @code{status} to the integer @samp{2}.\n\
1000 \n\
1001 For commands run asynchronously, @var{status} is the process id of the\n\
1002 command shell that is started to run the command.\n\
1003 @seealso{unix, dos}\n\
1004 @end deftypefn")
1005 {
1006  octave_value_list retval;
1007 
1008  unwind_protect frame;
1009 
1010  int nargin = args.length ();
1011 
1012  if (nargin > 0 && nargin < 4)
1013  {
1014  bool return_output = (nargin == 1 && nargout > 1);
1015 
1017 
1018  if (nargin == 3)
1019  {
1020  if (args(2).is_string ())
1021  {
1022  std::string type_str = args(2).string_value ();
1023 
1024  if (type_str == "sync")
1025  type = et_sync;
1026  else if (type_str == "async")
1027  type = et_async;
1028  else
1029  {
1030  error ("system: TYPE must be \"sync\" or \"async\"");
1031  return retval;
1032  }
1033  }
1034  else
1035  {
1036  error ("system: TYPE must be a string");
1037  return retval;
1038  }
1039  }
1040 
1041  if (nargin > 1)
1042  {
1043  return_output = args(1).is_true ();
1044 
1045  if (error_state)
1046  {
1047  error ("system: RETURN_OUTPUT must be boolean value true or false");
1048  return retval;
1049  }
1050  }
1051 
1052  if (return_output && type == et_async)
1053  {
1054  error ("system: can't return output from commands run asynchronously");
1055  return retval;
1056  }
1057 
1058  std::string cmd_str = args(0).string_value ();
1059 
1060  if (! error_state)
1061  {
1062 #if defined (__WIN32__) && ! defined (__CYGWIN__)
1063  // Work around weird double-quote handling on Windows systems.
1064  if (type == et_sync)
1065  cmd_str = "\"" + cmd_str + "\"";
1066 #endif
1067 
1068  if (type == et_async)
1069  {
1070  // FIXME: maybe this should go in sysdep.cc?
1071 #ifdef HAVE_FORK
1072  pid_t pid = fork ();
1073 
1074  if (pid < 0)
1075  error ("system: fork failed -- can't create child process");
1076  else if (pid == 0)
1077  {
1078  // FIXME: should probably replace this
1079  // call with something portable.
1080 
1081  execl (SHELL_PATH, "sh", "-c", cmd_str.c_str (),
1082  static_cast<void *> (0));
1083 
1084  panic_impossible ();
1085  }
1086  else
1087  retval(0) = pid;
1088 #elif defined (__WIN32__)
1089  STARTUPINFO si;
1090  PROCESS_INFORMATION pi;
1091  ZeroMemory (&si, sizeof (si));
1092  ZeroMemory (&pi, sizeof (pi));
1093  OCTAVE_LOCAL_BUFFER (char, xcmd_str, cmd_str.length ()+1);
1094  strcpy (xcmd_str, cmd_str.c_str ());
1095 
1096  if (! CreateProcess (0, xcmd_str, 0, 0, FALSE, 0, 0, 0, &si, &pi))
1097  error ("system: CreateProcess failed -- can't create child process");
1098  else
1099  {
1100  retval(0) = pi.dwProcessId;
1101  CloseHandle (pi.hProcess);
1102  CloseHandle (pi.hThread);
1103  }
1104 #else
1105  error ("asynchronous system calls are not supported");
1106 #endif
1107  }
1108  else if (return_output)
1109  retval = run_command_and_return_output (cmd_str);
1110  else
1111  {
1112  int status = system (cmd_str.c_str ());
1113 
1114  // The value in status is as returned by waitpid. If
1115  // the process exited normally, extract the actual exit
1116  // status of the command. Otherwise, return 127 as a
1117  // failure code.
1118 
1119  if (octave_wait::ifexited (status))
1120  status = octave_wait::exitstatus (status);
1121 
1122  retval(0) = status;
1123  }
1124  }
1125  else
1126  error ("system: expecting string as first argument");
1127  }
1128  else
1129  print_usage ();
1130 
1131  return retval;
1132 }
1133 
1134 /*
1135 %!test
1136 %! cmd = ls_command ();
1137 %! [status, output] = system (cmd);
1138 %! assert (status, 0);
1139 %! assert (ischar (output));
1140 %! assert (! isempty (output));
1141 
1142 %!error system ()
1143 %!error system (1, 2, 3)
1144 */
1145 
1146 void
1147 octave_add_atexit_function (const std::string& fname)
1148 {
1149  octave_atexit_functions.push_front (fname);
1150 }
1151 
1152 bool
1153 octave_remove_atexit_function (const std::string& fname)
1154 {
1155  bool found = false;
1156 
1157  for (std::list<std::string>::iterator p = octave_atexit_functions.begin ();
1158  p != octave_atexit_functions.end (); p++)
1159  {
1160  if (*p == fname)
1161  {
1162  octave_atexit_functions.erase (p);
1163  found = true;
1164  break;
1165  }
1166  }
1167 
1168  return found;
1169 }
1170 
1171 
1172 DEFUN (atexit, args, nargout,
1173  "-*- texinfo -*-\n\
1174 @deftypefn {Built-in Function} {} atexit (@var{fcn})\n\
1175 @deftypefnx {Built-in Function} {} atexit (@var{fcn}, @var{flag})\n\
1176 Register a function to be called when Octave exits.\n\
1177 \n\
1178 For example,\n\
1179 \n\
1180 @example\n\
1181 @group\n\
1182 function last_words ()\n\
1183  disp (\"Bye bye\");\n\
1184 endfunction\n\
1185 atexit (\"last_words\");\n\
1186 @end group\n\
1187 @end example\n\
1188 \n\
1189 @noindent\n\
1190 will print the message @qcode{\"Bye bye\"} when Octave exits.\n\
1191 \n\
1192 The additional argument @var{flag} will register or unregister @var{fcn}\n\
1193 from the list of functions to be called when Octave exits. If @var{flag} is\n\
1194 true, the function is registered, and if @var{flag} is false, it is\n\
1195 unregistered. For example, after registering the function @code{last_words}\n\
1196 above,\n\
1197 \n\
1198 @example\n\
1199 atexit (\"last_words\", false);\n\
1200 @end example\n\
1201 \n\
1202 @noindent\n\
1203 will remove the function from the list and Octave will not call\n\
1204 @code{last_words} when it exits.\n\
1205 \n\
1206 Note that @code{atexit} only removes the first occurrence of a function\n\
1207 from the list, so if a function was placed in the list multiple times with\n\
1208 @code{atexit}, it must also be removed from the list multiple times.\n\
1209 @seealso{quit}\n\
1210 @end deftypefn")
1211 {
1212  octave_value_list retval;
1213 
1214  int nargin = args.length ();
1215 
1216  if (nargin == 1 || nargin == 2)
1217  {
1218  if (args(0).is_string ())
1219  {
1220  std::string arg = args(0).string_value ();
1221 
1222  bool add_mode = true;
1223 
1224  if (nargin == 2)
1225  {
1226  add_mode = args(1).bool_value ();
1227 
1228  if (error_state)
1229  error ("atexit: FLAG argument must be a logical value");
1230  }
1231 
1232  if (! error_state)
1233  {
1234  if (add_mode)
1236  else
1237  {
1238  bool found = octave_remove_atexit_function (arg);
1239 
1240  if (nargout > 0)
1241  retval(0) = found;
1242  }
1243  }
1244  }
1245  else
1246  error ("atexit: FCN argument must be a string");
1247  }
1248  else
1249  print_usage ();
1250 
1251  return retval;
1252 }
1253 
1254 DEFUN (octave_config_info, args, ,
1255  "-*- texinfo -*-\n\
1256 @deftypefn {Built-in Function} {} octave_config_info ()\n\
1257 @deftypefnx {Built-in Function} {} octave_config_info (@var{option})\n\
1258 Return a structure containing configuration and installation information for\n\
1259 Octave.\n\
1260 \n\
1261 If @var{option} is a string, return the configuration information for the\n\
1262 specified option.\n\
1263 \n\
1264 @seealso{computer}\n\
1265 @end deftypefn")
1266 {
1267  octave_value retval;
1268 
1269 #if defined (ENABLE_DYNAMIC_LINKING)
1270  bool octave_supports_dynamic_linking = true;
1271 #else
1272  bool octave_supports_dynamic_linking = false;
1273 #endif
1274 
1275  static bool initialized = false;
1276  static octave_scalar_map m;
1277 
1278  struct conf_info_struct
1279  {
1280  bool subst_home;
1281  const char *key;
1282  const char *val;
1283  };
1284 
1285  static const conf_info_struct conf_info[] =
1286  {
1287  { false, "ALL_CFLAGS", OCTAVE_CONF_ALL_CFLAGS },
1288  { false, "ALL_CXXFLAGS", OCTAVE_CONF_ALL_CXXFLAGS },
1289  { false, "ALL_FFLAGS", OCTAVE_CONF_ALL_FFLAGS },
1290  { false, "ALL_LDFLAGS", OCTAVE_CONF_ALL_LDFLAGS },
1291  { false, "AMD_CPPFLAGS", OCTAVE_CONF_AMD_CPPFLAGS },
1292  { false, "AMD_LDFLAGS", OCTAVE_CONF_AMD_LDFLAGS },
1293  { false, "AMD_LIBS", OCTAVE_CONF_AMD_LIBS },
1294  { false, "AR", OCTAVE_CONF_AR },
1295  { false, "ARFLAGS", OCTAVE_CONF_ARFLAGS },
1296  { false, "ARPACK_CPPFLAGS", OCTAVE_CONF_ARPACK_CPPFLAGS },
1297  { false, "ARPACK_LDFLAGS", OCTAVE_CONF_ARPACK_LDFLAGS },
1298  { false, "ARPACK_LIBS", OCTAVE_CONF_ARPACK_LIBS },
1299  { false, "BLAS_LIBS", OCTAVE_CONF_BLAS_LIBS },
1300  { false, "CAMD_CPPFLAGS", OCTAVE_CONF_CAMD_CPPFLAGS },
1301  { false, "CAMD_LDFLAGS", OCTAVE_CONF_CAMD_LDFLAGS },
1302  { false, "CAMD_LIBS", OCTAVE_CONF_CAMD_LIBS },
1303  { false, "CARBON_LIBS", OCTAVE_CONF_CARBON_LIBS },
1304  { false, "CC", OCTAVE_CONF_CC },
1305  { false, "CCOLAMD_CPPFLAGS", OCTAVE_CONF_CCOLAMD_CPPFLAGS },
1306  { false, "CCOLAMD_LDFLAGS", OCTAVE_CONF_CCOLAMD_LDFLAGS },
1307  { false, "CCOLAMD_LIBS", OCTAVE_CONF_CCOLAMD_LIBS },
1308  { false, "CFLAGS", OCTAVE_CONF_CFLAGS },
1309  { false, "CHOLMOD_CPPFLAGS", OCTAVE_CONF_CHOLMOD_CPPFLAGS },
1310  { false, "CHOLMOD_LDFLAGS", OCTAVE_CONF_CHOLMOD_LDFLAGS },
1311  { false, "CHOLMOD_LIBS", OCTAVE_CONF_CHOLMOD_LIBS },
1312  { false, "COLAMD_CPPFLAGS", OCTAVE_CONF_COLAMD_CPPFLAGS },
1313  { false, "COLAMD_LDFLAGS", OCTAVE_CONF_COLAMD_LDFLAGS },
1314  { false, "COLAMD_LIBS", OCTAVE_CONF_COLAMD_LIBS },
1315  { false, "CPICFLAG", OCTAVE_CONF_CPICFLAG },
1316  { false, "CPPFLAGS", OCTAVE_CONF_CPPFLAGS },
1317  { false, "CURL_CPPFLAGS", OCTAVE_CONF_CURL_CPPFLAGS },
1318  { false, "CURL_LDFLAGS", OCTAVE_CONF_CURL_LDFLAGS },
1319  { false, "CURL_LIBS", OCTAVE_CONF_CURL_LIBS },
1320  { false, "CXSPARSE_CPPFLAGS", OCTAVE_CONF_CXSPARSE_CPPFLAGS },
1321  { false, "CXSPARSE_LDFLAGS", OCTAVE_CONF_CXSPARSE_LDFLAGS },
1322  { false, "CXSPARSE_LIBS", OCTAVE_CONF_CXSPARSE_LIBS },
1323  { false, "CXX", OCTAVE_CONF_CXX },
1324  { false, "CXXCPP", OCTAVE_CONF_CXXCPP },
1325  { false, "CXXFLAGS", OCTAVE_CONF_CXXFLAGS },
1326  { false, "CXXPICFLAG", OCTAVE_CONF_CXXPICFLAG },
1327  { false, "DEFAULT_PAGER", OCTAVE_DEFAULT_PAGER },
1328  { false, "DEFS", OCTAVE_CONF_DEFS },
1329  { false, "DL_LD", OCTAVE_CONF_DL_LD },
1330  { false, "DL_LDFLAGS", OCTAVE_CONF_DL_LDFLAGS },
1331  { false, "DL_LIBS", OCTAVE_CONF_DL_LIBS },
1332  { false, "GCC_VERSION", OCTAVE_CONF_GCC_VERSION },
1333  { false, "GXX_VERSION", OCTAVE_CONF_GXX_VERSION },
1334  { false, "ENABLE_DYNAMIC_LINKING", OCTAVE_CONF_ENABLE_DYNAMIC_LINKING },
1335  { false, "EXEEXT", OCTAVE_CONF_EXEEXT },
1336  { false, "F77", OCTAVE_CONF_F77 },
1337  { false, "F77_FLOAT_STORE_FLAG", OCTAVE_CONF_F77_FLOAT_STORE_FLAG },
1338  { false, "F77_INTEGER_8_FLAG", OCTAVE_CONF_F77_INTEGER_8_FLAG },
1339  { false, "FFLAGS", OCTAVE_CONF_FFLAGS },
1340  { false, "FFTW3_CPPFLAGS", OCTAVE_CONF_FFTW3_CPPFLAGS },
1341  { false, "FFTW3_LDFLAGS", OCTAVE_CONF_FFTW3_LDFLAGS },
1342  { false, "FFTW3_LIBS", OCTAVE_CONF_FFTW3_LIBS },
1343  { false, "FFTW3F_CPPFLAGS", OCTAVE_CONF_FFTW3F_CPPFLAGS },
1344  { false, "FFTW3F_LDFLAGS", OCTAVE_CONF_FFTW3F_LDFLAGS },
1345  { false, "FFTW3F_LIBS", OCTAVE_CONF_FFTW3F_LIBS },
1346  { false, "FLIBS", OCTAVE_CONF_FLIBS },
1347  { false, "FLTK_CPPFLAGS", OCTAVE_CONF_FLTK_CPPFLAGS },
1348  { false, "FLTK_LDFLAGS", OCTAVE_CONF_FLTK_LDFLAGS },
1349  { false, "FLTK_LIBS", OCTAVE_CONF_FLTK_LIBS },
1350  { false, "FONTCONFIG_CPPFLAGS", OCTAVE_CONF_FONTCONFIG_CPPFLAGS },
1351  { false, "FONTCONFIG_LIBS", OCTAVE_CONF_FONTCONFIG_LIBS },
1352  { false, "FPICFLAG", OCTAVE_CONF_FPICFLAG },
1353  { false, "FT2_CPPFLAGS", OCTAVE_CONF_FT2_CPPFLAGS },
1354  { false, "FT2_LIBS", OCTAVE_CONF_FT2_LIBS },
1355  { false, "GLPK_CPPFLAGS", OCTAVE_CONF_GLPK_CPPFLAGS },
1356  { false, "GLPK_LDFLAGS", OCTAVE_CONF_GLPK_LDFLAGS },
1357  { false, "GLPK_LIBS", OCTAVE_CONF_GLPK_LIBS },
1358  { false, "GNUPLOT", OCTAVE_CONF_GNUPLOT },
1359  { false, "HDF5_CPPFLAGS", OCTAVE_CONF_HDF5_CPPFLAGS },
1360  { false, "HDF5_LDFLAGS", OCTAVE_CONF_HDF5_LDFLAGS },
1361  { false, "HDF5_LIBS", OCTAVE_CONF_HDF5_LIBS },
1362  { false, "LAPACK_LIBS", OCTAVE_CONF_LAPACK_LIBS },
1363  { false, "LDFLAGS", OCTAVE_CONF_LDFLAGS },
1364  { false, "LD_CXX", OCTAVE_CONF_LD_CXX },
1365  { false, "LD_STATIC_FLAG", OCTAVE_CONF_LD_STATIC_FLAG },
1366  { false, "LEX", OCTAVE_CONF_LEX },
1367  { false, "LEXLIB", OCTAVE_CONF_LEXLIB },
1368  { false, "LFLAGS", OCTAVE_CONF_LFLAGS },
1369  { false, "LIBEXT", OCTAVE_CONF_LIBEXT },
1370  { false, "LIBFLAGS", OCTAVE_CONF_LIBFLAGS },
1371  { false, "LIBOCTAVE", OCTAVE_CONF_LIBOCTAVE },
1372  { false, "LIBOCTINTERP", OCTAVE_CONF_LIBOCTINTERP },
1373  { false, "LIBS", OCTAVE_CONF_LIBS },
1374  { false, "LLVM_CPPFLAGS", OCTAVE_CONF_LLVM_CPPFLAGS },
1375  { false, "LLVM_LDFLAGS", OCTAVE_CONF_LLVM_LDFLAGS },
1376  { false, "LLVM_LIBS", OCTAVE_CONF_LLVM_LIBS },
1377  { false, "LN_S", OCTAVE_CONF_LN_S },
1378  { false, "MAGICK_CPPFLAGS", OCTAVE_CONF_MAGICK_CPPFLAGS },
1379  { false, "MAGICK_LDFLAGS", OCTAVE_CONF_MAGICK_LDFLAGS },
1380  { false, "MAGICK_LIBS", OCTAVE_CONF_MAGICK_LIBS },
1381  { false, "MKOCTFILE_DL_LDFLAGS", OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS },
1382  { false, "OCTAVE_LINK_DEPS", OCTAVE_CONF_OCTAVE_LINK_DEPS },
1383  { false, "OCTAVE_LINK_OPTS", OCTAVE_CONF_OCTAVE_LINK_OPTS },
1384  { false, "OCT_LINK_DEPS", OCTAVE_CONF_OCT_LINK_DEPS },
1385  { false, "OCT_LINK_OPTS", OCTAVE_CONF_OCT_LINK_OPTS },
1386  { false, "OPENGL_LIBS", OCTAVE_CONF_OPENGL_LIBS },
1387  { false, "OSMESA_CPPFLAGS", OCTAVE_CONF_OSMESA_CPPFLAGS },
1388  { false, "OSMESA_LDFLAGS", OCTAVE_CONF_OSMESA_LDFLAGS },
1389  { false, "OSMESA_LIBS", OCTAVE_CONF_OSMESA_LIBS },
1390  { false, "PCRE_CPPFLAGS", OCTAVE_CONF_PCRE_CPPFLAGS },
1391  { false, "PCRE_LIBS", OCTAVE_CONF_PCRE_LIBS },
1392  { false, "PTHREAD_CFLAGS", OCTAVE_CONF_PTHREAD_CFLAGS },
1393  { false, "PTHREAD_LIBS", OCTAVE_CONF_PTHREAD_LIBS },
1394  { false, "QHULL_CPPFLAGS", OCTAVE_CONF_QHULL_CPPFLAGS },
1395  { false, "QHULL_LDFLAGS", OCTAVE_CONF_QHULL_LDFLAGS },
1396  { false, "QHULL_LIBS", OCTAVE_CONF_QHULL_LIBS },
1397  { false, "QRUPDATE_CPPFLAGS", OCTAVE_CONF_QRUPDATE_CPPFLAGS },
1398  { false, "QRUPDATE_LDFLAGS", OCTAVE_CONF_QRUPDATE_LDFLAGS },
1399  { false, "QRUPDATE_LIBS", OCTAVE_CONF_QRUPDATE_LIBS },
1400  { false, "QT_CPPFLAGS", OCTAVE_CONF_QT_CPPFLAGS },
1401  { false, "QT_LDFLAGS", OCTAVE_CONF_QT_LDFLAGS },
1402  { false, "QT_LIBS", OCTAVE_CONF_QT_LIBS },
1403  { false, "RANLIB", OCTAVE_CONF_RANLIB },
1404  { false, "RDYNAMIC_FLAG", OCTAVE_CONF_RDYNAMIC_FLAG },
1405  { false, "READLINE_LIBS", OCTAVE_CONF_READLINE_LIBS },
1406  { false, "SED", OCTAVE_CONF_SED },
1407  { false, "SHARED_LIBS", OCTAVE_CONF_SHARED_LIBS },
1408  { false, "SHLEXT", OCTAVE_CONF_SHLEXT },
1409  { false, "SHLEXT_VER", OCTAVE_CONF_SHLEXT_VER },
1410  { false, "SH_LD", OCTAVE_CONF_SH_LD },
1411  { false, "SH_LDFLAGS", OCTAVE_CONF_SH_LDFLAGS },
1412  { false, "SONAME_FLAGS", OCTAVE_CONF_SONAME_FLAGS },
1413  { false, "STATIC_LIBS", OCTAVE_CONF_STATIC_LIBS },
1414  { false, "TERM_LIBS", OCTAVE_CONF_TERM_LIBS },
1415  { false, "UMFPACK_CPPFLAGS", OCTAVE_CONF_UMFPACK_CPPFLAGS },
1416  { false, "UMFPACK_LDFLAGS", OCTAVE_CONF_UMFPACK_LDFLAGS },
1417  { false, "UMFPACK_LIBS", OCTAVE_CONF_UMFPACK_LIBS },
1418  { false, "USE_64_BIT_IDX_T", OCTAVE_CONF_USE_64_BIT_IDX_T },
1419  { false, "WARN_CFLAGS", OCTAVE_CONF_WARN_CFLAGS },
1420  { false, "WARN_CXXFLAGS", OCTAVE_CONF_WARN_CXXFLAGS },
1421  { false, "X11_INCFLAGS", OCTAVE_CONF_X11_INCFLAGS },
1422  { false, "X11_LIBS", OCTAVE_CONF_X11_LIBS },
1423  { false, "XTRA_CFLAGS", OCTAVE_CONF_XTRA_CFLAGS },
1424  { false, "XTRA_CXXFLAGS", OCTAVE_CONF_XTRA_CXXFLAGS },
1425  { false, "YACC", OCTAVE_CONF_YACC },
1426  { false, "YFLAGS", OCTAVE_CONF_YFLAGS },
1427  { false, "Z_CPPFLAGS", OCTAVE_CONF_Z_CPPFLAGS },
1428  { false, "Z_LDFLAGS", OCTAVE_CONF_Z_LDFLAGS },
1429  { false, "Z_LIBS", OCTAVE_CONF_Z_LIBS },
1430  { false, "api_version", OCTAVE_API_VERSION },
1431  { true, "archlibdir", OCTAVE_ARCHLIBDIR },
1432  { true, "bindir", OCTAVE_BINDIR },
1433  { false, "canonical_host_type", OCTAVE_CANONICAL_HOST_TYPE },
1434  { false, "config_opts", OCTAVE_CONF_config_opts },
1435  { true, "datadir", OCTAVE_DATADIR },
1436  { true, "datarootdir", OCTAVE_DATAROOTDIR },
1437  { true, "exec_prefix", OCTAVE_EXEC_PREFIX },
1438  { true, "fcnfiledir", OCTAVE_FCNFILEDIR },
1439  { true, "imagedir", OCTAVE_IMAGEDIR },
1440  { true, "includedir", OCTAVE_INCLUDEDIR },
1441  { true, "infodir", OCTAVE_INFODIR },
1442  { true, "infofile", OCTAVE_INFOFILE },
1443  { true, "libdir", OCTAVE_LIBDIR },
1444  { true, "libexecdir", OCTAVE_LIBEXECDIR },
1445  { true, "localapiarchlibdir", OCTAVE_LOCALAPIARCHLIBDIR },
1446  { true, "localapifcnfiledir", OCTAVE_LOCALAPIFCNFILEDIR },
1447  { true, "localapioctfiledir", OCTAVE_LOCALAPIOCTFILEDIR },
1448  { true, "localarchlibdir", OCTAVE_LOCALARCHLIBDIR },
1449  { true, "localfcnfiledir", OCTAVE_LOCALFCNFILEDIR },
1450  { true, "localoctfiledir", OCTAVE_LOCALOCTFILEDIR },
1451  { true, "localstartupfiledir", OCTAVE_LOCALSTARTUPFILEDIR },
1452  { true, "localverarchlibdir", OCTAVE_LOCALVERARCHLIBDIR },
1453  { true, "localverfcnfiledir", OCTAVE_LOCALVERFCNFILEDIR },
1454  { true, "localveroctfiledir", OCTAVE_LOCALVEROCTFILEDIR },
1455  { true, "man1dir", OCTAVE_MAN1DIR },
1456  { false, "man1ext", OCTAVE_MAN1EXT },
1457  { true, "mandir", OCTAVE_MANDIR },
1458  { true, "octdatadir", OCTAVE_OCTDATADIR },
1459  { true, "octfiledir", OCTAVE_OCTFILEDIR },
1460  { true, "octetcdir", OCTAVE_OCTETCDIR },
1461  { true, "octincludedir", OCTAVE_OCTINCLUDEDIR },
1462  { true, "octlibdir", OCTAVE_OCTLIBDIR },
1463  { true, "octtestsdir", OCTAVE_OCTTESTSDIR },
1464  { true, "prefix", OCTAVE_PREFIX },
1465  { true, "startupfiledir", OCTAVE_STARTUPFILEDIR },
1466  { false, "version", OCTAVE_VERSION },
1467  { false, 0, 0 }
1468  };
1469 
1470  if (! initialized)
1471  {
1472  m.assign ("dld", octave_value (octave_supports_dynamic_linking));
1473 
1475  m.assign ("float_format",
1477 
1478  m.assign ("words_big_endian",
1480 
1481  m.assign ("words_little_endian",
1483 
1484  m.assign ("features", octave_value (octave_config_features ()));
1485 
1486  int i = 0;
1487 
1488  while (true)
1489  {
1490  const conf_info_struct& elt = conf_info[i++];
1491 
1492  const char *key = elt.key;
1493 
1494  if (key)
1495  {
1496  if (elt.subst_home)
1497  m.assign (key, subst_octave_home (elt.val));
1498  else
1499  m.assign (key, elt.val);
1500  }
1501  else
1502  break;
1503  }
1504 
1505  bool unix_system = true;
1506  bool mac_system = false;
1507  bool windows_system = false;
1508 
1509 #if defined (WIN32)
1510  windows_system = true;
1511 #if !defined (__CYGWIN__)
1512  unix_system = false;
1513 #endif
1514 #endif
1515 
1516 #if defined (OCTAVE_USE_OS_X_API)
1517  mac_system = true;
1518 #endif
1519 
1520  m.assign ("unix", octave_value (unix_system));
1521  m.assign ("mac", octave_value (mac_system));
1522  m.assign ("windows", octave_value (windows_system));
1523 
1524  initialized = true;
1525  }
1526 
1527  int nargin = args.length ();
1528 
1529  if (nargin == 1)
1530  {
1531  std::string arg = args(0).string_value ();
1532 
1533  if (! error_state)
1534  {
1535  if (m.isfield (arg))
1536  {
1537  Cell c = m.contents (arg);
1538 
1539  if (c.is_empty ())
1540  error ("octave_config_info: no info for '%s'", arg.c_str ());
1541  else
1542  retval = c(0);
1543  }
1544  else
1545  error ("octave_config_info: invalid parameter '%s'", arg.c_str ());
1546  }
1547  }
1548  else if (nargin == 0)
1549  retval = m;
1550  else
1551  print_usage ();
1552 
1553  return retval;
1554 }
1555 
1556 /*
1557 %!assert (ischar (octave_config_info ("version")))
1558 %!test
1559 %! x = octave_config_info ();
1560 %! assert (isstruct (x));
1561 %! assert (! isempty (x));
1562 
1563 %!error octave_config_info (1, 2)
1564 */
1565 
1566 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
1567 
1568 int debug_new_delete = 0;
1569 
1570 typedef void (*vfp)(void);
1571 extern vfp __new_handler;
1572 
1573 void *
1574 __builtin_new (size_t sz)
1575 {
1576  void *p;
1577 
1578  /* malloc (0) is unpredictable; avoid it. */
1579  if (sz == 0)
1580  sz = 1;
1581  p = gnulib::malloc (sz);
1582  while (p == 0)
1583  {
1584  (*__new_handler) ();
1585  p = gnulib::malloc (sz);
1586  }
1587 
1588  if (debug_new_delete)
1589  std::cerr << "__builtin_new: " << p << std::endl;
1590 
1591  return p;
1592 }
1593 
1594 void
1595 __builtin_delete (void *ptr)
1596 {
1597  if (debug_new_delete)
1598  std::cerr << "__builtin_delete: " << ptr << std::endl;
1599 
1600  if (ptr)
1601  free (ptr);
1602 }
1603 
1604 #endif
static void close_all_figures(void)
Definition: graphics.h:13378
static std::list< std::string > octave_atexit_functions
Definition: toplev.cc:671
#define OCTAVE_SAFE_CALL(F, ARGS)
Definition: toplev.h:503
#define OCTAVE_CONF_TERM_LIBS
Definition: oct-conf.h:570
#define OCTAVE_CONF_CAMD_LDFLAGS
Definition: oct-conf.h:84
volatile sig_atomic_t octave_signal_caught
Definition: cquit.c:84
static bool ignoring_entries(void)
Definition: cmd-hist.cc:606
#define OCTAVE_FCNFILEDIR
Definition: defaults.h:68
#define OCTAVE_CONF_FLTK_CPPFLAGS
Definition: oct-conf.h:282
static void unload_all_toolkits(void)
Definition: graphics.h:2341
#define OCTAVE_CONF_CAMD_CPPFLAGS
Definition: oct-conf.h:80
void flush_octave_stdout(void)
Definition: pager.cc:458
const Cell & contents(const_iterator p) const
Definition: oct-map.h:314
bool is_empty(void) const
Definition: Array.h:472
#define OCTAVE_CONF_COLAMD_CPPFLAGS
Definition: oct-conf.h:133
#define OCTAVE_CONF_PTHREAD_CFLAGS
Definition: oct-conf.h:482
#define OCTAVE_CONF_WARN_CFLAGS
Definition: oct-conf.h:590
bool isfield(const std::string &name) const
Definition: oct-map.h:208
#define OCTAVE_CONF_LLVM_LDFLAGS
Definition: oct-conf.h:418
Definition: Cell.h:35
void octave_restore_signal_mask(void)
Definition: cquit.c:73
#define OCTAVE_DATADIR
Definition: defaults.h:48
#define OCTAVE_CONF_QT_LIBS
Definition: oct-conf.h:522
#define OCTAVE_CONF_CCOLAMD_LIBS
Definition: oct-conf.h:113
std::string fcn_name(bool print_subfn=true) const
Definition: toplev.cc:114
void(* octave_interrupt_hook)(void)=0
Definition: quit.cc:35
static std::string float_format_as_string(float_format)
Definition: mach-info.cc:205
static bool at_top_level(void)
Definition: symtab.h:1303
#define OCTAVE_CONF_QHULL_CPPFLAGS
Definition: oct-conf.h:490
bool quit_allowed
Definition: toplev.cc:91
#define OCTAVE_CONF_X11_LIBS
Definition: oct-conf.h:602
#define OCTAVE_CONF_COLAMD_LDFLAGS
Definition: oct-conf.h:137
#define OCTAVE_CONF_AR
Definition: oct-conf.h:60
size_t curr_frame
Definition: toplev.h:349
#define OCTAVE_LOCALVEROCTFILEDIR
Definition: defaults.h:136
#define OCTAVE_CONF_OPENGL_LIBS
Definition: oct-conf.h:454
void raw_mode(bool on, bool wait)
Definition: sysdep.cc:339
void do_push(octave_function *fcn, symbol_table::scope_id scope, symbol_table::context_id context)
Definition: toplev.h:410
int exit_status
Definition: toplev.cc:96
#define OCTAVE_CONF_CPPFLAGS
Definition: oct-conf.h:149
static std::string subst_octave_home(const std::string &s)
Definition: shared-fcns.h:120
#define OCTAVE_CONF_QHULL_LDFLAGS
Definition: oct-conf.h:494
#define OCTAVE_CONF_OCT_LINK_DEPS
Definition: oct-conf.h:446
void recover_from_exception(void)
Definition: toplev.cc:547
OCTINTERP_API void print_usage(void)
Definition: defun.cc:51
void octave_save_signal_mask(void)
Definition: cquit.c:67
static void restore_terminal_state(void)
Definition: cmd-edit.cc:1189
#define OCTAVE_LOCALFCNFILEDIR
Definition: defaults.h:112
octave_idx_type length(void) const
Definition: oct-obj.h:89
#define OCTAVE_CONF_CURL_LDFLAGS
Definition: oct-conf.h:157
void accept(tree_walker &tw)
Definition: pt-stmt.cc:289
const octave_value & contents(const_iterator p) const
Definition: oct-map.h:192
#define OCTAVE_CONF_SH_LDFLAGS
Definition: oct-conf.h:558
#define OCTAVE_CONF_OCT_LINK_OPTS
Definition: oct-conf.h:450
#define OCTAVE_CONF_OSMESA_CPPFLAGS
Definition: oct-conf.h:458
#define OCTAVE_CONF_READLINE_LIBS
Definition: oct-conf.h:534
#define OCTAVE_OCTETCDIR
Definition: defaults.h:160
#define OCTAVE_CONF_PCRE_LIBS
Definition: oct-conf.h:474
int do_caller_user_code_column(void) const
Definition: toplev.cc:201
#define OCTAVE_CONF_MAGICK_CPPFLAGS
Definition: oct-conf.h:402
#define OCTAVE_CONF_LIBFLAGS
Definition: oct-conf.h:382
static bool ifexited(int status)
Definition: lo-utils.h:145
#define OCTAVE_CONF_ALL_CFLAGS
Definition: oct-conf.h:28
#define OCTAVE_LOCALSTARTUPFILEDIR
Definition: defaults.h:120
bool end_of_input
Definition: lex.h:309
#define OCTAVE_CONF_SH_LD
Definition: oct-conf.h:554
void octave_throw_interrupt_exception(void)
Definition: quit.cc:52
#define OCTAVE_CONF_ARPACK_LDFLAGS
Definition: oct-conf.h:68
#define OCTAVE_CONF_LLVM_CPPFLAGS
Definition: oct-conf.h:414
#define OCTAVE_CONF_LIBEXT
Definition: oct-conf.h:378
virtual bool is_user_code(void) const
Definition: ov-base.h:443
std::list< octave_call_stack::stack_frame > do_backtrace_frames(size_t nskip, octave_idx_type &curr_user_frame) const
Definition: toplev.cc:329
#define DEFUN(name, args_name, nargout_name, doc)
Definition: defun.h:44
#define OCTAVE_LOCALARCHLIBDIR
Definition: defaults.h:108
void error(const char *fmt,...)
Definition: error.cc:476
octave_interrupt_handler octave_catch_interrupts(void)
Definition: sighandlers.cc:563
#define OCTAVE_CONF_MAGICK_LIBS
Definition: oct-conf.h:410
std::string name(void) const
Definition: ov-fcn.h:161
#define OCTAVE_INFOFILE
Definition: defaults.h:84
octave_value_list feval(const std::string &name, const octave_value_list &args, int nargout)
Definition: oct-parse.cc:8625
std::string fcn_file_name(void) const
Definition: toplev.cc:108
#define OCTAVE_CONF_FONTCONFIG_LIBS
Definition: oct-conf.h:298
void(* octave_bad_alloc_hook)(void)=0
Definition: quit.cc:36
#define OCTAVE_CONF_SHLEXT
Definition: oct-conf.h:546
#define OCTAVE_STARTUPFILEDIR
Definition: defaults.h:184
#define OCTAVE_OCTTESTSDIR
Definition: defaults.h:176
bool do_all_scripts(void) const
Definition: toplev.cc:293
bool quitting_gracefully
Definition: toplev.cc:94
#define OCTAVE_OCTFILEDIR
Definition: defaults.h:156
#define OCTAVE_CONF_LD_CXX
Definition: oct-conf.h:358
#define OCTAVE_API_VERSION
Definition: version.h:43
#define OCTAVE_ARCHLIBDIR
Definition: main.cc:50
#define OCTAVE_CONF_UMFPACK_CPPFLAGS
Definition: oct-conf.h:574
bool octave_initialized
Definition: toplev.cc:103
static const char * bt_fieldnames[]
Definition: toplev.cc:317
#define OCTAVE_CONF_OSMESA_LDFLAGS
Definition: oct-conf.h:462
#define OCTAVE_CONF_SONAME_FLAGS
Definition: oct-conf.h:562
#define OCTAVE_CONF_CURL_CPPFLAGS
Definition: oct-conf.h:153
#define OCTAVE_CONF_config_opts
Definition: oct-conf.h:634
void sysdep_cleanup(void)
Definition: sysdep.cc:321
#define OCTAVE_CONF_Z_CPPFLAGS
Definition: oct-conf.h:622
#define OCTAVE_CONF_ALL_CXXFLAGS
Definition: oct-conf.h:32
static OCTAVE_API void clear(void)
Definition: oct-locbuf.cc:132
#define OCTAVE_CANONICAL_HOST_TYPE
Definition: defaults.h:32
#define OCTAVE_CONF_Z_LDFLAGS
Definition: oct-conf.h:626
#define OCTAVE_CONF_HDF5_LDFLAGS
Definition: oct-conf.h:334
#define OCTAVE_CONF_LEX
Definition: oct-conf.h:370
#define OCTAVE_CONF_QRUPDATE_CPPFLAGS
Definition: oct-conf.h:502
#define OCTAVE_CONF_LEXLIB
Definition: oct-conf.h:366
#define OCTAVE_CONF_GLPK_LIBS
Definition: oct-conf.h:322
#define OCTAVE_CONF_OCTAVE_LINK_OPTS
Definition: oct-conf.h:434
static void create_instance(void)
Definition: toplev.cc:134
#define OCTAVE_CONF_AMD_CPPFLAGS
Definition: oct-conf.h:44
#define OCTAVE_CONF_GNUPLOT
Definition: oct-conf.h:326
#define OCTAVE_CONF_GCC_VERSION
Definition: oct-conf.h:226
void cleanup_tmp_files(void)
Definition: file-io.cc:123
#define OCTAVE_DATAROOTDIR
Definition: defaults.h:52
int close(void)
Definition: procstream.cc:57
#define OCTAVE_MAN1DIR
Definition: defaults.h:140
#define OCTAVE_CONF_CCOLAMD_CPPFLAGS
Definition: oct-conf.h:105
This class gets nodes and searchs inside of 'info files'.
Definition: parser.h:49
static scope_id top_scope(void)
Definition: symtab.h:1161
#define OCTAVE_PREFIX
Definition: main.cc:58
#define OCTAVE_CONF_DL_LD
Definition: oct-conf.h:206
static void clean_up_and_save(const std::string &=std::string(), int=-1)
Definition: cmd-hist.cc:774
#define OCTAVE_OCTLIBDIR
Definition: defaults.h:172
#define OCTAVE_CONF_FPICFLAG
Definition: oct-conf.h:302
#define OCTAVE_CONF_GLPK_LDFLAGS
Definition: oct-conf.h:318
#define DEFALIAS(alias, name)
Definition: defun.h:63
static int breaking
Definition: pt-jump.h:48
#define OCTAVE_CONF_LIBS
Definition: oct-conf.h:394
#define OCTAVE_CONF_RDYNAMIC_FLAG
Definition: oct-conf.h:530
#define OCTAVE_MANDIR
Definition: defaults.h:148
void add_delete(T *obj)
std::deque< stack_frame > cs
Definition: toplev.h:347
#define OCTAVE_CONF_SHARED_LIBS
Definition: oct-conf.h:542
#define OCTAVE_CONF_LAPACK_LIBS
Definition: oct-conf.h:350
void do_goto_caller_frame(void)
Definition: toplev.cc:496
#define OCTAVE_CONF_QHULL_LIBS
Definition: oct-conf.h:498
F77_RET_T const double const double * f
void add_fcn(void(*fcn)(void))
#define OCTAVE_DEFAULT_PAGER
Definition: defaults.h:36
#define OCTAVE_CONF_XTRA_CFLAGS
Definition: oct-conf.h:606
#define OCTAVE_CONF_PCRE_CPPFLAGS
Definition: oct-conf.h:470
bool interactive
Definition: input.cc:103
#define OCTAVE_CONF_QT_CPPFLAGS
Definition: oct-conf.h:514
void close_files(void)
Definition: file-io.cc:105
#define OCTAVE_CONF_AMD_LIBS
Definition: oct-conf.h:52
int main_loop(void)
Definition: toplev.cc:559
std::deque< stack_frame >::const_iterator const_iterator
Definition: toplev.h:121
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
void octave_history_write_timestamp(void)
Definition: oct-hist.cc:574
#define OCTAVE_CONF_STATIC_LIBS
Definition: oct-conf.h:566
#define OCTAVE_CONF_CHOLMOD_LIBS
Definition: oct-conf.h:129
int run(void)
Definition: oct-parse.cc:7955
#define OCTAVE_CONF_CFLAGS
Definition: oct-conf.h:117
static void add(fptr f)
#define OCTAVE_CONF_PTHREAD_LIBS
Definition: oct-conf.h:486
int do_current_column(void) const
Definition: toplev.cc:161
bool do_goto_frame(size_t n, bool verbose)
Definition: toplev.cc:402
#define OCTAVE_CONF_FFTW3_LIBS
Definition: oct-conf.h:262
#define OCTAVE_CONF_LIBOCTAVE
Definition: oct-conf.h:386
#define OCTAVE_CONF_OCTAVE_LINK_DEPS
Definition: oct-conf.h:430
#define OCTAVE_CONF_FLTK_LDFLAGS
Definition: oct-conf.h:286
static bool words_little_endian(void)
Definition: mach-info.cc:178
int do_caller_user_code_line(void) const
Definition: toplev.cc:175
sig_atomic_t octave_exception_state
Definition: cquit.c:82
#define OCTAVE_INCLUDEDIR
Definition: defaults.h:76
#define OCTAVE_CONF_FLTK_LIBS
Definition: oct-conf.h:290
int error_state
Definition: error.cc:101
#define OCTAVE_CONF_OSMESA_LIBS
Definition: oct-conf.h:466
static void cleanup(void)
Definition: symtab.cc:1582
#define OCTAVE_CONF_SHLEXT_VER
Definition: oct-conf.h:550
#define OCTAVE_CONF_FONTCONFIG_CPPFLAGS
Definition: oct-conf.h:294
#define OCTAVE_BINDIR
Definition: main.cc:54
#define OCTAVE_CONF_CXSPARSE_LDFLAGS
Definition: oct-conf.h:169
octave_scalar_map octave_config_features(void)
#define OCTAVE_CONF_AMD_LDFLAGS
Definition: oct-conf.h:48
#define OCTAVE_IMAGEDIR
Definition: defaults.h:72
#define panic_impossible()
Definition: error.h:33
#define OCTAVE_CONF_HDF5_LIBS
Definition: oct-conf.h:338
void clean_up_and_exit(int status, bool safe_to_return)
Definition: toplev.cc:760
void reset_error_handler(void)
Definition: error.cc:124
sig_atomic_t octave_interrupt_state
Definition: cquit.c:80
#define OCTAVE_CONF_F77_FLOAT_STORE_FLAG
Definition: oct-conf.h:238
static void reset_debug_state(void)
Definition: pt-eval.cc:130
void(* octave_exit)(int)
Definition: toplev.cc:88
#define OCTAVE_CONF_CC
Definition: oct-conf.h:96
#define OCTAVE_CONF_RANLIB
Definition: oct-conf.h:526
static void remove(pid_t pid)
Definition: sighandlers.cc:974
virtual bool is_user_script(void) const
Definition: ov-base.h:439
#define OCTAVE_CONF_XTRA_CXXFLAGS
Definition: oct-conf.h:610
static bool words_big_endian(void)
Definition: mach-info.cc:171
#define OCTAVE_CONF_LIBOCTINTERP
Definition: oct-conf.h:390
#define OCTAVE_CONF_LLVM_LIBS
Definition: oct-conf.h:422
#define OCTAVE_CONF_ALL_LDFLAGS
Definition: oct-conf.h:40
#define OCTAVE_LOCALAPIFCNFILEDIR
Definition: defaults.h:100
#define OCTAVE_LOCALOCTFILEDIR
Definition: defaults.h:116
#define OCTAVE_CONF_WARN_CXXFLAGS
Definition: oct-conf.h:594
octave_map do_backtrace(size_t nskip, octave_idx_type &curr_user_frame, bool print_subfn) const
Definition: toplev.cc:363
symbol_table::scope_id m_scope
Definition: toplev.h:115
#define OCTAVE_CONF_LN_S
Definition: oct-conf.h:398
sig_atomic_t octave_interrupt_immediately
Definition: cquit.c:78
#define OCTAVE_LOCALVERARCHLIBDIR
Definition: defaults.h:128
tree_evaluator * current_evaluator
Definition: pt-eval.cc:52
octave_call_stack(void)
Definition: toplev.h:81
#define OCTAVE_LIBDIR
Definition: defaults.h:88
size_t do_num_user_code_frames(octave_idx_type &curr_user_frame) const
Definition: toplev.cc:228
#define OCTAVE_CONF_CARBON_LIBS
Definition: oct-conf.h:92
bool can_interrupt
Definition: sighandlers.cc:61
#define OCTAVE_CONF_FFLAGS
Definition: oct-conf.h:250
#define OCTAVE_CONF_QRUPDATE_LIBS
Definition: oct-conf.h:510
#define OCTAVE_VERSION
Definition: main.cc:46
void octave_signal_handler(void)
Definition: sighandlers.cc:269
double arg(double x)
Definition: lo-mappers.h:37
#define OCTAVE_CONF_CXXFLAGS
Definition: oct-conf.h:181
octave_base_lexer & lexer
Definition: parse.h:459
#define OCTAVE_CONF_FT2_CPPFLAGS
Definition: oct-conf.h:306
void reset(void)
Definition: oct-parse.cc:5995
bool do_goto_frame_relative(int n, bool verbose)
Definition: toplev.cc:428
#define OCTAVE_OCTDATADIR
Definition: defaults.h:152
#define OCTAVE_CONF_CPICFLAG
Definition: oct-conf.h:145
#define OCTAVE_LOCALAPIOCTFILEDIR
Definition: defaults.h:104
#define OCTAVE_CONF_Z_LIBS
Definition: oct-conf.h:630
pid_t pid(void) const
Definition: procstream.h:57
#define OCTAVE_CONF_YFLAGS
Definition: oct-conf.h:618
virtual std::string fcn_file_name(void) const
Definition: ov-fcn.h:62
void(* octave_signal_hook)(void)=0
Definition: quit.cc:34
bool octave_remove_atexit_function(const std::string &fname)
Definition: toplev.cc:1153
static const octave_fields bt_fields(bt_fieldnames)
#define octave_stdout
Definition: pager.h:144
#define OCTAVE_CONF_YACC
Definition: oct-conf.h:614
static octave_value_list run_command_and_return_output(const std::string &cmd_str)
Definition: toplev.cc:900
static int returning
Definition: pt-jump.h:104
#define OCTAVE_CONF_MAGICK_LDFLAGS
Definition: oct-conf.h:406
char Vfilemarker
Definition: input.cc:127
#define OCTAVE_CONF_DL_LIBS
Definition: oct-conf.h:214
static float_format native_float_format(void)
Definition: mach-info.cc:164
#define OCTAVE_CONF_CCOLAMD_LDFLAGS
Definition: oct-conf.h:109
#define OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS
Definition: oct-conf.h:426
#define OCTAVE_CONF_FLIBS
Definition: oct-conf.h:278
void remove_input_event_hook_functions(void)
Definition: input.cc:133
void free(void *)
void octave_add_atexit_function(const std::string &fname)
Definition: toplev.cc:1147
#define OCTAVE_EXEC_PREFIX
Definition: defaults.h:64
#define OCTAVE_CONF_DL_LDFLAGS
Definition: oct-conf.h:210
#define OCTAVE_CONF_FFTW3F_CPPFLAGS
Definition: oct-conf.h:266
void octave_finalize_hdf5(void)
Definition: load-save.cc:1273
#define OCTAVE_CONF_CHOLMOD_CPPFLAGS
Definition: oct-conf.h:121
#define OCTAVE_CONF_FFTW3F_LDFLAGS
Definition: oct-conf.h:270
void assign(const std::string &k, const octave_value &val)
Definition: oct-map.h:225
#define OCTAVE_CONF_GLPK_CPPFLAGS
Definition: oct-conf.h:314
#define OCTAVE_CONF_CXSPARSE_LIBS
Definition: oct-conf.h:173
#define OCTAVE_CONF_COLAMD_LIBS
Definition: oct-conf.h:141
#define OCTAVE_CONF_CHOLMOD_LDFLAGS
Definition: oct-conf.h:125
#define OCTAVE_CONF_CXSPARSE_CPPFLAGS
Definition: oct-conf.h:165
#define OCTAVE_CONF_FFTW3_LDFLAGS
Definition: oct-conf.h:258
#define OCTAVE_CONF_FFTW3F_LIBS
Definition: oct-conf.h:274
#define OCTAVE_MAN1EXT
Definition: defaults.h:144
#define OCTAVE_CONF_HDF5_CPPFLAGS
Definition: oct-conf.h:330
tree_statement_list * stmt_list
Definition: parse.h:456
#define OCTAVE_CONF_UMFPACK_LDFLAGS
Definition: oct-conf.h:578
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:197
#define OCTAVE_CONF_USE_64_BIT_IDX_T
Definition: oct-conf.h:586
std::string octave_name_version_and_copyright(void)
Definition: version.cc:69
#define OCTAVE_CONF_LD_STATIC_FLAG
Definition: oct-conf.h:362
static int exitstatus(int status)
Definition: lo-utils.h:150
#define OCTAVE_CONF_GXX_VERSION
Definition: oct-conf.h:230
#define OCTAVE_CONF_ALL_FFLAGS
Definition: oct-conf.h:36
#define OCTAVE_CONF_BLAS_LIBS
Definition: oct-conf.h:76
#define OCTAVE_CONF_QT_LDFLAGS
Definition: oct-conf.h:518
#define OCTAVE_CONF_QRUPDATE_LDFLAGS
Definition: oct-conf.h:506
#define OCTAVE_CONF_X11_INCFLAGS
Definition: oct-conf.h:598
static void do_octave_atexit(void)
Definition: toplev.cc:674
#define OCTAVE_OCTINCLUDEDIR
Definition: defaults.h:168
#define OCTAVE_LOCALAPIARCHLIBDIR
Definition: defaults.h:124
#define SHELL_PATH
Definition: toplev.cc:85
void * malloc(size_t)
static octave_map empty_backtrace(void)
Definition: toplev.cc:323
static octave_call_stack * instance
Definition: toplev.h:351
#define OCTAVE_CONF_CXXPICFLAG
Definition: oct-conf.h:185
#define OCTAVE_CONF_ENABLE_DYNAMIC_LINKING
Definition: oct-conf.h:218
#define OCTAVE_CONF_LFLAGS
Definition: oct-conf.h:374
#define OCTAVE_LIBEXECDIR
Definition: defaults.h:92
#define OCTAVE_CONF_F77_INTEGER_8_FLAG
Definition: oct-conf.h:242
#define OCTAVE_CONF_LDFLAGS
Definition: oct-conf.h:354
static void increment_current_command_number(void)
Definition: cmd-edit.cc:1182
void clear_mex_functions(void)
Definition: variables.cc:71
#define OCTAVE_CONF_EXEEXT
Definition: oct-conf.h:222
#define OCTAVE_CONF_CURL_LIBS
Definition: oct-conf.h:161
#define OCTAVE_CONF_FFTW3_CPPFLAGS
Definition: oct-conf.h:254
bool octave_completion_matches_called
Definition: input.cc:110
int do_current_line(void) const
Definition: toplev.cc:147
octave_user_code * do_caller_user_code(size_t nskip) const
Definition: toplev.cc:265
#define OCTAVE_CONF_ARPACK_CPPFLAGS
Definition: oct-conf.h:64
std::deque< stack_frame >::const_reverse_iterator const_reverse_iterator
Definition: toplev.h:124
system_exec_type
Definition: toplev.cc:952
#define OCTAVE_CONF_SED
Definition: oct-conf.h:538
bool octave_interpreter_ready
Definition: toplev.cc:100
int file_number(void) const
Definition: procstream.h:59
static void cleanup_instance(void)
Definition: toplev.h:353
static int wait_for_input(int fid)
Definition: toplev.cc:878
symbol_table::context_id m_context
Definition: toplev.h:116
#define OCTAVE_LOCALVERFCNFILEDIR
Definition: defaults.h:132
static void set_scope_and_context(scope_id scope, context_id context)
Definition: symtab.h:1192
#define OCTAVE_CONF_CXXCPP
Definition: oct-conf.h:177
#define OCTAVE_CONF_UMFPACK_LIBS
Definition: oct-conf.h:582
octave_function * m_fcn
Definition: toplev.h:112
void do_goto_base_frame(void)
Definition: toplev.cc:534
#define OCTAVE_CONF_F77
Definition: oct-conf.h:234
#define OCTAVE_CONF_FT2_LIBS
Definition: oct-conf.h:310
#define OCTAVE_CONF_CAMD_LIBS
Definition: oct-conf.h:88
#define OCTAVE_INFODIR
Definition: defaults.h:80
#define OCTAVE_CONF_DEFS
Definition: oct-conf.h:202
#define OCTAVE_CONF_CXX
Definition: oct-conf.h:189
#define OCTAVE_CONF_ARPACK_LIBS
Definition: oct-conf.h:72
#define OCTAVE_CONF_ARFLAGS
Definition: oct-conf.h:56