26 #if ! defined (octave_ov_usr_fcn_h)
27 #define octave_ov_usr_fcn_h 1
29 #include "octave-config.h"
62 const octave::symbol_scope& scope = octave::symbol_scope (),
63 octave::tree_statement_list *cmds =
nullptr,
64 const std::string& ds =
"")
66 m_t_parsed (static_cast<OCTAVE_TIME_T> (0)),
67 m_t_checked (static_cast<OCTAVE_TIME_T> (0)),
68 m_file_info (nullptr), m_cmd_list (cmds)
71 m_scope.set_user_code (
this);
86 std::string get_code_line (std::size_t line);
88 std::deque<std::string> get_code_lines (std::size_t line,
89 std::size_t num_lines);
91 void cache_function_text (
const std::string& text,
92 const octave::sys::time& timestamp);
94 octave::symbol_scope
scope (
void) {
return m_scope; }
104 mark_fcn_file_up_to_date (t);
118 virtual std::map<std::string, octave_value> subfunctions (
void)
const;
120 octave::tree_statement_list *
body (
void) {
return m_cmd_list; }
126 void get_file_info (
void);
159 const octave::symbol_scope& scope = octave::symbol_scope (),
160 octave::tree_statement_list *cmds =
nullptr,
161 const std::string& ds =
"");
164 const octave::symbol_scope& scope = octave::symbol_scope (),
165 const std::string& ds =
"");
192 call (octave::tree_evaluator& tw,
int nargout = 0,
196 execute (octave::tree_evaluator& tw,
int nargout = 0,
199 void accept (octave::tree_walker& tw);
214 octave::tree_parameter_list *pl =
nullptr,
215 octave::tree_parameter_list *rl =
nullptr,
216 octave::tree_statement_list *cl =
nullptr);
238 m_location_line = line;
239 m_location_column = col;
247 m_end_location_line = line;
248 m_end_location_column = col;
254 void maybe_relocate_end (
void);
256 void stash_parent_fcn_scope (
const octave::symbol_scope& ps);
262 std::string profiler_name (
void)
const;
266 octave::symbol_scope pscope = parent_fcn_scope ();
268 return pscope.fcn_name ();
273 return m_scope.parent_scope ();
278 return m_scope.parent_fcn_names ();
281 void mark_as_system_fcn_file (
void);
287 void erase_subfunctions (
void);
289 bool takes_varargs (
void)
const;
291 bool takes_var_return (
void)
const;
293 void mark_as_private_function (
const std::string& cname =
"");
295 void lock_subfunctions (
void);
297 void unlock_subfunctions (
void);
299 std::map<std::string, octave_value> subfunctions (
void)
const;
301 octave_value find_subfunction (
const std::string& subfuns)
const;
303 bool has_subfunctions (
void)
const;
305 void stash_subfunction_names (
const std::list<std::string>& names);
307 std::list<std::string> subfunction_names (
void)
const;
326 (
const std::string& cname =
"")
const
328 return m_anonymous_function
330 ? (! dispatch_class ().empty ())
331 : cname == dispatch_class ())
340 return is_inline_function () || is_anonymous_function ();
353 return (m_class_constructor == legacy
354 ? (cname.empty () ?
true : cname == dispatch_class ()) :
false);
361 return (m_class_constructor == classdef
362 ? (cname.empty () ?
true : cname == dispatch_class ()) :
false);
369 return (m_class_method == legacy
370 ? (cname.empty () ?
true : cname == dispatch_class ()) :
false);
377 return (m_class_method == classdef
378 ? (cname.empty () ?
true : cname == dispatch_class ()) :
false);
387 call (octave::tree_evaluator& tw,
int nargout = 0,
391 execute (octave::tree_evaluator& tw,
int nargout = 0,
396 octave::tree_parameter_list *
return_list (
void) {
return m_ret_list; }
404 octave::tree_expression * special_expr (
void);
406 bool subsasgn_optimization_ok (
void);
408 void accept (octave::tree_walker& tw);
414 enum class_method_type
421 std::string ctor_type_str (
void)
const;
422 std::string method_type_str (
void)
const;
469 void maybe_relocate_end_internal (
void);
471 void print_code_function_header (
const std::string& prefix);
473 void print_code_function_trailer (
const std::string& prefix);
478 void restore_warning_states (
void);
void stash_fcn_file_name(const std::string &nm)
std::string fcn_file_name(void) const
octave_user_code(const octave_user_code &f)=delete
octave::tree_statement_list * body(void)
void mark_fcn_file_up_to_date(const octave::sys::time &t)
octave::sys::time m_t_checked
octave::sys::time time_checked(void) const
octave::tree_statement_list * m_cmd_list
virtual octave_value find_subfunction(const std::string &) const
octave::sys::time m_t_parsed
octave::file_info * m_file_info
octave::sys::time time_parsed(void) const
void stash_fcn_file_time(const octave::sys::time &t)
octave::symbol_scope scope(void)
bool is_user_code(void) const
octave::symbol_scope m_scope
octave_user_code(const std::string &fnm="", const std::string &nm="", const octave::symbol_scope &scope=octave::symbol_scope(), octave::tree_statement_list *cmds=nullptr, const std::string &ds="")
octave::symbol_scope parent_fcn_scope(void) const
std::string parent_fcn_name(void) const
bool is_legacy_method(const std::string &cname="") const
void stash_trailing_comment(octave::comment_list *tc)
void stash_function_name(const std::string &s)
bool is_nested_function(void) const
bool is_special_expr(void) const
void mark_as_anonymous_function(void)
octave::tree_parameter_list * return_list(void)
octave::comment_list * m_trail_comm
octave::tree_parameter_list * m_param_list
octave_function * function_value(bool=false)
int m_end_location_column
int ending_line(void) const
bool is_classdef_constructor(const std::string &cname="") const
octave::tree_parameter_list * parameter_list(void)
octave_user_function * define_param_list(octave::tree_parameter_list *t)
bool is_user_function(void) const
void mark_as_classdef_method(void)
bool is_system_fcn_file(void) const
octave_user_function * user_function_value(bool=false)
bool is_legacy_constructor(const std::string &cname="") const
bool is_classdef_method(const std::string &cname="") const
int ending_column(void) const
int beginning_column(void) const
void mark_as_classdef_constructor(void)
class_method_type m_class_method
octave::tree_parameter_list * m_ret_list
void mark_as_legacy_constructor(void)
bool is_anonymous_function_of_class(const std::string &cname="") const
octave_user_code * user_code_value(bool=false)
bool is_inline_function(void) const
std::list< std::string > parent_fcn_names(void) const
class_method_type m_class_constructor
void stash_leading_comment(octave::comment_list *lc)
bool is_subfunction(void) const
bool is_parent_function(void) const
int beginning_line(void) const
void stash_fcn_location(int line, int col)
void stash_fcn_end_location(int line, int col)
void mark_as_legacy_method(void)
void mark_as_subfunction(void)
void mark_as_inline_function(void)
bool m_anonymous_function
octave::comment_list * m_lead_comm
octave::comment_list * trailing_comment(void)
bool is_anonymous_function(void) const
octave_user_function(const octave_user_function &fcn)=delete
void mark_as_nested_function(void)
octave::comment_list * leading_comment(void)
~octave_user_script(void)=default
bool is_user_script(void) const
octave_user_script(const octave_user_script &f)=delete
octave_user_code * user_code_value(bool=false)
octave_function * function_value(bool=false)
octave_user_script * user_script_value(bool=false)
tree_walker & operator=(const tree_walker &)=delete
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
F77_RET_T const F77_DBLE const F77_DBLE * f
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA