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