2974
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
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" |
|
36 |
2976
|
37 class tree_walker; |
|
38 |
2974
|
39 // Functions. |
|
40 |
|
41 class |
6109
|
42 OCTINTERP_API |
2974
|
43 octave_function : public octave_base_value |
|
44 { |
|
45 public: |
|
46 |
4645
|
47 octave_function (void) { } |
2974
|
48 |
|
49 ~octave_function (void) { } |
|
50 |
5759
|
51 octave_base_value *clone (void) const; |
|
52 octave_base_value *empty_clone (void) const; |
2974
|
53 |
|
54 bool is_defined (void) const { return true; } |
|
55 |
|
56 bool is_function (void) const { return true; } |
|
57 |
3325
|
58 virtual bool is_dynamically_loaded_function (void) const { return false; } |
|
59 |
3544
|
60 virtual bool is_system_fcn_file (void) const { return false; } |
2974
|
61 |
3523
|
62 virtual std::string fcn_file_name (void) const { return std::string (); } |
2974
|
63 |
6323
|
64 virtual std::string parent_fcn_name (void) const { return std::string (); } |
|
65 |
3255
|
66 virtual void mark_fcn_file_up_to_date (const octave_time&) { } |
3166
|
67 |
3255
|
68 virtual octave_time time_parsed (void) const |
|
69 { return octave_time (static_cast<time_t> (0)); } |
2974
|
70 |
3255
|
71 virtual octave_time time_checked (void) const |
|
72 { return octave_time (static_cast<time_t> (0)); } |
3166
|
73 |
4343
|
74 virtual bool is_nested_function (void) const { return false; } |
|
75 |
5744
|
76 virtual bool is_user_script (void) const { return false; } |
|
77 |
4748
|
78 virtual bool is_user_function (void) const { return false; } |
|
79 |
|
80 virtual bool takes_varargs (void) const { return false; } |
|
81 |
|
82 virtual bool takes_var_return (void) const { return false; } |
|
83 |
6323
|
84 void mark_relative (void) { relative = true; } |
|
85 |
|
86 bool is_relative (void) const { return relative; } |
|
87 |
3523
|
88 std::string name (void) const { return my_name; } |
2974
|
89 |
5823
|
90 void document (const std::string& ds) { doc = ds; } |
|
91 |
3523
|
92 std::string doc_string (void) const { return doc; } |
2974
|
93 |
3325
|
94 virtual void unload (void) { } |
|
95 |
2976
|
96 virtual void accept (tree_walker&) { } |
|
97 |
2974
|
98 protected: |
|
99 |
5864
|
100 octave_function (const std::string& nm, |
|
101 const std::string& ds = std::string ()) |
6323
|
102 : relative (false), my_name (nm), doc (ds) { } |
|
103 |
|
104 // TRUE if this function was found from a relative path element. |
|
105 bool relative; |
2974
|
106 |
|
107 // The name of this function. |
3523
|
108 std::string my_name; |
2974
|
109 |
|
110 // The help text for this function. |
3523
|
111 std::string doc; |
2974
|
112 |
3325
|
113 private: |
|
114 |
4645
|
115 // No copying! |
|
116 |
|
117 octave_function (const octave_function& f); |
|
118 |
|
119 octave_function& operator = (const octave_function& f); |
|
120 |
3219
|
121 DECLARE_OCTAVE_ALLOCATOR |
2974
|
122 }; |
|
123 |
|
124 #endif |
|
125 |
|
126 /* |
|
127 ;; Local Variables: *** |
|
128 ;; mode: C++ *** |
|
129 ;; End: *** |
|
130 */ |