annotate libinterp/octave-value/ov-usr-fcn.h @ 23730:85f1d31956c0

make echo work for command-line functions * file-info.h (file_info::file_info): New constructor from program text and time when text was processed. * ov-usr-fcn.h, ov-usr-fcn.cc (octave_user_code::get_file_info): New function. (octave_user_code::get_code_line, octave_user_code::get_code_lines): Use get_file_info to update m_file_info if it is not already defined. (octave_user_code::cache_function_text): New function. * lex.h, lex.ll (base_lexer::lexical_feedback::buffer_function_text, base_lexer::lexical_feedback::function_text): New variables. (base_lexer::is_keyword_token, lexer::fill_flex_buffer): Handle buffering of function text command-line functions. * oct-parse.in.yy (base_parser::finish_function): Cache function text for command-line functions.
author John W. Eaton <jwe@octave.org>
date Wed, 05 Jul 2017 15:24:55 -0400
parents 06b3d1d54054
children ea879bc55272
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
1 /*
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 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) 1996-2017 John W. Eaton
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
4
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
6
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
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
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 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.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
16
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 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: 6505
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6505
diff changeset
19 <http://www.gnu.org/licenses/>.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
20
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
21 */
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19861
diff changeset
23 #if ! defined (octave_ov_usr_fcn_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_ov_usr_fcn_h 1
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
27
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
28 #include <ctime>
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
29
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
30 #include <string>
4214
b9317f3973ec [project @ 2002-12-04 04:57:01 by jwe]
jwe
parents: 4192
diff changeset
31 #include <stack>
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
32
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
33 #include "comment-list.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20791
diff changeset
34 #include "ovl.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
35 #include "ov-fcn.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
36 #include "ov-typeinfo.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
37 #include "symtab.h"
10637
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
38 #include "unwind-prot.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
39
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
40 class string_vector;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
41
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
42 class octave_value;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
43
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
44 namespace octave
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
45 {
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
46 class file_info;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
47 class tree_parameter_list;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
48 class tree_statement_list;
23481
73558a835b64 eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
49 class tree_evaluator;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
50 class tree_expression;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
51 class tree_walker;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
52 }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
53
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
54 #if defined (HAVE_LLVM)
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
55 class jit_function_info;
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
56 #endif
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
57
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
58 class
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
59 octave_user_code : public octave_function
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
60 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
61 protected:
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
62
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
63 octave_user_code (const std::string& nm,
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
64 const std::string& ds = "")
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
65 : octave_function (nm, ds), curr_unwind_protect_frame (0),
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
66 m_file_info (0)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
67 { }
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
68
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
69 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
70
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
71 octave_user_code (void)
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
72 : octave_function () { }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
73
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
74 // No copying!
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
75
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
76 octave_user_code (const octave_user_code& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
77
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
78 octave_user_code& operator = (const octave_user_code& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
79
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
80 ~octave_user_code (void);
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
81
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
82 bool is_user_code (void) const { return true; }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
83
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
84 octave::unwind_protect *
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
85 unwind_protect_frame (void)
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
86 {
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
87 return curr_unwind_protect_frame;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
88 }
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
89
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
90 std::string get_code_line (size_t line);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
91
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
92 std::deque<std::string> get_code_lines (size_t line, size_t num_lines);
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
93
23730
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
94 void cache_function_text (const std::string& text,
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
95 const octave::sys::time& timestamp);
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
96
16596
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
97 virtual std::map<std::string, octave_value> subfunctions (void) const;
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
98
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
99 virtual octave::tree_statement_list * body (void) = 0;
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
100
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
101 protected:
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
102
23730
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
103 void get_file_info (void);
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
104
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
105 // pointer to the current unwind_protect frame of this function.
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
106 octave::unwind_protect *curr_unwind_protect_frame;
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
107
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
108 // Cached text of function or script code with line offsets
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
109 // calculated.
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
110 octave::file_info *m_file_info;
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
111 };
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
112
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
113 // Scripts.
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
114
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
115 class
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
116 octave_user_script : public octave_user_code
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
117 {
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
118 public:
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
119
7731
2d2a969c731c fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents: 7719
diff changeset
120 octave_user_script (void);
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
121
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
122 octave_user_script (const std::string& fnm, const std::string& nm,
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
123 octave::tree_statement_list *cmds,
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
124 const std::string& ds = "");
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
125
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
126 octave_user_script (const std::string& fnm, const std::string& nm,
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
127 const std::string& ds = "");
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
128
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
129 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
130
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
131 octave_user_script (const octave_user_script& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
132
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
133 octave_user_script& operator = (const octave_user_script& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
134
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
135 ~octave_user_script (void);
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
136
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
137 octave_function * function_value (bool = false) { return this; }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
138
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
139 octave_user_script * user_script_value (bool = false) { return this; }
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
140
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
141 octave_user_code * user_code_value (bool = false) { return this; }
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
142
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
143 // Scripts and user functions are both considered "scripts" because
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
144 // they are written in Octave's scripting language.
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
145
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
146 bool is_user_script (void) const { return true; }
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
147
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
148 void stash_fcn_file_name (const std::string& nm) { file_name = nm; }
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
149
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
150 void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
151
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
152 void stash_fcn_file_time (const octave::sys::time& t)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
153 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
154 t_parsed = t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
155 mark_fcn_file_up_to_date (t);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
156 }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
157
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
158 std::string fcn_file_name (void) const { return file_name; }
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
159
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
160 octave::sys::time time_parsed (void) const { return t_parsed; }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
161
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
162 octave::sys::time time_checked (void) const { return t_checked; }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
163
23653
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
164 octave_value_list
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
165 call (octave::tree_evaluator& tw, int nargout = 0,
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
166 const octave_value_list& args = octave_value_list ());
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
167
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
168 octave::tree_statement_list * body (void) { return cmd_list; }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
169
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
170 void accept (octave::tree_walker& tw);
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
171
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
172 private:
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
173
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
174 // The list of commands that make up the body of this function.
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
175 octave::tree_statement_list *cmd_list;
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
176
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
177 // The name of the file we parsed.
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
178 std::string file_name;
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
179
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
180 // The time the file was parsed.
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
181 octave::sys::time t_parsed;
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
182
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
183 // The time the file was last checked to see if it needs to be
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
184 // parsed again.
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
185 octave::sys::time t_checked;
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
186
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
187 // Used to keep track of recursion depth.
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
188 int call_depth;
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
189
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
190 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
191 };
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
192
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
193 // User-defined functions.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
194
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
195 class
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
196 octave_user_function : public octave_user_code
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
197 {
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
198 public:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
199
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
200 octave_user_function (octave::symbol_table::scope *scope = nullptr,
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
201 octave::tree_parameter_list *pl = nullptr,
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
202 octave::tree_parameter_list *rl = nullptr,
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
203 octave::tree_statement_list *cl = nullptr);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
204
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
205 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
206
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
207 octave_user_function (const octave_user_function& fn) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
208
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
209 octave_user_function& operator = (const octave_user_function& fn) = delete;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
210
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
211 ~octave_user_function (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
212
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
213 octave::symbol_table::context_id active_context () const
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
214 {
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
215 return is_anonymous_function ()
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
216 ? 0 : static_cast<octave::symbol_table::context_id>(call_depth);
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
217 }
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
218
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
219 octave_function * function_value (bool = false) { return this; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
220
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
221 octave_user_function * user_function_value (bool = false) { return this; }
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
222
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
223 octave_user_code * user_code_value (bool = false) { return this; }
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
224
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
225 octave_user_function * define_param_list (octave::tree_parameter_list *t);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
226
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
227 octave_user_function * define_ret_list (octave::tree_parameter_list *t);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
228
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4271
diff changeset
229 void stash_fcn_file_name (const std::string& nm);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
230
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
231 void stash_fcn_location (int line, int col)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
232 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
233 location_line = line;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
234 location_column = col;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
235 }
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
236
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
237 int beginning_line (void) const { return location_line; }
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
238 int beginning_column (void) const { return location_column; }
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
239
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
240 void stash_fcn_end_location (int line, int col)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
241 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
242 end_location_line = line;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
243 end_location_column = col;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
244 }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
245
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
246 int ending_line (void) const { return end_location_line; }
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
247 int ending_column (void) const { return end_location_column; }
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
248
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
249 void maybe_relocate_end (void);
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
250
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
251 void stash_parent_fcn_name (const std::string& p) { parent_name = p; }
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
252
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
253 void stash_parent_fcn_scope (octave::symbol_table::scope *ps);
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
254
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
255 void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
256
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
257 void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
258
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
259 void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
260
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
261 void stash_fcn_file_time (const octave::sys::time& t)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
262 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
263 t_parsed = t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
264 mark_fcn_file_up_to_date (t);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
265 }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
266
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
267 std::string fcn_file_name (void) const { return file_name; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
268
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
269 std::string profiler_name (void) const;
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
270
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
271 std::string parent_fcn_name (void) const { return parent_name; }
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
272
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
273 octave::symbol_table::scope *
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
274 parent_fcn_scope (void) const { return parent_scope; }
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
275
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
276 octave::symbol_table::scope *scope (void) { return m_scope; }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
277
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
278 octave::sys::time time_parsed (void) const { return t_parsed; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
279
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
280 octave::sys::time time_checked (void) const { return t_checked; }
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
281
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
282 void mark_as_system_fcn_file (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
283
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
284 bool is_system_fcn_file (void) const { return system_fcn_file; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
285
4748
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
286 bool is_user_function (void) const { return true; }
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
287
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
288 void erase_subfunctions (void);
7876
8447a5024650 clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents: 7761
diff changeset
289
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
290 bool takes_varargs (void) const;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
291
5848
415ae81d331b [project @ 2006-06-08 20:37:29 by jwe]
jwe
parents: 5744
diff changeset
292 bool takes_var_return (void) const;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
293
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
294 void mark_as_private_function (const std::string& cname = "");
11445
40f311a69417 fix OO field access in subfunctions of private functions
John W. Eaton <jwe@octave.org>
parents: 11220
diff changeset
295
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
296 void lock_subfunctions (void);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
297
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
298 void unlock_subfunctions (void);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
299
16596
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
300 std::map<std::string, octave_value> subfunctions (void) const;
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
301
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
302 bool has_subfunctions (void) const;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
303
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
304 void stash_subfunction_names (const std::list<std::string>& names);
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
305
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
306 std::list<std::string> subfunction_names (void) const
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
307 {
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
308 return subfcn_names;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
309 }
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
310
9522
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
311 octave_value_list all_va_args (const octave_value_list& args);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
312
4748
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
313 void stash_function_name (const std::string& s) { my_name = s; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
314
11461
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
315 void mark_as_subfunction (void) { subfunction = true; }
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
316
11461
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
317 bool is_subfunction (void) const { return subfunction; }
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
318
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
319 void mark_as_inline_function (void) { inline_function = true; }
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
320
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
321 bool is_inline_function (void) const { return inline_function; }
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
322
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
323 void mark_as_anonymous_function (void) { anonymous_function = true; }
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
324
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
325 bool is_anonymous_function (void) const { return anonymous_function; }
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
326
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
327 bool is_anonymous_function_of_class
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
328 (const std::string& cname = "") const
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
329 {
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
330 return anonymous_function
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
331 ? (cname.empty ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
332 ? (! dispatch_class ().empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
333 : cname == dispatch_class ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
334 : false;
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
335 }
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
336
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
337 // If we are a special expression, then the function body consists of exactly
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21743
diff changeset
338 // one expression. The expression's result is the return value of the
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
339 // function.
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
340 bool is_special_expr (void) const
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
341 {
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
342 return is_inline_function () || is_anonymous_function ();
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
343 }
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
344
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
345 bool is_nested_function (void) const { return nested_function; }
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
346
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
347 void mark_as_nested_function (void) { nested_function = true; }
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
348
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
349 void mark_as_class_constructor (void) { class_constructor = legacy; }
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
350
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
351 void mark_as_classdef_constructor (void) { class_constructor = classdef; }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
352
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
353 bool is_class_constructor (const std::string& cname = "") const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
354 {
17856
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
355 return class_constructor == legacy
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
356 ? (cname.empty () ? true : cname == dispatch_class ()) : false;
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
357 }
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
358
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
359 bool is_classdef_constructor (const std::string& cname = "") const
17856
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
360 {
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
361 return class_constructor == classdef
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
362 ? (cname.empty () ? true : cname == dispatch_class ()) : false;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
363 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
364
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
365 void mark_as_class_method (void) { class_method = true; }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
366
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
367 bool is_class_method (const std::string& cname = "") const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
368 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
369 return class_method
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
370 ? (cname.empty () ? true : cname == dispatch_class ()) : false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
371 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
372
23653
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
373 octave_value_list
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
374 call (octave::tree_evaluator& tw, int nargout = 0,
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
375 const octave_value_list& args = octave_value_list ());
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
376
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
377 octave::tree_parameter_list * parameter_list (void) { return param_list; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
378
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
379 octave::tree_parameter_list * return_list (void) { return ret_list; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
380
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
381 octave::tree_statement_list * body (void) { return cmd_list; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
382
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
383 octave_comment_list * leading_comment (void) { return lead_comm; }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
384
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
385 octave_comment_list * trailing_comment (void) { return trail_comm; }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
386
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
387 // If is_special_expr is true, retrieve the sigular expression that forms the
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21743
diff changeset
388 // body. May be null (even if is_special_expr is true).
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
389 octave::tree_expression * special_expr (void);
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
390
9522
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
391 bool subsasgn_optimization_ok (void);
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
392
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
393 void accept (octave::tree_walker& tw);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
394
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
395 #if defined (HAVE_LLVM)
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
396 jit_function_info * get_info (void) { return jit_info; }
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
397
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
398 void stash_info (jit_function_info *info) { jit_info = info; }
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
399 #endif
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
400
23680
ef71711f6d64 rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents: 23653
diff changeset
401 octave_value dump (void) const;
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3875
diff changeset
402
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
403 private:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
404
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
405 enum class_ctor_type
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
406 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
407 none,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
408 legacy,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
409 classdef
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
410 };
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
411
23680
ef71711f6d64 rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents: 23653
diff changeset
412 std::string ctor_type_str (void) const;
ef71711f6d64 rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents: 23653
diff changeset
413
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
414 // Our symbol table scope.
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
415 octave::symbol_table::scope *m_scope;
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
416
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
417 // List of arguments for this function. These are local variables.
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
418 octave::tree_parameter_list *param_list;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
419
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
420 // List of parameters we return. These are also local variables in
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
421 // this function.
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
422 octave::tree_parameter_list *ret_list;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
423
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
424 // The list of commands that make up the body of this function.
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
425 octave::tree_statement_list *cmd_list;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
426
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
427 // The comments preceding the FUNCTION token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
428 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
429
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
430 // The comments preceding the ENDFUNCTION token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
431 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
432
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
433 // The name of the file we parsed.
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3325
diff changeset
434 std::string file_name;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
435
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
436 // Location where this function was defined.
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
437 int location_line;
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
438 int location_column;
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
439 int end_location_line;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
440 int end_location_column;
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
441
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
442 // The name of the parent function, if any.
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
443 std::string parent_name;
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
444
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
445 // The list of subfunctions (if any) in the order they appear in the
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
446 // file.
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
447 std::list<std::string> subfcn_names;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
448
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
449 // The time the file was parsed.
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
450 octave::sys::time t_parsed;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
451
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
452 // The time the file was last checked to see if it needs to be
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
453 // parsed again.
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
454 octave::sys::time t_checked;
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
455
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
456 // True if this function came from a file that is considered to be a
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
457 // system function. This affects whether we check the time stamp
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
458 // on the file to see if it has changed.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
459 bool system_fcn_file;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
460
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
461 // Used to keep track of recursion depth.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
462 int call_depth;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
463
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
464 // The number of arguments that have names.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
465 int num_named_args;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
466
11461
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
467 // TRUE means this subfunction of a primary function.
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
468 bool subfunction;
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
469
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
470 // TRUE means this is an inline function.
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
471 bool inline_function;
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
472
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
473 // TRUE means this is an anonymous function.
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
474 bool anonymous_function;
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
475
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
476 // TRUE means this is a nested function. (either a child or parent)
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
477 bool nested_function;
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
478
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
479 // Enum describing whether this function is the constructor for class object.
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
480 class_ctor_type class_constructor;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
481
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
482 // TRUE means this function is a method for a class.
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
483 bool class_method;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
484
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
485 // The scope of the parent function, if any.
23693
b9378eff6d13 move symbol_table class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 23680
diff changeset
486 octave::symbol_table::scope *parent_scope;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
487
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
488 #if defined (HAVE_LLVM)
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
489 jit_function_info *jit_info;
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
490 #endif
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
491
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
492 void maybe_relocate_end_internal (void);
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
493
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23704
diff changeset
494 void print_code_function_header (const std::string& prefix);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
495
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23704
diff changeset
496 void print_code_function_trailer (const std::string& prefix);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
497
23532
084245f9bd03 pass reference to evaluator to octave_function call methods
John W. Eaton <jwe@octave.org>
parents: 23520
diff changeset
498 void bind_automatic_vars (octave::tree_evaluator& tw,
23481
73558a835b64 eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
499 const string_vector& arg_names,
73558a835b64 eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
500 int nargin, int nargout,
73558a835b64 eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
501 const octave_value_list& va_args);
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3165
diff changeset
502
15427
6823ad7a25b1 implement local option for warnings
John W. Eaton <jwe@octave.org>
parents: 15337
diff changeset
503 void restore_warning_states (void);
6823ad7a25b1 implement local option for warnings
John W. Eaton <jwe@octave.org>
parents: 15337
diff changeset
504
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4346
diff changeset
505 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
506 };
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
507
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
508 #endif