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 |
7016
|
9 Free Software Foundation; either version 3 of the License, or (at your |
|
10 option) any later version. |
2974
|
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 |
7016
|
18 along with Octave; see the file COPYING. If not, see |
|
19 <http://www.gnu.org/licenses/>. |
2974
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_function_h) |
|
24 #define octave_function_h 1 |
|
25 |
|
26 #include <string> |
|
27 |
3258
|
28 #include "oct-time.h" |
3325
|
29 #include "str-vec.h" |
3258
|
30 |
2974
|
31 #include "oct-alloc.h" |
4748
|
32 #include "oct-obj.h" |
2974
|
33 #include "ov-base.h" |
|
34 #include "ov-typeinfo.h" |
|
35 |
2976
|
36 class tree_walker; |
|
37 |
2974
|
38 // Functions. |
|
39 |
|
40 class |
6109
|
41 OCTINTERP_API |
2974
|
42 octave_function : public octave_base_value |
|
43 { |
|
44 public: |
|
45 |
4645
|
46 octave_function (void) { } |
2974
|
47 |
|
48 ~octave_function (void) { } |
|
49 |
5759
|
50 octave_base_value *clone (void) const; |
|
51 octave_base_value *empty_clone (void) const; |
2974
|
52 |
|
53 bool is_defined (void) const { return true; } |
|
54 |
|
55 bool is_function (void) const { return true; } |
|
56 |
3325
|
57 virtual bool is_dynamically_loaded_function (void) const { return false; } |
|
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 |
3255
|
65 virtual void mark_fcn_file_up_to_date (const octave_time&) { } |
3166
|
66 |
3255
|
67 virtual octave_time time_parsed (void) const |
|
68 { return octave_time (static_cast<time_t> (0)); } |
2974
|
69 |
3255
|
70 virtual octave_time time_checked (void) const |
|
71 { return octave_time (static_cast<time_t> (0)); } |
3166
|
72 |
4343
|
73 virtual bool is_nested_function (void) const { return false; } |
|
74 |
5744
|
75 virtual bool is_user_script (void) const { return false; } |
|
76 |
4748
|
77 virtual bool is_user_function (void) const { return false; } |
|
78 |
|
79 virtual bool takes_varargs (void) const { return false; } |
|
80 |
|
81 virtual bool takes_var_return (void) const { return false; } |
|
82 |
6323
|
83 void mark_relative (void) { relative = true; } |
|
84 |
|
85 bool is_relative (void) const { return relative; } |
|
86 |
3523
|
87 std::string name (void) const { return my_name; } |
2974
|
88 |
5823
|
89 void document (const std::string& ds) { doc = ds; } |
|
90 |
3523
|
91 std::string doc_string (void) const { return doc; } |
2974
|
92 |
3325
|
93 virtual void unload (void) { } |
|
94 |
2976
|
95 virtual void accept (tree_walker&) { } |
|
96 |
2974
|
97 protected: |
|
98 |
5864
|
99 octave_function (const std::string& nm, |
|
100 const std::string& ds = std::string ()) |
6323
|
101 : relative (false), my_name (nm), doc (ds) { } |
|
102 |
|
103 // TRUE if this function was found from a relative path element. |
|
104 bool relative; |
2974
|
105 |
|
106 // The name of this function. |
3523
|
107 std::string my_name; |
2974
|
108 |
|
109 // The help text for this function. |
3523
|
110 std::string doc; |
2974
|
111 |
3325
|
112 private: |
|
113 |
4645
|
114 // No copying! |
|
115 |
|
116 octave_function (const octave_function& f); |
|
117 |
|
118 octave_function& operator = (const octave_function& f); |
|
119 |
3219
|
120 DECLARE_OCTAVE_ALLOCATOR |
2974
|
121 }; |
|
122 |
|
123 #endif |
|
124 |
|
125 /* |
6705
|
126 ;;; Local Variables: *** |
|
127 ;;; mode: C++ *** |
|
128 ;;; End: *** |
2974
|
129 */ |