26 #if ! defined (octave_interpreter_h)
27 #define octave_interpreter_h 1
29 #include "octave-config.h"
101 void insert (
const std::string& file);
108 std::set<std::string> m_files;
132 void initialize_history (
bool read_history_file =
false);
140 void initialize_load_path (
bool set_initial_path =
true);
149 void get_line_and_eval ();
155 void parse_and_execute (
const std::string& input,
bool& incomplete_parse);
167 return m_interactive;
177 m_read_site_files = flag;
182 m_read_init_files = flag;
192 m_traditional = flag;
197 return m_traditional;
202 m_inhibit_startup_message = flag;
207 return m_evaluator.in_top_level_repl ();
212 return m_initialized;
215 OCTAVE_DEPRECATED (9,
"use octave::is_initialized instead")
216 bool initialized ()
const
218 return is_initialized ();
223 m_interrupt_all_in_process_group = b;
228 return m_interrupt_all_in_process_group;
233 return m_app_context;
238 return m_display_info;
243 return m_environment;
253 return m_error_system;
260 return m_help_system;
265 return m_input_system;
270 return m_output_system;
275 return m_history_system;
280 return m_dynamic_loader;
290 return m_load_save_system;
300 return m_symbol_table;
305 symbol_scope require_current_scope (
const std::string& who)
const;
320 return m_cdef_manager;
325 return m_gtk_manager;
330 return m_event_manager;
335 return *m_gh_manager;
343 int chdir (
const std::string& dir);
345 void mlock (
bool skip_first =
false)
const;
346 void munlock (
bool skip_first =
false)
const;
347 bool mislocked (
bool skip_first =
false)
const;
351 void munlock (
const char *nm);
352 void munlock (
const std::string& nm);
354 bool mislocked (
const char *nm);
355 bool mislocked (
const std::string& nm);
357 std::string mfilename (
const std::string& opt =
"")
const;
360 int& parse_status,
int nargout);
362 octave_value eval_string (
const std::string& eval_str,
bool silent,
366 int& parse_status,
int nargout);
371 const std::string& catch_code,
int nargout);
374 const std::string& try_code,
int nargout);
377 const std::string& try_code,
378 const std::string& catch_code,
int nargout);
381 feval (
const char *name,
386 feval (
const std::string& name,
402 octave_value make_function_handle (
const std::string& name);
404 void install_variable (
const std::string& name,
const octave_value& value,
409 octave_value global_varval (
const std::string& name)
const;
411 void global_assign (
const std::string& name,
414 octave_value top_level_varval (
const std::string& name)
const;
416 void top_level_assign (
const std::string& name,
419 bool is_variable (
const std::string& name)
const;
421 bool is_local_variable (
const std::string& name)
const;
425 void assign (
const std::string& name,
428 void assignin (
const std::string& context,
const std::string& varname,
432 const std::string& context =
"",
433 bool verbose =
false,
bool require_file =
true);
435 bool at_top_level ()
const;
437 bool isglobal (
const std::string& name)
const;
441 void clear_all (
bool force =
false);
443 void clear_objects ();
445 void clear_variable (
const std::string& name);
447 void clear_variable_pattern (
const std::string& pattern);
449 void clear_variable_regexp (
const std::string& pattern);
451 void clear_variables ();
453 void clear_global_variable (
const std::string& name);
455 void clear_global_variable_pattern (
const std::string& pattern);
457 void clear_global_variable_regexp (
const std::string& pattern);
459 void clear_global_variables ();
461 void clear_functions (
bool force =
false);
463 void clear_function (
const std::string& name);
465 void clear_symbol (
const std::string& name);
467 void clear_function_pattern (
const std::string& pat);
469 void clear_function_regexp (
const std::string& pat);
471 void clear_symbol_pattern (
const std::string& pat);
473 void clear_symbol_regexp (
const std::string& pat);
475 std::list<std::string> variable_names ();
477 std::list<std::string> top_level_variable_names ();
479 std::list<std::string> global_variable_names ();
481 std::list<std::string> user_function_names ();
483 std::list<std::string> autoloaded_functions ()
const;
497 void add_debug_watch_expression (
const std::string& expr);
501 void remove_debug_watch_expression (
const std::string& expr);
505 void clear_debug_watch_expressions ();
509 std::set<std::string> debug_watch_expressions ()
const;
515 std::string PS1 ()
const;
516 std::string PS1 (
const std::string& s);
517 void set_PS1 (
const std::string& s);
520 std::string PS2 ()
const;
521 std::string PS2 (
const std::string& s);
522 void set_PS2 (
const std::string& s);
525 std::string PS4 ()
const;
526 std::string PS4 (
const std::string& s);
527 void set_PS4 (
const std::string& s);
531 bool experimental_terminal_widget ()
const;
535 void recover_from_exception ();
537 void mark_for_deletion (
const std::string& file);
539 void cleanup_tmp_files ();
541 void quit (
int exit_status,
bool force =
false,
bool confirm =
true);
547 return m_executing_finish_script;
550 void add_atexit_fcn (
const std::string& fname);
552 bool remove_atexit_fcn (
const std::string& fname);
558 void display_startup_message ()
const;
560 int execute_startup_files ();
562 int execute_eval_option_code ();
564 int execute_command_line_file ();
572 void execute_atexit_fcns ();
574 void maximum_braindamage ();
576 void execute_pkg_add (
const std::string& dir);
578 int safe_source_file (
const std::string& file_name,
579 const std::string& context =
"",
580 bool verbose =
false,
bool require_file =
true);
592 OCTAVE_THREAD_LOCAL
static interpreter *s_instance;
598 std::list<std::string> m_atexit_fcns;
645 bool m_read_site_files;
647 bool m_read_init_files;
653 bool m_inhibit_startup_message;
655 bool m_load_path_initialized;
657 bool m_history_initialized;
659 bool m_interrupt_all_in_process_group;
663 bool m_executing_finish_script;
665 bool m_executing_atexit;
670 OCTAVE_END_NAMESPACE(
octave)
Provides threadsafe access to octave.
void interrupt_all_in_process_group(bool b)
void read_site_files(bool flag)
gh_manager & get_gh_manager()
bool in_top_level_repl() const
cdef_manager & get_cdef_manager()
environment & get_environment()
load_save_system & get_load_save_system()
dynamic_loader & get_dynamic_loader()
type_info & get_type_info()
bool executing_finish_script() const
event_manager & get_event_manager()
symbol_table & get_symbol_table()
input_system & get_input_system()
void cancel_quit(bool flag)
application * get_app_context()
output_system & get_output_system()
settings & get_settings()
gtk_manager & get_gtk_manager()
history_system & get_history_system()
void traditional(bool flag)
void interactive(bool arg)
void inhibit_startup_message(bool flag)
display_info & get_display_info()
load_path & get_load_path()
void read_init_files(bool flag)
bool is_initialized() const
error_system & get_error_system()
void set_global_value(const std::string &name, const octave_value &value)
child_list & get_child_list()
help_system & get_help_system()
bool interrupt_all_in_process_group() const
static interpreter * the_interpreter()
void insert(const std::string &file)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
bool octave_interpreter_ready
sys::time Vlast_chdir_time
std::atomic< bool > octave_initialized
int chdir(const std::string &path_arg)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
void source_file(const std::string &file_name, const std::string &context="", bool verbose=false, bool require_file=true)