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_builtin_h) |
|
24 #define octave_builtin_h 1 |
|
25 |
|
26 #include <string> |
|
27 |
|
28 #include "ov-fcn.h" |
|
29 #include "ov-typeinfo.h" |
|
30 |
|
31 class octave_value; |
|
32 class octave_value_list; |
|
33 |
|
34 // Builtin functions. |
|
35 |
|
36 class |
|
37 octave_builtin : public octave_function |
|
38 { |
|
39 public: |
|
40 |
4645
|
41 octave_builtin (void) { } |
4642
|
42 |
2974
|
43 typedef octave_value_list (*fcn) (const octave_value_list&, int); |
|
44 |
3523
|
45 octave_builtin (fcn ff, const std::string& nm = std::string (), |
|
46 const std::string& ds = std::string ()) |
2974
|
47 : octave_function (nm, ds), f (ff) { } |
|
48 |
|
49 ~octave_builtin (void) { } |
|
50 |
4661
|
51 octave_value subsref (const std::string&, |
|
52 const std::list<octave_value_list>&) |
4271
|
53 { |
|
54 panic_impossible (); |
|
55 return octave_value (); |
|
56 } |
|
57 |
4247
|
58 octave_value_list subsref (const std::string& type, |
4219
|
59 const std::list<octave_value_list>& idx, |
3933
|
60 int nargout); |
|
61 |
4654
|
62 octave_function *function_value (bool = false) { return this; } |
2974
|
63 |
3325
|
64 bool is_builtin_function (void) const { return true; } |
|
65 |
3544
|
66 octave_value_list |
|
67 do_multi_index_op (int nargout, const octave_value_list& args); |
2974
|
68 |
3325
|
69 protected: |
|
70 |
|
71 // A pointer to the actual function. |
|
72 fcn f; |
|
73 |
2974
|
74 private: |
|
75 |
4645
|
76 // No copying! |
|
77 |
|
78 octave_builtin (const octave_builtin& ob); |
|
79 |
|
80 octave_builtin& operator = (const octave_builtin& ob); |
2974
|
81 |
4612
|
82 DECLARE_OCTAVE_ALLOCATOR |
2974
|
83 |
4612
|
84 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2974
|
85 }; |
|
86 |
|
87 #endif |
|
88 |
|
89 /* |
|
90 ;;; Local Variables: *** |
|
91 ;;; mode: C++ *** |
|
92 ;;; End: *** |
|
93 */ |