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