/usr/include/octave-3.8.1/octave/input.h is in liboctave-dev 3.8.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | /*
Copyright (C) 1993-2013 John W. Eaton
This file is part of Octave.
Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
*/
// Use the GNU readline library for command line editing and hisory.
#if !defined (octave_input_h)
#define octave_input_h 1
#include <cstdio>
#include <string>
#include "oct-time.h"
#include "oct-obj.h"
#include "pager.h"
class octave_value;
class octave_base_lexer;
extern OCTINTERP_API FILE *get_input_from_stdin (void);
// TRUE means this is an interactive shell.
extern bool interactive;
// TRUE means the user forced this shell to be interactive (-i).
extern bool forced_interactive;
// TRUE after a call to completion_matches.
extern bool octave_completion_matches_called;
// TRUE if the plotting system has requested a call to drawnow at
// the next user prompt.
extern OCTINTERP_API bool Vdrawnow_requested;
// TRUE if we are in debugging mode.
extern OCTINTERP_API bool Vdebugging;
extern void initialize_command_input (void);
extern bool octave_yes_or_no (const std::string& prompt);
extern octave_value do_keyboard (const octave_value_list& args
= octave_value_list ());
extern void remove_input_event_hook_functions (void);
extern void set_default_prompts (void);
extern std::string VPS4;
extern char Vfilemarker;
enum echo_state
{
ECHO_OFF = 0,
ECHO_SCRIPTS = 1,
ECHO_FUNCTIONS = 2,
ECHO_CMD_LINE = 4
};
extern int Vecho_executing_commands;
extern octave_time Vlast_prompt_time;
class
octave_base_reader
{
public:
friend class octave_input_reader;
octave_base_reader (octave_base_lexer *lxr)
: count (1), pflag (0), lexer (lxr)
{ }
octave_base_reader (const octave_base_reader& x)
: count (1), pflag (x.pflag), lexer (x.lexer)
{ }
virtual ~octave_base_reader (void) { }
virtual std::string get_input (bool& eof) = 0;
virtual std::string input_source (void) const { return in_src; }
void reset (void) { promptflag (1); }
void increment_promptflag (void) { pflag++; }
void decrement_promptflag (void) { pflag--; }
int promptflag (void) const { return pflag; }
int promptflag (int n)
{
int retval = pflag;
pflag = n;
return retval;
}
std::string octave_gets (bool& eof);
virtual bool reading_fcn_file (void) const;
virtual bool reading_classdef_file (void) const;
virtual bool reading_script_file (void) const;
virtual bool input_from_terminal (void) const { return false; }
virtual bool input_from_file (void) const { return false; }
virtual bool input_from_eval_string (void) const { return false; }
private:
int count;
int pflag;
octave_base_lexer *lexer;
void do_input_echo (const std::string&) const;
static const std::string in_src;
};
class
octave_terminal_reader : public octave_base_reader
{
public:
octave_terminal_reader (octave_base_lexer *lxr = 0)
: octave_base_reader (lxr)
{ }
std::string get_input (bool& eof);
std::string input_source (void) const { return in_src; }
bool input_from_terminal (void) const { return true; }
private:
static const std::string in_src;
};
class
octave_file_reader : public octave_base_reader
{
public:
octave_file_reader (FILE *f_arg, octave_base_lexer *lxr = 0)
: octave_base_reader (lxr), file (f_arg) { }
std::string get_input (bool& eof);
std::string input_source (void) const { return in_src; }
bool input_from_file (void) const { return true; }
private:
FILE *file;
static const std::string in_src;
};
class
octave_eval_string_reader : public octave_base_reader
{
public:
octave_eval_string_reader (const std::string& str,
octave_base_lexer *lxr = 0)
: octave_base_reader (lxr), eval_string (str)
{ }
std::string get_input (bool& eof);
std::string input_source (void) const { return in_src; }
bool input_from_eval_string (void) const { return true; }
private:
std::string eval_string;
static const std::string in_src;
};
class
octave_input_reader
{
public:
octave_input_reader (octave_base_lexer *lxr = 0)
: rep (new octave_terminal_reader (lxr))
{ }
octave_input_reader (FILE *file, octave_base_lexer *lxr = 0)
: rep (new octave_file_reader (file, lxr))
{ }
octave_input_reader (const std::string& str, octave_base_lexer *lxr = 0)
: rep (new octave_eval_string_reader (str, lxr))
{ }
octave_input_reader (const octave_input_reader& ir)
{
rep = ir.rep;
rep->count++;
}
octave_input_reader& operator = (const octave_input_reader& ir)
{
if (&ir != this)
{
rep = ir.rep;
rep->count++;
}
return *this;
}
~octave_input_reader (void)
{
if (--rep->count == 0)
delete rep;
}
void reset (void) { return rep->reset (); }
void increment_promptflag (void) { rep->increment_promptflag (); }
void decrement_promptflag (void) { rep->decrement_promptflag (); }
int promptflag (void) const { return rep->promptflag (); }
int promptflag (int n) { return rep->promptflag (n); }
std::string get_input (bool& eof)
{
return rep->get_input (eof);
}
std::string input_source (void) const
{
return rep->input_source ();
}
bool input_from_terminal (void) const
{
return rep->input_from_terminal ();
}
bool input_from_file (void) const
{
return rep->input_from_file ();
}
bool input_from_eval_string (void) const
{
return rep->input_from_eval_string ();
}
private:
octave_base_reader *rep;
};
#endif
|