Mercurial > hg > octave-thorsten
annotate src/ov-fcn.h @ 8721:e9cb742df9eb
imported patch sort3.diff
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 11 Feb 2009 15:25:53 +0100 |
parents | 0d607e8dbbfa |
children | 70f5a0375afd |
rev | line source |
---|---|
2974 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
4 2006, 2007 John W. Eaton | |
2974 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2974 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2974 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_function_h) | |
25 #define octave_function_h 1 | |
26 | |
27 #include <string> | |
28 | |
3258 | 29 #include "oct-time.h" |
3325 | 30 #include "str-vec.h" |
3258 | 31 |
2974 | 32 #include "oct-alloc.h" |
4748 | 33 #include "oct-obj.h" |
2974 | 34 #include "ov-base.h" |
35 #include "ov-typeinfo.h" | |
7336 | 36 #include "symtab.h" |
2974 | 37 |
2976 | 38 class tree_walker; |
39 | |
2974 | 40 // Functions. |
41 | |
42 class | |
6109 | 43 OCTINTERP_API |
2974 | 44 octave_function : public octave_base_value |
45 { | |
46 public: | |
47 | |
4645 | 48 octave_function (void) { } |
2974 | 49 |
50 ~octave_function (void) { } | |
51 | |
5759 | 52 octave_base_value *clone (void) const; |
53 octave_base_value *empty_clone (void) const; | |
2974 | 54 |
55 bool is_defined (void) const { return true; } | |
56 | |
57 bool is_function (void) const { return true; } | |
58 | |
3544 | 59 virtual bool is_system_fcn_file (void) const { return false; } |
2974 | 60 |
3523 | 61 virtual std::string fcn_file_name (void) const { return std::string (); } |
2974 | 62 |
6323 | 63 virtual std::string parent_fcn_name (void) const { return std::string (); } |
64 | |
7968
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
65 virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; } |
0d607e8dbbfa
eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents:
7761
diff
changeset
|
66 |
3255 | 67 virtual void mark_fcn_file_up_to_date (const octave_time&) { } |
3166 | 68 |
7336 | 69 virtual symbol_table::scope_id scope (void) { return -1; } |
70 | |
3255 | 71 virtual octave_time time_parsed (void) const |
72 { return octave_time (static_cast<time_t> (0)); } | |
2974 | 73 |
3255 | 74 virtual octave_time time_checked (void) const |
75 { return octave_time (static_cast<time_t> (0)); } | |
3166 | 76 |
4343 | 77 virtual bool is_nested_function (void) const { return false; } |
78 | |
7336 | 79 virtual bool is_class_constructor (void) const { return false; } |
5744 | 80 |
7336 | 81 virtual bool is_class_method (void) const { return false; } |
82 | |
83 virtual std::string dispatch_class (void) const { return std::string (); } | |
4748 | 84 |
85 virtual bool takes_varargs (void) const { return false; } | |
86 | |
87 virtual bool takes_var_return (void) const { return false; } | |
88 | |
7336 | 89 std::string dir_name (void) const { return my_dir_name; } |
90 | |
91 void stash_dir_name (const std::string& dir) { my_dir_name = dir; } | |
92 | |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
93 void lock (void) |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
94 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
95 this->lock_subfunctions (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
96 locked = true; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
97 } |
7336 | 98 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
99 void unlock (void) |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
100 { |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
101 this->unlock_subfunctions (); |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
102 locked = false; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
103 } |
7336 | 104 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7438
diff
changeset
|
105 bool islocked (void) const { return locked; } |
7336 | 106 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
107 virtual void lock_subfunctions (void) { } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
108 |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
109 virtual void unlock_subfunctions (void) { } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7489
diff
changeset
|
110 |
6323 | 111 void mark_relative (void) { relative = true; } |
112 | |
113 bool is_relative (void) const { return relative; } | |
114 | |
3523 | 115 std::string name (void) const { return my_name; } |
2974 | 116 |
5823 | 117 void document (const std::string& ds) { doc = ds; } |
118 | |
3523 | 119 std::string doc_string (void) const { return doc; } |
2974 | 120 |
3325 | 121 virtual void unload (void) { } |
122 | |
2976 | 123 virtual void accept (tree_walker&) { } |
124 | |
2974 | 125 protected: |
126 | |
5864 | 127 octave_function (const std::string& nm, |
128 const std::string& ds = std::string ()) | |
6323 | 129 : relative (false), my_name (nm), doc (ds) { } |
130 | |
131 // TRUE if this function was found from a relative path element. | |
132 bool relative; | |
2974 | 133 |
7336 | 134 // TRUE if this function is tagged so that it can't be cleared. |
135 bool locked; | |
136 | |
2974 | 137 // The name of this function. |
3523 | 138 std::string my_name; |
2974 | 139 |
7336 | 140 // The name of the directory in the path where we found this |
141 // function. May be relative. | |
142 std::string my_dir_name; | |
143 | |
2974 | 144 // The help text for this function. |
3523 | 145 std::string doc; |
2974 | 146 |
3325 | 147 private: |
148 | |
4645 | 149 // No copying! |
150 | |
151 octave_function (const octave_function& f); | |
152 | |
153 octave_function& operator = (const octave_function& f); | |
154 | |
3219 | 155 DECLARE_OCTAVE_ALLOCATOR |
2974 | 156 }; |
157 | |
158 #endif | |
159 | |
160 /* | |
6705 | 161 ;;; Local Variables: *** |
162 ;;; mode: C++ *** | |
163 ;;; End: *** | |
2974 | 164 */ |