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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
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 |
|
41 octave_function : public octave_base_value |
|
42 { |
|
43 public: |
|
44 |
4645
|
45 octave_function (void) { } |
2974
|
46 |
|
47 ~octave_function (void) { } |
|
48 |
4579
|
49 octave_value *clone (void) const; |
|
50 octave_value *empty_clone (void) const; |
2974
|
51 |
|
52 bool is_defined (void) const { return true; } |
|
53 |
|
54 bool is_function (void) const { return true; } |
|
55 |
3325
|
56 virtual bool is_dynamically_loaded_function (void) const { return false; } |
|
57 |
3544
|
58 virtual bool is_system_fcn_file (void) const { return false; } |
2974
|
59 |
3523
|
60 virtual std::string fcn_file_name (void) const { return std::string (); } |
2974
|
61 |
3255
|
62 virtual void mark_fcn_file_up_to_date (const octave_time&) { } |
3166
|
63 |
3255
|
64 virtual octave_time time_parsed (void) const |
|
65 { return octave_time (static_cast<time_t> (0)); } |
2974
|
66 |
3255
|
67 virtual octave_time time_checked (void) const |
|
68 { return octave_time (static_cast<time_t> (0)); } |
3166
|
69 |
4343
|
70 virtual bool is_nested_function (void) const { return false; } |
|
71 |
4748
|
72 virtual bool is_user_function (void) const { return false; } |
|
73 |
|
74 virtual bool takes_varargs (void) const { return false; } |
|
75 |
|
76 virtual void octave_va_start (void) { } |
|
77 |
5057
|
78 virtual octave_value octave_va_arg (void) { return octave_value (); } |
4748
|
79 |
|
80 virtual octave_value_list octave_all_va_args (void) |
|
81 { return octave_value_list (); } |
|
82 |
|
83 virtual bool takes_var_return (void) const { return false; } |
|
84 |
4792
|
85 virtual void octave_vr_val (const octave_value&) { } |
4748
|
86 |
|
87 virtual bool has_varargout (void) const { return false; } |
|
88 |
3523
|
89 std::string name (void) const { return my_name; } |
2974
|
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 |
3523
|
99 octave_function (const std::string& nm, const std::string& ds) |
2974
|
100 : my_name (nm), doc (ds) { } |
|
101 |
|
102 // The name of this function. |
3523
|
103 std::string my_name; |
2974
|
104 |
|
105 // The help text for this function. |
3523
|
106 std::string doc; |
2974
|
107 |
3325
|
108 private: |
|
109 |
4645
|
110 // No copying! |
|
111 |
|
112 octave_function (const octave_function& f); |
|
113 |
|
114 octave_function& operator = (const octave_function& f); |
|
115 |
3219
|
116 DECLARE_OCTAVE_ALLOCATOR |
2974
|
117 }; |
|
118 |
|
119 #endif |
|
120 |
|
121 /* |
|
122 ;; Local Variables: *** |
|
123 ;; mode: C++ *** |
|
124 ;; End: *** |
|
125 */ |