annotate libinterp/corefcn/input.h @ 24740:d85470c4f09c

* input.h: Don't provide typedefs for old function names (bug #53123).
author John W. Eaton <jwe@octave.org>
date Mon, 12 Feb 2018 10:18:12 -0500
parents f079a0856321
children 7c88cf242111
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
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1993-2017 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24279
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24279
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17 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
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24279
diff changeset
19 <https://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
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 // 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
24
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19849
diff changeset
25 #if ! defined (octave_input_h)
383
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 339
diff changeset
26 #define octave_input_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
27
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
28 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
29
1342
61bb2bdee11e [project @ 1995-09-04 00:19:22 by jwe]
jwe
parents: 1315
diff changeset
30 #include <cstdio>
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
31
1750
fd0d12493223 [project @ 1996-01-13 09:31:07 by jwe]
jwe
parents: 1606
diff changeset
32 #include <string>
fd0d12493223 [project @ 1996-01-13 09:31:07 by jwe]
jwe
parents: 1606
diff changeset
33
22380
ddac3d15ad7d use octave_refcount class for reference counts
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
34 #include "oct-refcount.h"
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3165
diff changeset
35 #include "oct-time.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20791
diff changeset
36 #include "ovl.h"
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3707
diff changeset
37 #include "pager.h"
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3165
diff changeset
38
3707
58140935c812 [project @ 2000-07-28 09:40:52 by jwe]
jwe
parents: 3523
diff changeset
39 class octave_value;
22196
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22171
diff changeset
40 namespace octave
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22171
diff changeset
41 {
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22171
diff changeset
42 class base_lexer;
dd992fd74fce put parser, lexer, and evaluator in namespace; interpreter now owns evaluator
John W. Eaton <jwe@octave.org>
parents: 22171
diff changeset
43 }
3707
58140935c812 [project @ 2000-07-28 09:40:52 by jwe]
jwe
parents: 3523
diff changeset
44
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
45 extern OCTINTERP_API FILE * get_input_from_stdin (void);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
46
3804
4073be5aefa1 [project @ 2001-02-28 08:36:04 by jwe]
jwe
parents: 3770
diff changeset
47 // TRUE after a call to completion_matches.
2299
f296bbc757a1 [project @ 1996-06-23 03:45:44 by jwe]
jwe
parents: 2275
diff changeset
48 extern bool octave_completion_matches_called;
f296bbc757a1 [project @ 1996-06-23 03:45:44 by jwe]
jwe
parents: 2275
diff changeset
49
7409
73036cdd855d [project @ 2008-01-22 20:31:59 by jwe]
jwe
parents: 7017
diff changeset
50 // 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
51 // the next user prompt.
7414
905bceea061b [project @ 2008-01-23 08:14:38 by jwe]
jwe
parents: 7409
diff changeset
52 extern OCTINTERP_API bool Vdrawnow_requested;
7409
73036cdd855d [project @ 2008-01-22 20:31:59 by jwe]
jwe
parents: 7017
diff changeset
53
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7414
diff changeset
54 // TRUE if we are in debugging mode.
9237
3c1762c7e787 Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents: 8920
diff changeset
55 extern OCTINTERP_API bool Vdebugging;
7752
40c428ea3408 initial implementation of dbup and dbdown
John W. Eaton <jwe@octave.org>
parents: 7414
diff changeset
56
22164
5d4a286061c8 Track line numbers when in debug mode (bug #45764)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22089
diff changeset
57 // TRUE if we are not executing a command direct from debug> prompt.
5d4a286061c8 Track line numbers when in debug mode (bug #45764)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22089
diff changeset
58 extern OCTINTERP_API bool Vtrack_line_num;
5d4a286061c8 Track line numbers when in debug mode (bug #45764)
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22089
diff changeset
59
22171
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22164
diff changeset
60 extern std::string find_indexed_expression (const std::string& text);
0a4c5a90f286 Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 22164
diff changeset
61
2927
8722c6284b72 [project @ 1997-05-05 03:44:04 by jwe]
jwe
parents: 2907
diff changeset
62 extern void initialize_command_input (void);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
63
5640
426719471ac6 [project @ 2006-03-04 06:02:14 by jwe]
jwe
parents: 5307
diff changeset
64 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
65
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
66 extern octave_value do_keyboard (const octave_value_list& args
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
67 = octave_value_list ());
3707
58140935c812 [project @ 2000-07-28 09:40:52 by jwe]
jwe
parents: 3523
diff changeset
68
16347
bf8397caeff1 allow add_input_event_hook to accept function handles
John W. Eaton <jwe@octave.org>
parents: 16209
diff changeset
69 extern void remove_input_event_hook_functions (void);
bf8397caeff1 allow add_input_event_hook to accept function handles
John W. Eaton <jwe@octave.org>
parents: 16209
diff changeset
70
16528
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16347
diff changeset
71 extern void set_default_prompts (void);
9bc1f8278966 allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents: 16347
diff changeset
72
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
73 extern octave::sys::time Vlast_prompt_time;
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 3019
diff changeset
74
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
75 namespace octave
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
76 {
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
77 class
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
78 base_reader
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
79 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
80 public:
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
81
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
82 friend class input_reader;
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
83
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23615
diff changeset
84 base_reader (base_lexer *lxr)
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
85 : count (1), pflag (0), lexer (lxr)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
86 { }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
87
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
88 base_reader (const base_reader& x)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
89 : count (1), pflag (x.pflag), lexer (x.lexer)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
90 { }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
91
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
92 virtual ~base_reader (void) = default;
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
93
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
94 virtual std::string get_input (bool& eof) = 0;
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
95
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
96 virtual std::string input_source (void) const { return in_src; }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
97
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
98 void reset (void) { promptflag (1); }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
99
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
100 void increment_promptflag (void) { pflag++; }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
101
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
102 void decrement_promptflag (void) { pflag--; }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
103
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
104 int promptflag (void) const { return pflag; }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
105
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
106 int promptflag (int n)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
107 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
108 int retval = pflag;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
109 pflag = n;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
110 return retval;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
111 }
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
112
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
113 std::string octave_gets (bool& eof);
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
114
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
115 virtual bool reading_fcn_file (void) const;
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
116
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
117 virtual bool reading_classdef_file (void) const;
17731
f79bf671a493 eliminate global LEXER variable
John W. Eaton <jwe@octave.org>
parents: 16892
diff changeset
118
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
119 virtual bool reading_script_file (void) const;
17731
f79bf671a493 eliminate global LEXER variable
John W. Eaton <jwe@octave.org>
parents: 16892
diff changeset
120
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
121 virtual bool input_from_terminal (void) const { return false; }
17731
f79bf671a493 eliminate global LEXER variable
John W. Eaton <jwe@octave.org>
parents: 16892
diff changeset
122
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
123 virtual bool input_from_file (void) const { return false; }
17733
8ad59bef27b5 use more direct method for checking input source for lexer
John W. Eaton <jwe@octave.org>
parents: 17731
diff changeset
124
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
125 virtual bool input_from_eval_string (void) const { return false; }
17733
8ad59bef27b5 use more direct method for checking input source for lexer
John W. Eaton <jwe@octave.org>
parents: 17731
diff changeset
126
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
127 private:
17733
8ad59bef27b5 use more direct method for checking input source for lexer
John W. Eaton <jwe@octave.org>
parents: 17731
diff changeset
128
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23615
diff changeset
129 refcount<int> count;
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
130
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
131 int pflag;
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
132
23696
08036a7f3660 remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23615
diff changeset
133 base_lexer *lexer;
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
134
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
135 static const std::string in_src;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
136 };
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
137
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
138 class
24732
f079a0856321 move internal input reader classes out of header file
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
139 input_reader
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
140 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
141 public:
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
142
24732
f079a0856321 move internal input reader classes out of header file
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
143 input_reader (base_lexer *lxr = nullptr);
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
144
24732
f079a0856321 move internal input reader classes out of header file
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
145 input_reader (FILE *file, base_lexer *lxr = nullptr);
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
146
24732
f079a0856321 move internal input reader classes out of header file
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
147 input_reader (const std::string& str, base_lexer *lxr = nullptr);
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
148
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
149 input_reader (const input_reader& ir)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
150 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
151 rep = ir.rep;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
152 rep->count++;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
153 }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
154
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
155 input_reader& operator = (const input_reader& ir)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
156 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
157 if (&ir != this)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
158 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
159 rep = ir.rep;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
160 rep->count++;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
161 }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
162
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
163 return *this;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
164 }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
165
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
166 ~input_reader (void)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
167 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
168 if (--rep->count == 0)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
169 delete rep;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
170 }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
171
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
172 void reset (void) { return rep->reset (); }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
173
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
174 void increment_promptflag (void) { rep->increment_promptflag (); }
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
175
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
176 void decrement_promptflag (void) { rep->decrement_promptflag (); }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
177
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
178 int promptflag (void) const { return rep->promptflag (); }
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
179
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
180 int promptflag (int n) { return rep->promptflag (n); }
16209
e7ff32e7cf82 move global promptflag variable to octave_reader class
John W. Eaton <jwe@octave.org>
parents: 16208
diff changeset
181
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
182 std::string get_input (bool& eof)
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
183 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
184 return rep->get_input (eof);
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
185 }
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
186
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
187 std::string input_source (void) const
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
188 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
189 return rep->input_source ();
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
190 }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
191
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
192 bool input_from_terminal (void) const
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
193 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
194 return rep->input_from_terminal ();
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
195 }
16195
b52d2f9294b6 use class for reading lexer input
John W. Eaton <jwe@octave.org>
parents: 16098
diff changeset
196
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
197 bool input_from_file (void) const
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
198 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
199 return rep->input_from_file ();
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
200 }
17733
8ad59bef27b5 use more direct method for checking input source for lexer
John W. Eaton <jwe@octave.org>
parents: 17731
diff changeset
201
23061
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
202 bool input_from_eval_string (void) const
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
203 {
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
204 return rep->input_from_eval_string ();
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
205 }
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
206
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
207 private:
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
208
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
209 base_reader *rep;
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
210 };
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
211 }
aedc662896a3 move input reader classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 23012
diff changeset
212
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
213 #endif