annotate libinterp/octave-value/ov-usr-fcn.h @ 17856:97e49b588f5d classdef

maint: periodic merge of default to classdef
author John W. Eaton <jwe@octave.org>
date Tue, 05 Nov 2013 12:27:42 -0500
parents 93b3d03b05e7 ebb3ef964372
children 76478d2da117
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
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 16627
diff changeset
3 Copyright (C) 1996-2013 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
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6505
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6505
diff changeset
10 option) any later version.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
11
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
15 for more details.
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
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
23 #if !defined (octave_ov_usr_fcn_h)
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
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
26 #include <ctime>
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
27
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
28 #include <string>
4214
b9317f3973ec [project @ 2002-12-04 04:57:01 by jwe]
jwe
parents: 4192
diff changeset
29 #include <stack>
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
30
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
31 #include "comment-list.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
32 #include "oct-obj.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
33 #include "ov-fcn.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
34 #include "ov-typeinfo.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
35 #include "symtab.h"
10637
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
36 #include "unwind-prot.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
37
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
38 class string_vector;
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 octave_value;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
41 class tree_parameter_list;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
42 class tree_statement_list;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
43 class tree_va_return_list;
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
44 class tree_expression;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
45 class tree_walker;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
46
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
47 #ifdef HAVE_LLVM
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
48 class jit_function_info;
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
49 #endif
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
50
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
51 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
52 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
53 {
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
54 public:
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
55 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
56 : 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
57
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
58 ~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
59
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 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
61
16596
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
62 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
63
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
64 virtual tree_statement_list *body (void) = 0;
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
65
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
66 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
67
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 octave_user_code (const std::string& nm,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
69 const std::string& ds = std::string ())
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
70 : octave_function (nm, ds) { }
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
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 private:
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
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
76 octave_user_code (const octave_user_code& f);
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
77
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
78 octave_user_code& operator = (const octave_user_code& f);
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
79 };
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
80
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
81 // Scripts.
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
82
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
83 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
84 octave_user_script : public octave_user_code
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
85 {
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
86 public:
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
87
7731
2d2a969c731c fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents: 7719
diff changeset
88 octave_user_script (void);
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
89
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
90 octave_user_script (const std::string& fnm, const std::string& nm,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
91 tree_statement_list *cmds,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
92 const std::string& ds = std::string ());
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
93
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
94 octave_user_script (const std::string& fnm, const std::string& nm,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
95 const std::string& ds = std::string ());
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
96
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
97 ~octave_user_script (void);
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
98
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
99 octave_function *function_value (bool = false) { return this; }
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
100
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
101 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
102
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
103 octave_user_code *user_code_value (bool = false) { return this; }
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
104
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
105 // Scripts and user functions are both considered "scripts" because
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
106 // they are written in Octave's scripting language.
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
107
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
108 bool is_user_script (void) const { return true; }
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
109
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
110 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
111
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
112 void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
113
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
114 void stash_fcn_file_time (const octave_time& t)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
115 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
116 t_parsed = t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
117 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
118 }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
119
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
120 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
121
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
122 octave_time time_parsed (void) const { return t_parsed; }
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
123
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
124 octave_time time_checked (void) const { return t_checked; }
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
125
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
126 octave_value subsref (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
127 const std::list<octave_value_list>& idx)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
128 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
129 octave_value_list tmp = subsref (type, idx, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
130 return tmp.length () > 0 ? tmp(0) : octave_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
131 }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
132
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
133 octave_value_list subsref (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
134 const std::list<octave_value_list>& idx,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
135 int nargout);
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
136
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
137 octave_value_list
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
138 do_multi_index_op (int nargout, const octave_value_list& args);
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
139
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
140 tree_statement_list *body (void) { return cmd_list; }
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
141
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
142 void accept (tree_walker& tw);
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
143
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
144 private:
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
145
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
146 // The list of commands that make up the body of this function.
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
147 tree_statement_list *cmd_list;
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
148
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
149 // The name of the file we parsed.
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
150 std::string file_name;
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
151
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
152 // The time the file was parsed.
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
153 octave_time t_parsed;
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
154
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
155 // 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
156 // parsed again.
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
157 octave_time t_checked;
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
158
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
159 // Used to keep track of recursion depth.
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
160 int call_depth;
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
161
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
162 // No copying!
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
163
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
164 octave_user_script (const octave_user_script& f);
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
165
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
166 octave_user_script& operator = (const octave_user_script& f);
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
167
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
168 DECLARE_OCTAVE_ALLOCATOR
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
169
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
170 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
171 };
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
172
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
173 // User-defined functions.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
174
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
175 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
176 octave_user_function : public octave_user_code
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
177 {
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
178 public:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
179
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
180 octave_user_function (symbol_table::scope_id sid = -1,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
181 tree_parameter_list *pl = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
182 tree_parameter_list *rl = 0,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
183 tree_statement_list *cl = 0);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
184
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
185 ~octave_user_function (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
186
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
187 symbol_table::context_id active_context () const
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
188 {
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
189 return is_anonymous_function ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
190 ? 0 : static_cast<symbol_table::context_id>(call_depth);
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
191 }
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
192
4654
a9b22513b7a6 [project @ 2003-11-24 18:56:35 by jwe]
jwe
parents: 4645
diff changeset
193 octave_function *function_value (bool = false) { return this; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
194
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
195 octave_user_function *user_function_value (bool = false) { return this; }
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
196
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
197 octave_user_code *user_code_value (bool = false) { return this; }
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
198
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
199 octave_user_function *define_param_list (tree_parameter_list *t);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
200
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
201 octave_user_function *define_ret_list (tree_parameter_list *t);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
202
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4271
diff changeset
203 void stash_fcn_file_name (const std::string& nm);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
204
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
205 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
206 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
207 location_line = line;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
208 location_column = col;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
209 }
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
210
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
211 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
212 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
213
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
214 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
215 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
216 end_location_line = line;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
217 end_location_column = col;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
218 }
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
219
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
220 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
221 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
222
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
223 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
224
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
225 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
226
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
227 void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; }
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
228
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
229 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
230
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
231 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
232
3325
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 3255
diff changeset
233 void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
234
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3239
diff changeset
235 void stash_fcn_file_time (const octave_time& t)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
236 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
237 t_parsed = t;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
238 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
239 }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
240
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
241 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
242
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
243 std::string profiler_name (void) const;
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
244
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
245 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
246
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
247 symbol_table::scope_id parent_fcn_scope (void) const { return parent_scope; }
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
248
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
249 symbol_table::scope_id scope (void) { return local_scope; }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
250
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
251 octave_time time_parsed (void) const { return t_parsed; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
252
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
253 octave_time time_checked (void) const { return t_checked; }
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
254
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
255 void mark_as_system_fcn_file (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
256
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
257 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
258
4748
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
259 bool is_user_function (void) const { return true; }
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
260
7876
8447a5024650 clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents: 7761
diff changeset
261 void erase_subfunctions (void)
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 symbol_table::erase_subfunctions_in_scope (local_scope);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
264 }
7876
8447a5024650 clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents: 7761
diff changeset
265
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
266 bool takes_varargs (void) const;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
267
5848
415ae81d331b [project @ 2006-06-08 20:37:29 by jwe]
jwe
parents: 5744
diff changeset
268 bool takes_var_return (void) const;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
269
11445
40f311a69417 fix OO field access in subfunctions of private functions
John W. Eaton <jwe@octave.org>
parents: 11220
diff changeset
270 void mark_as_private_function (const std::string& cname = std::string ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
271 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
272 symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cname);
11445
40f311a69417 fix OO field access in subfunctions of private functions
John W. Eaton <jwe@octave.org>
parents: 11220
diff changeset
273
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
274 octave_function::mark_as_private_function (cname);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
275 }
11445
40f311a69417 fix OO field access in subfunctions of private functions
John W. Eaton <jwe@octave.org>
parents: 11220
diff changeset
276
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
277 void lock_subfunctions (void);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
278
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
279 void unlock_subfunctions (void);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
280
16596
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
281 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
282
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
283 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
284
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
285 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
286
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
287 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
288 {
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
289 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
290 }
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
291
9522
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
292 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
293
4748
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
294 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
295
11461
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
296 void mark_as_subfunction (void) { subfunction = true; }
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
297
11461
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
298 bool is_subfunction (void) const { return subfunction; }
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
299
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
300 void mark_as_inline_function (void) { inline_function = true; }
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
301
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
302 bool is_inline_function (void) const { return inline_function; }
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
303
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
304 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
305
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
306 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
307
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
308 bool is_anonymous_function_of_class
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
309 (const std::string& cname = std::string ()) const
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
310 {
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
311 return anonymous_function
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
312 ? (cname.empty ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
313 ? (! dispatch_class ().empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
314 : cname == dispatch_class ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
315 : false;
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
316 }
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
317
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
318 // If we are a special expression, then the function body consists of exactly
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
319 // one expression. The expression's result is the return value of the
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
320 // function.
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
321 bool is_special_expr (void) const
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
322 {
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
323 return is_inline_function () || is_anonymous_function ();
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
324 }
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
325
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
326 bool is_nested_function (void) const { return nested_function; }
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
327
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
328 void mark_as_nested_function (void) { nested_function = true; }
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
329
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
330 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
331
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
332 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
333
11220
883b9308353c allow class function to be called from methods as well as constructors
John W. Eaton <jwe@octave.org>
parents: 10832
diff changeset
334 bool is_class_constructor (const std::string& cname = std::string ()) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
335 {
17856
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
336 return class_constructor == legacy
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
337 ? (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
338 }
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
339
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
340 bool is_classdef_constructor (const std::string& cname = std::string ()) const
17856
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
341 {
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
342 return class_constructor == classdef
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
343 ? (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
344 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
345
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
346 void mark_as_class_method (void) { class_method = true; }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
347
11220
883b9308353c allow class function to be called from methods as well as constructors
John W. Eaton <jwe@octave.org>
parents: 10832
diff changeset
348 bool is_class_method (const std::string& cname = std::string ()) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
349 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
350 return class_method
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
351 ? (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
352 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
353
7651
443a8f5a50fd require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
354 octave_value subsref (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
355 const std::list<octave_value_list>& idx)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
356 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
357 octave_value_list tmp = subsref (type, idx, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
358 return tmp.length () > 0 ? tmp(0) : octave_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
359 }
4271
be631c1720ea [project @ 2003-01-03 19:36:04 by jwe]
jwe
parents: 4247
diff changeset
360
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4238
diff changeset
361 octave_value_list subsref (const std::string& type,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
362 const std::list<octave_value_list>& idx,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
363 int nargout);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3875
diff changeset
364
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
365 octave_value_list subsref (const std::string& type,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
366 const std::list<octave_value_list>& idx,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
367 int nargout,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
368 const std::list<octave_lvalue>* lvalue_list);
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
369
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3523
diff changeset
370 octave_value_list
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3523
diff changeset
371 do_multi_index_op (int nargout, const octave_value_list& args);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
372
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
373 octave_value_list
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
374 do_multi_index_op (int nargout, const octave_value_list& args,
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
375 const std::list<octave_lvalue>* lvalue_list);
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
376
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
377 tree_parameter_list *parameter_list (void) { return param_list; }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
378
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
379 tree_parameter_list *return_list (void) { return ret_list; }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
380
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
381 tree_statement_list *body (void) { return cmd_list; }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
382
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
383 octave_comment_list *leading_comment (void) { return lead_comm; }
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
384
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
385 octave_comment_list *trailing_comment (void) { return trail_comm; }
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
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
388 // body. May be null (even if is_special_expr is true).
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
389 tree_expression *special_expr (void);
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
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
393 void accept (tree_walker& tw);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
394
10637
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
395 template <class T>
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
396 bool local_protect (T& variable)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
397 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
398 if (curr_unwind_protect_frame)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
399 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
400 curr_unwind_protect_frame->protect_var (variable);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
401 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
402 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
403 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
404 return false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
405 }
10637
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
406
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
407 #ifdef HAVE_LLVM
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
408 jit_function_info *get_info (void) { return jit_info; }
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
409
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
410 void stash_info (jit_function_info *info) { jit_info = info; }
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
411 #endif
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
412
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
413 #if 0
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3875
diff changeset
414 void print_symtab_info (std::ostream& os) const;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
415 #endif
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3875
diff changeset
416
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
417 private:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
418
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
419 enum class_ctor_type
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
420 {
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
421 none,
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
422 legacy,
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
423 classdef
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
424 };
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
425
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
426 // List of arguments for this function. These are local variables.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
427 tree_parameter_list *param_list;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
428
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
429 // 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
430 // this function.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
431 tree_parameter_list *ret_list;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
432
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
433 // The list of commands that make up the body of this function.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
434 tree_statement_list *cmd_list;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
435
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
436 // The comments preceding the FUNCTION token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
437 octave_comment_list *lead_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
438
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
439 // The comments preceding the ENDFUNCTION token.
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
440 octave_comment_list *trail_comm;
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
441
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
442 // The name of the file we parsed.
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3325
diff changeset
443 std::string file_name;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
444
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
445 // Location where this function was defined.
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
446 int location_line;
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
447 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
448 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
449 int end_location_column;
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
450
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
451 // The name of the parent function, if any.
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
452 std::string parent_name;
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
453
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
454 // 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
455 // 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
456 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
457
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
458 // The time the file was parsed.
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3239
diff changeset
459 octave_time t_parsed;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
460
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
461 // 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
462 // parsed again.
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3239
diff changeset
463 octave_time t_checked;
3165
e4bbfc196e53 [project @ 1998-04-16 03:01:47 by jwe]
jwe
parents: 2974
diff changeset
464
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
465 // 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
466 // system function. This affects whether we check the time stamp
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
467 // on the file to see if it has changed.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
468 bool system_fcn_file;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
469
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
470 // Used to keep track of recursion depth.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
471 int call_depth;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
472
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
473 // The number of arguments that have names.
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
474 int num_named_args;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
475
11461
2b8531a6a3c9 Change mentions of "nested function" to the less misleading "subfunction"
David Grundberg <individ@acc.umu.se>
parents: 11445
diff changeset
476 // 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
477 bool subfunction;
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
478
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
479 // TRUE means this is an inline function.
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
480 bool inline_function;
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
481
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
482 // TRUE means this is an anonymous function.
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
483 bool anonymous_function;
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
484
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
485 // 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
486 bool nested_function;
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
487
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
488 // 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
489 class_ctor_type class_constructor;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
490
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
491 // 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
492 bool class_method;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
493
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
494 // The scope of the parent function, if any.
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
495 symbol_table::scope_id parent_scope;
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
496
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
497 symbol_table::scope_id local_scope;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
498
10637
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
499 // pointer to the current unwind_protect frame of this function.
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
500 unwind_protect *curr_unwind_protect_frame;
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
501
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
502 #ifdef HAVE_LLVM
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
503 jit_function_info *jit_info;
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
504 #endif
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
505
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
506 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
507
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
508 void print_code_function_header (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
509
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
510 void print_code_function_trailer (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
511
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
512 void bind_automatic_vars (const string_vector& arg_names, int nargin,
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
513 int nargout, const octave_value_list& va_args,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10637
diff changeset
514 const std::list<octave_lvalue> *lvalue_list);
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3165
diff changeset
515
15427
6823ad7a25b1 implement local option for warnings
John W. Eaton <jwe@octave.org>
parents: 15337
diff changeset
516 void restore_warning_states (void);
6823ad7a25b1 implement local option for warnings
John W. Eaton <jwe@octave.org>
parents: 15337
diff changeset
517
4645
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4639
diff changeset
518 // No copying!
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4639
diff changeset
519
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4639
diff changeset
520 octave_user_function (const octave_user_function& fn);
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4639
diff changeset
521
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4639
diff changeset
522 octave_user_function& operator = (const octave_user_function& fn);
bd2067547b40 [project @ 2003-11-23 08:07:52 by jwe]
jwe
parents: 4639
diff changeset
523
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4346
diff changeset
524 DECLARE_OCTAVE_ALLOCATOR
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3165
diff changeset
525
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4346
diff changeset
526 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
527 };
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
528
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
529 #endif