annotate src/input.h @ 7961:a5d1e27ee1f4 ss-3-1-51

3.1.51 snapshot
author John W. Eaton <jwe@octave.org>
date Tue, 22 Jul 2008 11:40:48 -0400
parents 5640a70cbab1
children 73c4516fae10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2002, 2005, 2006, 2007 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
7
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6208
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6208
diff changeset
11 option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
12
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16 for more details.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6208
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6208
diff changeset
20 <http://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
23
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
24 // Use the GNU readline library for command line editing and hisory.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
383
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 339
diff changeset
26 #if !defined (octave_input_h)
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 339
diff changeset
27 #define octave_input_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
28
1342
61bb2bdee11e [project @ 1995-09-04 00:19:22 by jwe]
jwe
parents: 1315
diff changeset
29 #include <cstdio>
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
30
1750
fd0d12493223 [project @ 1996-01-13 09:31:07 by jwe]
jwe
parents: 1606
diff changeset
31 #include <string>
fd0d12493223 [project @ 1996-01-13 09:31:07 by jwe]
jwe
parents: 1606
diff changeset
32
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3165
diff changeset
33 #include "oct-time.h"
6208
323be5eeed1f [project @ 2006-12-06 20:23:18 by jwe]
jwe
parents: 6206
diff changeset
34 #include "oct-obj.h"
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
35 #include "pager.h"
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3165
diff changeset
36
3707
58140935c812 [project @ 2000-07-28 09:40:52 by jwe]
jwe
parents: 3523
diff changeset
37 class octave_value;
58140935c812 [project @ 2000-07-28 09:40:52 by jwe]
jwe
parents: 3523
diff changeset
38
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1750
diff changeset
39 extern int octave_read (char *buf, unsigned max_size);
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3255
diff changeset
40 extern FILE *get_input_from_file (const std::string& name, int warn = 1);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
41 extern FILE *get_input_from_stdin (void);
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
42
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
43 // Global pointer for eval().
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3255
diff changeset
44 extern std::string current_eval_string;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
45
3019
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
46 // TRUE means get input from current_eval_string.
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
47 extern bool get_input_from_eval_string;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
48
3877
55648fc616c8 [project @ 2002-03-07 23:00:09 by jwe]
jwe
parents: 3804
diff changeset
49 // TRUE means we haven't been asked for the input from
55648fc616c8 [project @ 2002-03-07 23:00:09 by jwe]
jwe
parents: 3804
diff changeset
50 // current_eval_string yet.
55648fc616c8 [project @ 2002-03-07 23:00:09 by jwe]
jwe
parents: 3804
diff changeset
51 extern bool input_from_eval_string_pending;
55648fc616c8 [project @ 2002-03-07 23:00:09 by jwe]
jwe
parents: 3804
diff changeset
52
5189
85b315ad5f7d [project @ 2005-03-04 02:46:08 by jwe]
jwe
parents: 3877
diff changeset
53 // TRUE means that input is coming from a file that was named on
85b315ad5f7d [project @ 2005-03-04 02:46:08 by jwe]
jwe
parents: 3877
diff changeset
54 // the command line.
85b315ad5f7d [project @ 2005-03-04 02:46:08 by jwe]
jwe
parents: 3877
diff changeset
55 extern bool input_from_command_line_file;
85b315ad5f7d [project @ 2005-03-04 02:46:08 by jwe]
jwe
parents: 3877
diff changeset
56
3019
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
57 // TRUE means we're parsing a function file.
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
58 extern bool reading_fcn_file;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
59
1606
2d0541468991 [project @ 1995-11-02 12:57:17 by jwe]
jwe
parents: 1604
diff changeset
60 // Simple name of function file we are reading.
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3255
diff changeset
61 extern std::string curr_fcn_file_name;
1606
2d0541468991 [project @ 1995-11-02 12:57:17 by jwe]
jwe
parents: 1604
diff changeset
62
2d0541468991 [project @ 1995-11-02 12:57:17 by jwe]
jwe
parents: 1604
diff changeset
63 // Full name of file we are reading.
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3255
diff changeset
64 extern std::string curr_fcn_file_full_name;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
65
3019
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
66 // TRUE means we're parsing a script file.
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
67 extern bool reading_script_file;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
68
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
69 // If we are reading from an M-file, this is it.
339
94f0f219a946 [project @ 1994-02-07 07:26:24 by jwe]
jwe
parents: 338
diff changeset
70 extern FILE *ff_instream;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
71
3019
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
72 // TRUE means this is an interactive shell.
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
73 extern bool interactive;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
74
3019
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
75 // TRUE means the user forced this shell to be interactive (-i).
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
76 extern bool forced_interactive;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
77
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
78 // Should we issue a prompt?
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
79 extern int promptflag;
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
80
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
81 // A line of input.
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3255
diff changeset
82 extern std::string current_input_line;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
83
3804
4073be5aefa1 [project @ 2001-02-28 08:36:04 by jwe]
jwe
parents: 3770
diff changeset
84 // TRUE after a call to completion_matches.
2299
f296bbc757a1 [project @ 1996-06-23 03:45:44 by jwe]
jwe
parents: 2275
diff changeset
85 extern bool octave_completion_matches_called;
f296bbc757a1 [project @ 1996-06-23 03:45:44 by jwe]
jwe
parents: 2275
diff changeset
86
7409
73036cdd855d [project @ 2008-01-22 20:31:59 by jwe]
jwe
parents: 7017
diff changeset
87 // TRUE if the plotting system has requested a call to drawnow at
73036cdd855d [project @ 2008-01-22 20:31:59 by jwe]
jwe
parents: 7017
diff changeset
88 // the next user prompt.
7414
905bceea061b [project @ 2008-01-23 08:14:38 by jwe]
jwe
parents: 7409
diff changeset
89 extern OCTINTERP_API bool Vdrawnow_requested;
7409
73036cdd855d [project @ 2008-01-22 20:31:59 by jwe]
jwe
parents: 7017
diff changeset
90
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7414
diff changeset
91 // TRUE if we are in debugging mode.
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7414
diff changeset
92 extern bool Vdebugging;
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7414
diff changeset
93
7787
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
94 // The current line that we are debugging
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
95 extern int Vdebugging_current_line;
6b521b1e3631 Add dbquit and make dbstep compatible. Use parser in debug mode to handle multi-line input
David Bateman <dbateman@free.fr>
parents: 7752
diff changeset
96
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3255
diff changeset
97 extern std::string gnu_readline (const std::string& s, bool force_readline = false);
2927
8722c6284b72 [project @ 1997-05-05 03:44:04 by jwe]
jwe
parents: 2907
diff changeset
98
8722c6284b72 [project @ 1997-05-05 03:44:04 by jwe]
jwe
parents: 2907
diff changeset
99 extern void initialize_command_input (void);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
100
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5307
diff changeset
101 extern bool octave_yes_or_no (const std::string& prompt);
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5307
diff changeset
102
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
103 extern octave_value do_keyboard (const octave_value_list& args = octave_value_list ());
3707
58140935c812 [project @ 2000-07-28 09:40:52 by jwe]
jwe
parents: 3523
diff changeset
104
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5640
diff changeset
105 extern std::string VPS4;
2181
138b3c98dc85 [project @ 1996-05-13 18:02:31 by jwe]
jwe
parents: 1996
diff changeset
106
7818
5640a70cbab1 Add Ffilemarker and fix for 'dbstep in'
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
107 extern char Vfilemarker;
5640a70cbab1 Add Ffilemarker and fix for 'dbstep in'
David Bateman <dbateman@free.fr>
parents: 7787
diff changeset
108
3019
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
109 enum echo_state
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
110 {
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
111 ECHO_OFF = 0,
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
112 ECHO_SCRIPTS = 1,
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
113 ECHO_FUNCTIONS = 2,
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
114 ECHO_CMD_LINE = 4
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
115 };
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
116
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
117 extern int Vecho_executing_commands;
92aa3d651723 [project @ 1997-06-03 22:07:16 by jwe]
jwe
parents: 2927
diff changeset
118
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3165
diff changeset
119 extern octave_time Vlast_prompt_time;
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 3019
diff changeset
120
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
121 #endif
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
122
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
123 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
124 ;;; Local Variables: ***
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
125 ;;; mode: C++ ***
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
126 ;;; End: ***
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
127 */