GNU Octave  4.2.1
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
input.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 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 // Get command input interactively or from files.
24 
25 #if defined (HAVE_CONFIG_H)
26 # include "config.h"
27 #endif
28 
29 #include <cstdio>
30 #include <cstdlib>
31 #include <cstring>
32 #include <cassert>
33 
34 #include <iostream>
35 #include <sstream>
36 #include <string>
37 
38 #include "cmd-edit.h"
39 #include "file-ops.h"
40 #include "quit.h"
41 #include "str-vec.h"
42 
43 #include "call-stack.h"
44 #include "debug.h"
45 #include "defun.h"
46 #include "dirfns.h"
47 #include "error.h"
48 #include "errwarn.h"
49 #include "help.h"
50 #include "hook-fcn.h"
51 #include "input.h"
52 #include "interpreter.h"
53 #include "lex.h"
54 #include "load-path.h"
55 #include "octave.h"
56 #include "octave-link.h"
57 #include "oct-map.h"
58 #include "oct-hist.h"
59 #include "interpreter.h"
60 #include "octave-link.h"
61 #include "ovl.h"
62 #include "ov-fcn-handle.h"
63 #include "pager.h"
64 #include "parse.h"
65 #include "pt.h"
66 #include "pt-const.h"
67 #include "pt-eval.h"
68 #include "pt-stmt.h"
69 #include "sighandlers.h"
70 #include "symtab.h"
71 #include "sysdep.h"
72 #include "interpreter.h"
73 #include "unwind-prot.h"
74 #include "utils.h"
75 #include "variables.h"
76 
77 // Primary prompt string.
79 
80 // Secondary prompt string.
82 
83 // String printed before echoed input (enabled by --echo-input).
85 
86 // Echo commands as they are executed?
87 //
88 // 1 ==> echo commands read from script files
89 // 2 ==> echo commands from functions
90 // 4 ==> echo commands read from command line
91 //
92 // more than one state can be active at once.
94 
95 // The time we last printed a prompt.
97 
98 // Character to append after successful command-line completion attempts.
99 static char Vcompletion_append_char = ' ';
100 
101 // TRUE after a call to completion_matches.
103 
104 // TRUE if the plotting system has requested a call to drawnow at
105 // the next user prompt.
106 bool Vdrawnow_requested = false;
107 
108 // TRUE if we are in debugging mode.
109 bool Vdebugging = false;
110 
111 // TRUE if we are recording line numbers in a source file.
112 // Always true except when debugging and taking input directly from
113 // the terminal.
114 bool Vtrack_line_num = true;
115 
116 // If we are in debugging mode, this is the last command entered, so
117 // that we can repeat the previous command if the user just types RET.
119 
120 // TRUE if we are running in the Emacs GUD mode.
121 static bool Vgud_mode = false;
122 
123 // The filemarker used to separate filenames from subfunction names
124 char Vfilemarker = '>';
125 
127 
128 // For octave_quit.
129 void
131 {
132  input_event_hook_functions.clear ();
133 }
134 
135 void
137 {
138  // Use literal "octave" instead of "\\s" to avoid setting the prompt
139  // to "octave.exe" or "octave-gui", etc.
140 
141  VPS1 = "octave:\\#> ";
142  VPS2 = "> ";
143  VPS4 = "+ ";
144 
146 }
147 
148 void
150 {
151  bool forced_interactive = octave::application::forced_interactive ();
152 
153  int do_echo = reading_script_file ()
154  ? (Vecho_executing_commands & ECHO_SCRIPTS)
155  : ((Vecho_executing_commands & ECHO_CMD_LINE) && ! forced_interactive);
156 
157  if (do_echo)
158  {
159  if (forced_interactive)
160  {
161  if (pflag > 0)
163  else
165  }
166  else
168 
169  if (! input_string.empty ())
170  {
171  octave_stdout << input_string;
172 
173  if (input_string[input_string.length () - 1] != '\n')
174  octave_stdout << "\n";
175  }
176  }
177 }
178 
179 static std::string
180 gnu_readline (const std::string& s, bool& eof)
181 {
182  octave_quit ();
183 
184  eof = false;
185 
187 
188  if (! eof && retval.empty ())
189  retval = "\n";
190 
191  return retval;
192 }
193 
194 static inline std::string
195 interactive_input (const std::string& s, bool& eof)
196 {
197  Vlast_prompt_time.stamp ();
198 
199  if (Vdrawnow_requested && octave::application::interactive ())
200  {
201  bool eval_error = false;
202 
203  try
204  {
205  feval ("drawnow");
206  }
207  catch (const octave::execution_exception& e)
208  {
209  eval_error = true;
210 
211  std::string stack_trace = e.info ();
212 
213  if (! stack_trace.empty ())
214  std::cerr << stack_trace;
215 
216  if (octave::application::interactive ())
218  }
219 
221 
222  // We set Vdrawnow_requested to false even if there is an error in
223  // drawnow so that the error doesn't reappear at every prompt.
224 
225  Vdrawnow_requested = false;
226 
227  if (eval_error)
228  return "\n";
229  }
230 
231  return gnu_readline (s, eof);
232 }
233 
236 {
237  octave_quit ();
238 
239  eof = false;
240 
242 
243  // Process pre input event hook function prior to flushing output and
244  // printing the prompt.
245 
246  if (octave::application::interactive ())
247  {
248  if (! Vdebugging)
250 
252 
254  }
255 
256  bool history_skip_auto_repeated_debugging_command = false;
257 
258  std::string ps = (pflag > 0) ? VPS1 : VPS2;
259 
261 
263 
265 
268 
269  octave_diary << prompt;
270 
271  retval = interactive_input (prompt, eof);
272 
273  // There is no need to update the load_path cache if there is no
274  // user input.
275  if (retval != "\n"
276  && retval.find_first_not_of (" \t\n\r") != std::string::npos)
277  {
279 
280  if (Vdebugging)
282  else
283  last_debugging_command = "\n";
284  }
285  else if (Vdebugging)
286  {
287  retval = last_debugging_command;
288  history_skip_auto_repeated_debugging_command = true;
289  }
290 
291  if (retval != "\n")
292  {
293  if (! history_skip_auto_repeated_debugging_command)
294  {
295  if (octave::command_history::add (retval))
297  }
298 
299  octave_diary << retval;
300 
301  if (retval[retval.length () - 1] != '\n')
302  octave_diary << "\n";
303 
304  do_input_echo (retval);
305  }
306  else
307  octave_diary << "\n";
308 
309  // Process post input event hook function after the internal history
310  // list has been updated.
311 
312  if (octave::application::interactive ())
314 
315  return retval;
316 }
317 
318 bool
320 {
321  return lexer ? lexer->reading_fcn_file : false;
322 }
323 
324 bool
326 {
327  return lexer ? lexer->reading_classdef_file : false;
328 }
329 
330 bool
332 {
333  return lexer ? lexer->reading_script_file : false;
334 }
335 
336 // Fix things up so that input can come from the standard input. This
337 // may need to become much more complicated, which is why it's in a
338 // separate function.
339 
340 FILE *
342 {
345 }
346 
347 // FIXME: make this generate filenames when appropriate.
348 
349 static string_vector
351  std::string& hint, bool& deemed_struct)
352 {
353  string_vector names;
354 
355  prefix = "";
356 
357  char prev_char = octave::command_editor::get_prev_char (text.length ());
358  deemed_struct = looks_like_struct (text, prev_char);
359 
360  if (deemed_struct)
361  names = generate_struct_completions (text, prefix, hint);
362  else
363  names = make_name_list ();
364 
365  // Sort and remove duplicates.
366 
367  names.sort (true);
368 
369  return names;
370 }
371 
372 static bool
374 {
375  static std::string dirfns_commands[] = {"cd", "ls"};
376  static const size_t dirfns_commands_length = 2;
377 
378  bool retval = false;
379 
381 
382  for (size_t i = 0; i < dirfns_commands_length; i++)
383  {
384  int index = line.find (dirfns_commands[i] + " ");
385 
386  if (index == 0)
387  {
388  retval = true;
389  break;
390  }
391  }
392 
393  return retval;
394 }
395 
396 static std::string
398 {
400 
401  static std::string prefix;
402  static std::string hint;
403 
404  static size_t hint_len = 0;
405 
406  static int list_index = 0;
407  static int name_list_len = 0;
408  static int name_list_total_len = 0;
409  static string_vector name_list;
410  static string_vector file_name_list;
411 
412  static int matches = 0;
413 
414  if (state == 0)
415  {
416  list_index = 0;
417 
418  prefix = "";
419 
420  hint = text;
421 
422  // No reason to display symbols while completing a
423  // file/directory operation.
424 
425  bool deemed_struct = false;
426 
427  if (is_completing_dirfns ())
428  name_list = string_vector ();
429  else
430  name_list = generate_possible_completions (text, prefix, hint,
431  deemed_struct);
432 
433  name_list_len = name_list.numel ();
434 
435  // If the line was something like "a{1}." then text = "." but
436  // we don't want to expand all the . files.
437  if (! deemed_struct)
438  {
439 
441 
442  name_list.append (file_name_list);
443 
444  }
445 
446  name_list_total_len = name_list.numel ();
447 
448  hint_len = hint.length ();
449 
450  matches = 0;
451 
452  for (int i = 0; i < name_list_len; i++)
453  if (hint == name_list[i].substr (0, hint_len))
454  matches++;
455  }
456 
457  if (name_list_total_len > 0 && matches > 0)
458  {
459  while (list_index < name_list_total_len)
460  {
461  std::string name = name_list[list_index];
462 
463  list_index++;
464 
465  if (hint == name.substr (0, hint_len))
466  {
467  // Special case: array reference forces prefix="."
468  // in generate_struct_completions ()
469  if (list_index <= name_list_len && ! prefix.empty ())
470  retval = (prefix == "." ? "" : prefix) + "." + name;
471  else
472  retval = name;
473 
475  (text.length ());
476  if (matches == 1 && looks_like_struct (retval, prev_char))
477  {
478  // Don't append anything, since we don't know
479  // whether it should be '(' or '.'.
480 
482  }
483  else
486 
487  break;
488  }
489  }
490  }
491 
492  return retval;
493 }
494 
495 static std::string
496 quoting_filename (const std::string &text, int, char quote)
497 {
498  if (quote)
499  return text;
500  else
501  return (std::string ("'") + text);
502 }
503 
504 // Try to parse a partial command line in reverse, excluding trailing TEXT.
505 // If it appears a variable has been indexed by () or {},
506 // return that expression,
507 // to allow autocomplete of field names of arrays of structures.
510 {
512 
513  int pos = line.length () - text.length ();
514  int curly_count = 0;
515  int paren_count = 0;
516 
517  int last = --pos;
518 
519  while (pos >= 0 && (line[pos] == ')' || line[pos] == '}'))
520  {
521  if (line[pos] == ')')
522  paren_count++;
523  else if (line[pos] == '}')
524  curly_count++;
525 
526  while (curly_count + paren_count > 0 && --pos >= 0)
527  {
528  if (line[pos] == ')')
529  paren_count++;
530  else if (line[pos] == '(')
531  paren_count--;
532  else if (line[pos] == '}')
533  curly_count++;
534  else if (line[pos] == '{')
535  curly_count--;
536  }
537 
538  while (--pos >= 0 && line[pos] == ' ')
539  ;
540  }
541 
542  while (pos >= 0 && (isalnum (line[pos]) || line[pos] == '_'))
543  pos--;
544 
545  if (++pos >= 0)
546  return (line.substr (pos, last + 1 - pos));
547  else
548  return std::string ();
549 }
550 
551 void
553 {
554  // If we are using readline, this allows conditional parsing of the
555  // .inputrc file.
556 
558 
559  // FIXME: this needs to include a comma too, but that
560  // causes trouble for the new struct element completion code.
561 
562  static const char *s = "\t\n !\"\'*+-/:;<=>(){}[\\]^`~";
563 
565 
567 
569 
570  octave::command_editor::set_filename_quote_characters (" \t\n\\\"'@<>=;|&()#$`?*[!:{");
572 
574 
576 }
577 
578 static void
579 execute_in_debugger_handler (const std::pair<std::string, int>& arg)
580 {
581  octave_link::execute_in_debugger_event (arg.first, arg.second);
582 }
583 
584 static void
586 {
588 
591 
593  std::string nm;
594  int curr_debug_line;
595 
596  bool have_file = false;
597 
598  if (caller)
599  {
600  nm = caller->fcn_file_name ();
601 
602  if (nm.empty ())
603  nm = caller->name ();
604  else
605  have_file = true;
606 
607  curr_debug_line = octave_call_stack::caller_user_code_line ();
608  }
609  else
610  curr_debug_line = octave_call_stack::current_line ();
611 
612  std::ostringstream buf;
613 
614  if (! nm.empty ())
615  {
616  if (Vgud_mode)
617  {
618  static char ctrl_z = 'Z' & 0x1f;
619 
620  buf << ctrl_z << ctrl_z << nm << ":" << curr_debug_line;
621  }
622  else
623  {
624  // FIXME: we should come up with a clean way to detect
625  // that we are stopped on the no-op command that marks the
626  // end of a function or script.
627 
628  if (! silent)
629  {
630  buf << "stopped in " << nm;
631 
632  if (curr_debug_line > 0)
633  buf << " at line " << curr_debug_line;
634  }
635 
636  if (have_file)
637  {
638  octave_link::enter_debugger_event (nm, curr_debug_line);
639 
641 
643  std::pair<std::string, int> (nm, curr_debug_line));
644 
645  if (! silent)
646  {
647  std::string line_buf
648  = get_file_line (nm, curr_debug_line);
649 
650  if (! line_buf.empty ())
651  buf << "\n" << curr_debug_line << ": " << line_buf;
652  }
653  }
654  }
655  }
656 
657  if (silent)
659 
660  std::string msg = buf.str ();
661 
662  if (! msg.empty ())
663  std::cerr << msg << std::endl;
664 
665  frame.protect_var (VPS1);
666  VPS1 = prompt;
667 
668  octave::application *app = octave::application::app ();
669 
670  if (! app->interactive ())
671  {
672 
673  frame.add_method (app, &octave::application::interactive,
674  app->interactive ());
675 
676  frame.add_method (app, &octave::application::forced_interactive,
677  app->forced_interactive ());
678 
679  app->interactive (true);
680 
681  app->forced_interactive (true);
682  }
683 
684  octave::parser curr_parser;
685 
686  while (Vdebugging)
687  {
688  try
689  {
690  Vtrack_line_num = false;
691 
693 
694  curr_parser.reset ();
695 
696  int retval = curr_parser.run ();
697 
699  break;
700  else
701  {
702  if (retval == 0 && curr_parser.stmt_list)
703  {
705 
706  if (octave_completion_matches_called)
707  octave_completion_matches_called = false;
708  }
709 
710  octave_quit ();
711  }
712  }
713  catch (const octave::execution_exception& e)
714  {
715  std::string stack_trace = e.info ();
716 
717  if (! stack_trace.empty ())
718  std::cerr << stack_trace;
719 
720  // Ignore errors when in debugging mode;
722  }
723  }
724 }
725 
726 const std::string octave_base_reader::in_src ("invalid");
727 
729 
732 {
733  octave_quit ();
734 
735  eof = false;
736 
737  return octave_gets (eof);
738 }
739 
741 
744 {
745  octave_quit ();
746 
747  eof = false;
748 
749  return octave_fgets (file, eof);
750 }
751 
752 const std::string octave_eval_string_reader::in_src ("eval_string");
753 
756 {
757  octave_quit ();
758 
759  eof = false;
760 
762 
763  retval = eval_string;
764 
765  // Clear the eval string so that the next call will return
766  // an empty character string with EOF = true.
767  eval_string = "";
768 
769  if (retval.empty ())
770  eof = true;
771 
772  return retval;
773 }
774 
775 // If the user simply hits return, this will produce an empty matrix.
776 
777 static octave_value_list
779 {
781 
782  int read_as_string = 0;
783 
784  if (args.length () == 2)
785  read_as_string++;
786 
787  std::string prompt = args(0).xstring_value ("input: unrecognized argument");
788 
790 
793 
794  octave_diary << prompt;
795 
796  bool eof = false;
797 
798  std::string input_buf = interactive_input (prompt.c_str (), eof);
799 
800  if (input_buf.empty ())
801  error ("input: reading user-input failed!");
802 
803  size_t len = input_buf.length ();
804 
805  octave_diary << input_buf;
806 
807  if (input_buf[len - 1] != '\n')
808  octave_diary << "\n";
809 
810  if (len < 1)
811  return read_as_string ? octave_value ("") : octave_value (Matrix ());
812 
813  if (read_as_string)
814  {
815  // FIXME: fix gnu_readline and octave_gets instead!
816  if (input_buf.length () == 1 && input_buf[0] == '\n')
817  retval(0) = "";
818  else
819  retval(0) = input_buf;
820  }
821  else
822  {
823  int parse_status = 0;
824 
825  retval = eval_string (input_buf, true, parse_status, nargout);
826 
827  if (! Vdebugging && retval.empty ())
828  retval(0) = Matrix ();
829  }
830 
831  return retval;
832 }
833 
835  doc: /* -*- texinfo -*-
836 @deftypefn {} {@var{ans} =} input (@var{prompt})
837 @deftypefnx {} {@var{ans} =} input (@var{prompt}, "s")
838 Print @var{prompt} and wait for user input.
839 
840 For example,
841 
842 @example
843 input ("Pick a number, any number! ")
844 @end example
845 
846 @noindent
847 prints the prompt
848 
849 @example
850 Pick a number, any number!
851 @end example
852 
853 @noindent
854 and waits for the user to enter a value. The string entered by the user
855 is evaluated as an expression, so it may be a literal constant, a variable
856 name, or any other valid Octave code.
857 
858 The number of return arguments, their size, and their class depend on the
859 expression entered.
860 
861 If you are only interested in getting a literal string value, you can call
862 @code{input} with the character string @qcode{"s"} as the second argument.
863 This tells Octave to return the string entered by the user directly, without
864 evaluating it first.
865 
866 Because there may be output waiting to be displayed by the pager, it is a
867 good idea to always call @code{fflush (stdout)} before calling @code{input}.
868  This will ensure that all pending output is written to the screen before
869 your prompt.
870 @seealso{yes_or_no, kbhit, pause, menu, listdlg}
871 @end deftypefn */)
872 {
873  int nargin = args.length ();
874 
875  if (nargin < 1 || nargin > 2)
876  print_usage ();
877 
878  return get_user_input (args, std::max (nargout, 1));
879 }
880 
881 bool
882 octave_yes_or_no (const std::string& prompt)
883 {
884  std::string prompt_string = prompt + "(yes or no) ";
885 
886  while (1)
887  {
888  bool eof = false;
889 
890  std::string input_buf = interactive_input (prompt_string, eof);
891 
892  if (input_buf == "yes")
893  return true;
894  else if (input_buf == "no")
895  return false;
896  else
897  message (0, "Please answer yes or no.");
898  }
899 }
900 
901 DEFUN (yes_or_no, args, ,
902  doc: /* -*- texinfo -*-
903 @deftypefn {} {@var{ans} =} yes_or_no ("@var{prompt}")
904 Ask the user a yes-or-no question.
905 
906 Return logical true if the answer is yes or false if the answer is no.
907 
908 Takes one argument, @var{prompt}, which is the string to display when asking
909 the question. @var{prompt} should end in a space; @code{yes-or-no} adds the
910 string @samp{(yes or no) } to it. The user must confirm the answer with
911 @key{RET} and can edit it until it has been confirmed.
912 @seealso{input}
913 @end deftypefn */)
914 {
915  int nargin = args.length ();
916 
917  if (nargin > 1)
918  print_usage ();
919 
920  std::string prompt;
921 
922  if (nargin == 1)
923  prompt = args(0).xstring_value ("yes_or_no: PROMPT must be a string");
924 
925  return ovl (octave_yes_or_no (prompt));
926 }
927 
930 {
932 
933  int nargin = args.length ();
934 
935  assert (nargin == 0 || nargin == 1);
936 
938 
941 
943 
944  frame.protect_var (Vdebugging);
945 
948 
949  // FIXME: probably we just want to print one line, not the
950  // entire statement, which might span many lines...
951  //
952  // tree_print_code tpc (octave_stdout);
953  // stmt.accept (tpc);
954 
955  Vdebugging = true;
956  Vtrack_line_num = false;
957 
958  std::string prompt = "debug> ";
959  if (nargin > 0)
960  prompt = args(0).string_value ();
961 
962  get_debug_input (prompt);
963 
964  return retval;
965 }
966 
967 DEFUN (keyboard, args, ,
968  doc: /* -*- texinfo -*-
969 @deftypefn {} {} keyboard ()
970 @deftypefnx {} {} keyboard ("@var{prompt}")
971 Stop m-file execution and enter debug mode.
972 
973 When the @code{keyboard} function is executed, Octave prints a prompt and
974 waits for user input. The input strings are then evaluated and the results
975 are printed. This makes it possible to examine the values of variables
976 within a function, and to assign new values if necessary. To leave the
977 prompt and return to normal execution type @samp{return} or @samp{dbcont}.
978 The @code{keyboard} function does not return an exit status.
979 
980 If @code{keyboard} is invoked without arguments, a default prompt of
981 @samp{debug> } is used.
982 @seealso{dbstop, dbcont, dbquit}
983 @end deftypefn */)
984 {
985  if (args.length () > 1)
986  print_usage ();
987 
989 
992 
993  // Skip the frame assigned to the keyboard function.
995 
998 
1000 
1001  do_keyboard (args);
1002 
1003  return ovl ();
1004 }
1005 
1006 DEFUN (echo, args, ,
1007  doc: /* -*- texinfo -*-
1008 @deftypefn {} {} echo
1009 @deftypefnx {} {} echo on
1010 @deftypefnx {} {} echo off
1011 @deftypefnx {} {} echo on all
1012 @deftypefnx {} {} echo off all
1013 Control whether commands are displayed as they are executed.
1014 
1015 Valid options are:
1016 
1017 @table @code
1018 @item on
1019 Enable echoing of commands as they are executed in script files.
1020 
1021 @item off
1022 Disable echoing of commands as they are executed in script files.
1023 
1024 @item on all
1025 Enable echoing of commands as they are executed in script files and
1026 functions.
1027 
1028 @item off all
1029 Disable echoing of commands as they are executed in script files and
1030 functions.
1031 @end table
1032 
1033 @noindent
1034 With no arguments, @code{echo} toggles the current echo state.
1035 
1036 @seealso{echo_executing_commands}
1037 @end deftypefn */)
1038 {
1039  string_vector argv = args.make_argv ();
1040 
1041  switch (args.length ())
1042  {
1043  case 0:
1044  {
1045  if ((Vecho_executing_commands & ECHO_SCRIPTS)
1046  || (Vecho_executing_commands & ECHO_FUNCTIONS))
1047  Vecho_executing_commands = ECHO_OFF;
1048  else
1049  Vecho_executing_commands = ECHO_SCRIPTS;
1050  }
1051  break;
1052 
1053  case 1:
1054  {
1055  std::string arg = argv[0];
1056 
1057  if (arg == "on")
1058  Vecho_executing_commands = ECHO_SCRIPTS;
1059  else if (arg == "off")
1060  Vecho_executing_commands = ECHO_OFF;
1061  else
1062  print_usage ();
1063  }
1064  break;
1065 
1066  case 2:
1067  {
1068  std::string arg = argv[0];
1069 
1070  if (arg == "on" && argv[1] == "all")
1071  {
1072  int tmp = (ECHO_SCRIPTS | ECHO_FUNCTIONS);
1073  Vecho_executing_commands = tmp;
1074  }
1075  else if (arg == "off" && argv[1] == "all")
1076  Vecho_executing_commands = ECHO_OFF;
1077  else
1078  print_usage ();
1079  }
1080  break;
1081 
1082  default:
1083  print_usage ();
1084  break;
1085  }
1086 
1087  return ovl ();
1088 }
1089 
1090 /*
1091 %!test
1092 %! state = echo_executing_commands ();
1093 %! unwind_protect
1094 %! echo ();
1095 %! s1 = echo_executing_commands ();
1096 %! assert (s1 != state);
1097 %! echo ();
1098 %! s2 = echo_executing_commands ();
1099 %! assert (s2 != s1);
1100 %! unwind_protect_cleanup
1101 %! echo_executing_commands (state);
1102 %! end_unwind_protect
1103 
1104 %!test
1105 %! state = echo_executing_commands ();
1106 %! unwind_protect
1107 %! echo ("off");
1108 %! assert (echo_executing_commands () == 0);
1109 %! echo ("on");
1110 %! assert (echo_executing_commands () != 0);
1111 %! echo ("off");
1112 %! assert (echo_executing_commands () == 0);
1113 %! unwind_protect_cleanup
1114 %! echo_executing_commands (state);
1115 %! end_unwind_protect
1116 
1117 %!#test # FIXME: This passes, but produces a lot of onscreen output
1118 %! state = echo_executing_commands ();
1119 %! unwind_protect
1120 %! echo ("on", "all");
1121 %! assert (echo_executing_commands () != 0);
1122 %! echo ("off", "all");
1123 %! assert (echo_executing_commands () == 0);
1124 %! unwind_protect_cleanup
1125 %! echo_executing_commands (state);
1126 %! end_unwind_protect
1127 
1128 %!error echo ([])
1129 %!error echo (0)
1130 %!error echo ("")
1131 %!error echo ("Octave")
1132 %!error echo ("off", "invalid")
1133 %!error echo ("on", "invalid")
1134 %!error echo ("on", "all", "all")
1135 */
1136 
1137 DEFUN (__echostate__, , ,
1138  doc: /* -*- texinfo -*-
1139 @deftypefn {} {@var{state} =} __echostate__ ()
1140 Undocumented internal function
1141 @end deftypefn */)
1142 {
1143  return ovl (Vecho_executing_commands == ECHO_SCRIPTS);
1144 }
1145 
1146 DEFUN (completion_matches, args, nargout,
1147  doc: /* -*- texinfo -*-
1148 @deftypefn {} {} completion_matches (@var{hint})
1149 Generate possible completions given @var{hint}.
1150 
1151 This function is provided for the benefit of programs like Emacs which
1152 might be controlling Octave and handling user input. The current
1153 command number is not incremented when this function is called. This is
1154 a feature, not a bug.
1155 @end deftypefn */)
1156 {
1157  if (args.length () != 1)
1158  print_usage ();
1159 
1161 
1162  std::string hint = args(0).string_value ();
1163 
1164  int n = 32;
1165 
1166  string_vector list (n);
1167 
1168  int k = 0;
1169 
1170  for (;;)
1171  {
1172  std::string cmd = generate_completion (hint, k);
1173 
1174  if (! cmd.empty ())
1175  {
1176  if (k == n)
1177  {
1178  n *= 2;
1179  list.resize (n);
1180  }
1181 
1182  list[k++] = cmd;
1183  }
1184  else
1185  {
1186  list.resize (k);
1187  break;
1188  }
1189  }
1190 
1191  if (nargout > 0)
1192  {
1193  if (! list.empty ())
1194  retval = list;
1195  else
1196  retval = "";
1197  }
1198  else
1199  {
1200  // We don't use string_vector::list_in_columns here
1201  // because it will be easier for Emacs if the names
1202  // appear in a single column.
1203 
1204  int len = list.numel ();
1205 
1206  for (int i = 0; i < len; i++)
1207  octave_stdout << list[i] << "\n";
1208  }
1209 
1210  octave_completion_matches_called = true;
1211 
1212  return retval;
1213 }
1214 
1215 /*
1216 %!assert (ischar (completion_matches ("")))
1217 %!assert (ischar (completion_matches ("a")))
1218 %!assert (ischar (completion_matches (" ")))
1219 %!assert (isempty (completion_matches (" ")))
1220 %!assert (any (strcmp ("abs", deblank (cellstr (completion_matches (""))))))
1221 %!assert (any (strcmp ("abs", deblank (cellstr (completion_matches ("a"))))))
1222 %!assert (any (strcmp ("abs", deblank (cellstr (completion_matches ("ab"))))))
1223 %!assert (any (strcmp ("abs", deblank (cellstr (completion_matches ("abs"))))))
1224 %!assert (! any (strcmp ("abs", deblank (cellstr (completion_matches ("absa"))))))
1225 
1226 %!error completion_matches ()
1227 %!error completion_matches (1, 2)
1228 */
1229 
1230 DEFUN (readline_read_init_file, args, ,
1231  doc: /* -*- texinfo -*-
1232 @deftypefn {} {} readline_read_init_file (@var{file})
1233 Read the readline library initialization file @var{file}.
1234 
1235 If @var{file} is omitted, read the default initialization file
1236 (normally @file{~/.inputrc}).
1237 
1238 @xref{Readline Init File, , , readline, GNU Readline Library},
1239 for details.
1240 @seealso{readline_re_read_init_file}
1241 @end deftypefn */)
1242 {
1243  int nargin = args.length ();
1244 
1245  if (nargin > 1)
1246  print_usage ();
1247 
1248  if (nargin == 0)
1250  else
1251  {
1252  std::string file = args(0).string_value ();
1253 
1255  }
1256 
1257  return ovl ();
1258 }
1259 
1260 DEFUN (readline_re_read_init_file, args, ,
1261  doc: /* -*- texinfo -*-
1262 @deftypefn {} {} readline_re_read_init_file ()
1263 Re-read the last readline library initialization file that was read.
1264 
1265 @xref{Readline Init File, , , readline, GNU Readline Library},
1266 for details.
1267 @seealso{readline_read_init_file}
1268 @end deftypefn */)
1269 {
1270  if (args.length () != 0)
1271  print_usage ();
1272 
1274 
1275  return ovl ();
1276 }
1277 
1278 static int
1279 internal_input_event_hook_fcn (void)
1280 {
1281  input_event_hook_functions.run ();
1282 
1283  if (input_event_hook_functions.empty ())
1284  octave::command_editor::remove_event_hook (internal_input_event_hook_fcn);
1285 
1286  return 0;
1287 }
1288 
1289 DEFUN (add_input_event_hook, args, ,
1290  doc: /* -*- texinfo -*-
1291 @deftypefn {} {@var{id} =} add_input_event_hook (@var{fcn})
1292 @deftypefnx {} {@var{id} =} add_input_event_hook (@var{fcn}, @var{data})
1293 Add the named function or function handle @var{fcn} to the list of functions
1294 to call periodically when Octave is waiting for input.
1295 
1296 The function should have the form
1297 
1298 @example
1299 @var{fcn} (@var{data})
1300 @end example
1301 
1302 If @var{data} is omitted, Octave calls the function without any arguments.
1303 
1304 The returned identifier may be used to remove the function handle from the
1305 list of input hook functions.
1306 @seealso{remove_input_event_hook}
1307 @end deftypefn */)
1308 {
1309  int nargin = args.length ();
1310 
1311  if (nargin < 1 || nargin > 2)
1312  print_usage ();
1313 
1314  octave_value user_data;
1315 
1316  if (nargin == 2)
1317  user_data = args(1);
1318 
1319  hook_function hook_fcn (args(0), user_data);
1320 
1321  if (input_event_hook_functions.empty ())
1322  octave::command_editor::add_event_hook (internal_input_event_hook_fcn);
1323 
1324  input_event_hook_functions.insert (hook_fcn.id (), hook_fcn);
1325 
1326  return ovl (hook_fcn.id ());
1327 }
1328 
1329 DEFUN (remove_input_event_hook, args, ,
1330  doc: /* -*- texinfo -*-
1331 @deftypefn {} {} remove_input_event_hook (@var{name})
1332 @deftypefnx {} {} remove_input_event_hook (@var{fcn_id})
1333 Remove the named function or function handle with the given identifier
1334 from the list of functions to call periodically when Octave is waiting
1335 for input.
1336 @seealso{add_input_event_hook}
1337 @end deftypefn */)
1338 {
1339  int nargin = args.length ();
1340 
1341  if (nargin < 1 || nargin > 2)
1342  print_usage ();
1343 
1344  std::string hook_fcn_id = args(0).string_value ("remove_input_event_hook: argument not valid as a hook function name or id");
1345 
1346  bool warn = (nargin < 2);
1347 
1349  = input_event_hook_functions.find (hook_fcn_id);
1350 
1351  if (p != input_event_hook_functions.end ())
1352  input_event_hook_functions.erase (p);
1353  else if (warn)
1354  warning ("remove_input_event_hook: %s not found in list",
1355  hook_fcn_id.c_str ());
1356 
1357  if (input_event_hook_functions.empty ())
1358  octave::command_editor::remove_event_hook (internal_input_event_hook_fcn);
1359 
1360  return ovl ();
1361 }
1362 
1363 DEFUN (PS1, args, nargout,
1364  doc: /* -*- texinfo -*-
1365 @deftypefn {} {@var{val} =} PS1 ()
1366 @deftypefnx {} {@var{old_val} =} PS1 (@var{new_val})
1367 @deftypefnx {} {} PS1 (@var{new_val}, "local")
1368 Query or set the primary prompt string.
1369 
1370 When executing interactively, Octave displays the primary prompt when it is
1371 ready to read a command.
1372 
1373 The default value of the primary prompt string is @qcode{"octave:\#> "}.
1374 To change it, use a command like
1375 
1376 @example
1377 PS1 ("\\u@@\\H> ")
1378 @end example
1379 
1380 @noindent
1381 which will result in the prompt @samp{boris@@kremvax> } for the user
1382 @samp{boris} logged in on the host @samp{kremvax.kgb.su}. Note that two
1383 backslashes are required to enter a backslash into a double-quoted
1384 character string. @xref{Strings}.
1385 
1386 You can also use ANSI escape sequences if your terminal supports them.
1387 This can be useful for coloring the prompt. For example,
1388 
1389 @example
1390 PS1 ('\[\033[01;31m\]\s:\#> \[\033[0m\]')
1391 @end example
1392 
1393 @noindent
1394 will give the default Octave prompt a red coloring.
1395 
1396 When called from inside a function with the @qcode{"local"} option, the
1397 variable is changed locally for the function and any subroutines it calls.
1398 The original variable value is restored when exiting the function.
1399 @seealso{PS2, PS4}
1400 @end deftypefn */)
1401 {
1402  return SET_INTERNAL_VARIABLE (PS1);
1403 }
1404 
1405 DEFUN (PS2, args, nargout,
1406  doc: /* -*- texinfo -*-
1407 @deftypefn {} {@var{val} =} PS2 ()
1408 @deftypefnx {} {@var{old_val} =} PS2 (@var{new_val})
1409 @deftypefnx {} {} PS2 (@var{new_val}, "local")
1410 Query or set the secondary prompt string.
1411 
1412 The secondary prompt is printed when Octave is expecting additional input to
1413 complete a command. For example, if you are typing a @code{for} loop that
1414 spans several lines, Octave will print the secondary prompt at the beginning
1415 of each line after the first. The default value of the secondary prompt
1416 string is @qcode{"> "}.
1417 
1418 When called from inside a function with the @qcode{"local"} option, the
1419 variable is changed locally for the function and any subroutines it calls.
1420 The original variable value is restored when exiting the function.
1421 @seealso{PS1, PS4}
1422 @end deftypefn */)
1423 {
1424  return SET_INTERNAL_VARIABLE (PS2);
1425 }
1426 
1427 DEFUN (PS4, args, nargout,
1428  doc: /* -*- texinfo -*-
1429 @deftypefn {} {@var{val} =} PS4 ()
1430 @deftypefnx {} {@var{old_val} =} PS4 (@var{new_val})
1431 @deftypefnx {} {} PS4 (@var{new_val}, "local")
1432 Query or set the character string used to prefix output produced
1433 when echoing commands is enabled.
1434 
1435 The default value is @qcode{"+ "}.
1436 @xref{Diary and Echo Commands}, for a description of echoing commands.
1437 
1438 When called from inside a function with the @qcode{"local"} option, the
1439 variable is changed locally for the function and any subroutines it calls.
1440 The original variable value is restored when exiting the function.
1441 @seealso{echo, echo_executing_commands, PS1, PS2}
1442 @end deftypefn */)
1443 {
1444  return SET_INTERNAL_VARIABLE (PS4);
1445 }
1446 
1447 DEFUN (completion_append_char, args, nargout,
1448  doc: /* -*- texinfo -*-
1449 @deftypefn {} {@var{val} =} completion_append_char ()
1450 @deftypefnx {} {@var{old_val} =} completion_append_char (@var{new_val})
1451 @deftypefnx {} {} completion_append_char (@var{new_val}, "local")
1452 Query or set the internal character variable that is appended to
1453 successful command-line completion attempts.
1454 
1455 The default value is @qcode{" "} (a single space).
1456 
1457 When called from inside a function with the @qcode{"local"} option, the
1458 variable is changed locally for the function and any subroutines it calls.
1459 The original variable value is restored when exiting the function.
1460 @end deftypefn */)
1461 {
1462  return SET_INTERNAL_VARIABLE (completion_append_char);
1463 }
1464 
1465 DEFUN (echo_executing_commands, args, nargout,
1466  doc: /* -*- texinfo -*-
1467 @deftypefn {} {@var{val} =} echo_executing_commands ()
1468 @deftypefnx {} {@var{old_val} =} echo_executing_commands (@var{new_val})
1469 @deftypefnx {} {} echo_executing_commands (@var{new_val}, "local")
1470 Query or set the internal variable that controls the echo state.
1471 
1472 It may be the sum of the following values:
1473 
1474 @table @asis
1475 @item 1
1476 Echo commands read from script files.
1477 
1478 @item 2
1479 Echo commands from functions.
1480 
1481 @item 4
1482 Echo commands read from command line.
1483 @end table
1484 
1485 More than one state can be active at once. For example, a value of 3 is
1486 equivalent to the command @kbd{echo on all}.
1487 
1488 The value of @code{echo_executing_commands} may be set by the @kbd{echo}
1489 command or the command line option @option{--echo-commands}.
1490 
1491 When called from inside a function with the @qcode{"local"} option, the
1492 variable is changed locally for the function and any subroutines it calls.
1493 The original variable value is restored when exiting the function.
1494 
1495 @seealso{echo}
1496 @end deftypefn */)
1497 {
1498  return SET_INTERNAL_VARIABLE (echo_executing_commands);
1499 }
1500 
1501 DEFUN (__request_drawnow__, args, ,
1502  doc: /* -*- texinfo -*-
1503 @deftypefn {} {} __request_drawnow__ ()
1504 @deftypefnx {} {} __request_drawnow__ (@var{flag})
1505 Undocumented internal function.
1506 @end deftypefn */)
1507 {
1508  int nargin = args.length ();
1509 
1510  if (nargin > 1)
1511  print_usage ();
1512 
1513  if (nargin == 0)
1514  Vdrawnow_requested = true;
1515  else
1516  Vdrawnow_requested = args(0).bool_value ();
1517 
1518  return ovl ();
1519 }
1520 
1521 DEFUN (__gud_mode__, args, ,
1522  doc: /* -*- texinfo -*-
1523 @deftypefn {} {} __gud_mode__ ()
1524 Undocumented internal function.
1525 @end deftypefn */)
1526 {
1527  int nargin = args.length ();
1528 
1529  if (nargin > 1)
1530  print_usage ();
1531 
1533 
1534  if (nargin == 0)
1535  retval = ovl (Vgud_mode);
1536  else
1537  Vgud_mode = args(0).bool_value ();
1538 
1539  return retval;
1540 }
1541 
1542 DEFUN (filemarker, args, nargout,
1543  doc: /* -*- texinfo -*-
1544 @deftypefn {} {@var{val} =} filemarker ()
1545 @deftypefnx {} {@var{old_val} =} filemarker (@var{new_val})
1546 @deftypefnx {} {} filemarker (@var{new_val}, "local")
1547 Query or set the character used to separate the filename from the
1548 subfunction names contained within the file.
1549 
1550 By default this is the character @samp{>}.
1551 This can be used in a generic manner to interact with subfunctions.
1552 For example,
1553 
1554 @example
1555 help (["myfunc", filemarker, "mysubfunc"])
1556 @end example
1557 
1558 @noindent
1559 returns the help string associated with the subfunction @code{mysubfunc}
1560 located in the file @file{myfunc.m}.
1561 
1562 @code{filemarker} is also useful during debugging for placing breakpoints
1563 within subfunctions or nested functions.
1564 For example,
1565 
1566 @example
1567 dbstop (["myfunc", filemarker, "mysubfunc"])
1568 @end example
1569 
1570 @noindent
1571 will set a breakpoint at the first line of the subfunction @code{mysubfunc}.
1572 
1573 When called from inside a function with the @qcode{"local"} option, the
1574 variable is changed locally for the function and any subroutines it calls.
1575 The original variable value is restored when exiting the function.
1576 @end deftypefn */)
1577 {
1578  char tmp = Vfilemarker;
1579  octave_value retval = SET_INTERNAL_VARIABLE (filemarker);
1580 
1581  // The character passed must not be a legal character for a function name
1582  if (::isalnum (Vfilemarker) || Vfilemarker == '_')
1583  {
1584  Vfilemarker = tmp;
1585  error ("filemarker: character can not be a valid character for a function name");
1586  }
1587 
1588  return retval;
1589 }
static bool is_completing_dirfns(void)
Definition: input.cc:373
static hook_function_list input_event_hook_functions
Definition: input.cc:126
static std::string last_debugging_command
Definition: input.cc:118
void flush_octave_stdout(void)
Definition: pager.cc:454
static void restore_frame(size_t n)
Definition: call-stack.h:253
static void set_completion_function(completion_fcn f)
Definition: cmd-edit.cc:1348
static std::string generate_completion(const std::string &text, int state)
Definition: input.cc:397
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:120
static const std::string in_src
Definition: input.h:190
Definition: input.h:79
virtual bool reading_fcn_file(void) const
Definition: input.cc:319
static std::string decode_prompt_string(const std::string &s)
Definition: cmd-edit.cc:1258
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
Definition: oct-hist.cc:728
static void reset(void)
Definition: pager.cc:344
static std::string quoting_filename(const std::string &text, int, char quote)
Definition: input.cc:496
std::string octave_fgets(FILE *f)
Definition: lo-utils.cc:114
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
Definition: defun.cc:52
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:363
static void set_filename_quote_characters(const std::string &s)
Definition: cmd-edit.cc:1327
static octave_value_list get_user_input(const octave_value_list &args, int nargout)
Definition: input.cc:778
static void set_input_stream(FILE *f)
Definition: cmd-edit.cc:1188
FILE * get_input_from_stdin(void)
Definition: input.cc:341
octave_idx_type length(void) const
Definition: ovl.h:96
void accept(tree_walker &tw)
Definition: pt-stmt.cc:324
for large enough k
Definition: lu.cc:606
bool looks_like_struct(const std::string &text, char prev_char)
Definition: variables.cc:305
std::string octave_gets(bool &eof)
Definition: input.cc:235
void protect_var(T &var)
#define DEFUN(name, args_name, nargout_name, doc)
Definition: defun.h:46
void error(const char *fmt,...)
Definition: error.cc:570
std::string name(void) const
Definition: ov-fcn.h:163
#define SET_INTERNAL_VARIABLE(NM)
Definition: variables.h:126
static void ignore_entries(bool=true)
Definition: cmd-hist.cc:593
static bool Vgud_mode
Definition: input.cc:121
octave::sys::time Vlast_prompt_time
Definition: input.cc:96
static std::string get_line_buffer(void)
Definition: cmd-edit.cc:1425
#define octave_diary
Definition: pager.h:148
static bool add(const std::string &)
Definition: cmd-hist.cc:607
std::string eval_string
Definition: input.h:211
iterator find(const std::string &id)
Definition: hook-fcn.h:225
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup calculate Y_a and Y _d item Given calculate Y nd enumerate In either initial values for the given components are input
Definition: DASPK-opts.cc:739
s
Definition: file-io.cc:2682
bool reading_script_file
Definition: lex.h:377
void add_method(T *obj, void(T::*method)(void))
i e
Definition: data.cc:2724
static bool quiet_breakpoint_flag
Definition: pt-eval.h:162
octave_value arg
Definition: pr-output.cc:3440
string_vector argv
Definition: load-save.cc:635
JNIEnv void * args
Definition: ov-java.cc:67
static void re_read_init_file(void)
Definition: cmd-edit.cc:1592
tree_evaluator * current_evaluator
static const std::string in_src
Definition: input.h:169
void do_input_echo(const std::string &) const
Definition: input.cc:149
static void get_debug_input(const std::string &prompt)
Definition: input.cc:585
void insert(const std::string &id, const hook_function &f)
Definition: hook-fcn.h:220
void message(const char *name, const char *fmt,...)
Definition: error.cc:430
static int current_line(void)
Definition: call-stack.h:114
static octave_user_code * caller_user_code(size_t nskip=0)
Definition: call-stack.h:172
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:941
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
void add_fcn(void(*fcn)(void))
static size_t current_frame(void)
Definition: call-stack.h:131
static string_vector generate_filename_completions(const std::string &text)
Definition: cmd-edit.cc:1418
void erase(iterator p)
Definition: hook-fcn.h:239
bool Vdrawnow_requested
Definition: input.cc:106
string_vector make_argv(const std::string &="") const
Definition: ovl.cc:214
int pipe_handler_error_count
Definition: sighandlers.cc:64
static bool erase_empty_line(bool flag)
Definition: cmd-edit.cc:1300
static void set_completer_quote_characters(const std::string &s)
Definition: cmd-edit.cc:1334
void initialize_command_input(void)
Definition: input.cc:552
bool Vtrack_line_num
Definition: input.cc:114
static char get_prev_char(int)
Definition: cmd-edit.cc:1439
static size_t current_frame
Definition: pt-eval.h:158
std::string get_input(bool &eof)
Definition: input.cc:755
static std::string gnu_readline(const std::string &s, bool &eof)
Definition: input.cc:180
int nargin
Definition: graphics.cc:10115
std::string get_input(bool &eof)
Definition: input.cc:731
static std::string VPS2
Definition: input.cc:81
static void reset(void)
Definition: pager.cc:419
string_vector generate_struct_completions(const std::string &text, std::string &prefix, std::string &hint)
Definition: variables.cc:236
static void remove_event_hook(event_hook_fcn f)
Definition: cmd-edit.cc:1558
string_vector & append(const std::string &s)
Definition: str-vec.cc:107
static OCTAVE_NORETURN void eval_error(const char *msg, const dim_vector &x, const dim_vector &y)
Definition: pt-mat.cc:279
double tmp
Definition: data.cc:6300
std::string get_input(bool &eof)
Definition: input.cc:743
static std::string interactive_input(const std::string &s, bool &eof)
Definition: input.cc:195
octave_value retval
Definition: data.cc:6294
static std::string VPS1
Definition: input.cc:78
void reset_error_handler(void)
Definition: error.cc:124
string_vector & sort(bool make_uniq=false)
Definition: str-vec.cc:74
static void set_completer_word_break_characters(const std::string &s)
Definition: cmd-edit.cc:1313
Definition: dMatrix.h:37
static FILE * get_input_stream(void)
Definition: cmd-edit.cc:1195
iterator end(void)
Definition: hook-fcn.h:235
static bool debug_mode
Definition: pt-eval.h:160
static bool interrupt(bool=true)
Definition: cmd-edit.cc:1620
virtual bool reading_script_file(void) const
Definition: input.cc:331
feval(ar{f}, 1) esult
Definition: oct-parse.cc:8829
static uint32_t state[624]
Definition: randmtzig.cc:184
static int caller_user_code_line(void)
Definition: call-stack.h:178
static void read_init_file(const std::string &file="")
Definition: cmd-edit.cc:1581
void warning(const char *fmt,...)
Definition: error.cc:788
octave::unwind_protect frame
Definition: graphics.cc:11584
void recover_from_exception(void)
Definition: interpreter.cc:200
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:228
virtual std::string fcn_file_name(void) const
Definition: ov-fcn.h:64
static const std::string in_src
Definition: input.h:149
virtual bool reading_classdef_file(void) const
Definition: input.cc:325
OCTAVE_EXPORT octave_value_list the first data row corresponds to an index of zero The a spreadsheet style form such as the file is read until end of file is reached The such as text
Definition: dlmread.cc:191
int Vecho_executing_commands
Definition: input.cc:93
bool octave_yes_or_no(const std::string &prompt)
int run(void)
Definition: oct-parse.cc:7953
static string_vector generate_possible_completions(const std::string &text, std::string &prefix, std::string &hint, bool &deemed_struct)
Definition: input.cc:350
bool empty(void) const
Definition: ovl.h:98
#define octave_stdout
Definition: pager.h:146
static const std::string in_src
Definition: input.h:213
static void update(void)
Definition: load-path.h:88
char Vfilemarker
Definition: input.cc:124
octave_value do_keyboard(const octave_value_list &args=octave_value_list())
static void set_completion_append_character(char c)
Definition: cmd-edit.cc:1341
static std::string readline(const std::string &prompt)
Definition: cmd-edit.cc:1164
void remove_input_event_hook_functions(void)
Definition: input.cc:130
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
p
Definition: lu.cc:138
bool reading_classdef_file
Definition: lex.h:380
bool empty(void) const
Definition: hook-fcn.h:216
void clear(void)
Definition: hook-fcn.h:218
static bool ignoring_entries(void)
Definition: cmd-hist.cc:600
string_vector make_name_list(void)
Definition: help.cc:222
std::string find_indexed_expression(const std::string &text)
Definition: input.cc:509
static void add_event_hook(event_hook_fcn f)
Definition: cmd-edit.cc:1545
static void set_basic_word_break_characters(const std::string &s)
Definition: cmd-edit.cc:1306
static void set_basic_quote_characters(const std::string &s)
Definition: cmd-edit.cc:1320
tree_statement_list * stmt_list
Definition: parse.h:456
std::string get_file_line(const std::string &fname, size_t line)
Definition: debug.cc:141
OCTINTERP_API octave_value_list eval_string(const std::string &, bool silent, int &parse_status, int nargout)
bool Vdebugging
Definition: input.cc:109
bool octave_completion_matches_called
Definition: input.cc:102
static bool goto_frame_relative(int n, bool verbose=false)
Definition: call-stack.h:258
std::string VPS4
Definition: input.cc:84
void stamp(void)
Definition: oct-time.cc:92
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
octave::base_lexer * lexer
Definition: input.h:145
static void execute_in_debugger_handler(const std::pair< std::string, int > &arg)
Definition: input.cc:579
void set_default_prompts(void)
Definition: input.cc:136
void run(const octave_value_list &initial_args=octave_value_list())
Definition: hook-fcn.h:241
static void set_name(const std::string &n)
Definition: cmd-edit.cc:1157
static void set_quoting_function(quoting_fcn f)
Definition: cmd-edit.cc:1355
static char Vcompletion_append_char
Definition: input.cc:99
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
map_type::iterator iterator
Definition: hook-fcn.h:197