2974
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
|
4 2007 John W. Eaton |
2974
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
7016
|
10 Free Software Foundation; either version 3 of the License, or (at your |
|
11 option) any later version. |
2974
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
7016
|
19 along with Octave; see the file COPYING. If not, see |
|
20 <http://www.gnu.org/licenses/>. |
2974
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_builtin_h) |
|
25 #define octave_builtin_h 1 |
|
26 |
|
27 #include <string> |
|
28 |
|
29 #include "ov-fcn.h" |
|
30 #include "ov-typeinfo.h" |
|
31 |
|
32 class octave_value; |
|
33 class octave_value_list; |
|
34 |
|
35 // Builtin functions. |
|
36 |
|
37 class |
|
38 octave_builtin : public octave_function |
|
39 { |
|
40 public: |
|
41 |
4645
|
42 octave_builtin (void) { } |
4642
|
43 |
2974
|
44 typedef octave_value_list (*fcn) (const octave_value_list&, int); |
|
45 |
3523
|
46 octave_builtin (fcn ff, const std::string& nm = std::string (), |
|
47 const std::string& ds = std::string ()) |
2974
|
48 : octave_function (nm, ds), f (ff) { } |
|
49 |
|
50 ~octave_builtin (void) { } |
|
51 |
4661
|
52 octave_value subsref (const std::string&, |
|
53 const std::list<octave_value_list>&) |
4271
|
54 { |
|
55 panic_impossible (); |
|
56 return octave_value (); |
|
57 } |
|
58 |
4247
|
59 octave_value_list subsref (const std::string& type, |
4219
|
60 const std::list<octave_value_list>& idx, |
3933
|
61 int nargout); |
|
62 |
4654
|
63 octave_function *function_value (bool = false) { return this; } |
2974
|
64 |
3325
|
65 bool is_builtin_function (void) const { return true; } |
|
66 |
3544
|
67 octave_value_list |
|
68 do_multi_index_op (int nargout, const octave_value_list& args); |
2974
|
69 |
3325
|
70 protected: |
|
71 |
|
72 // A pointer to the actual function. |
|
73 fcn f; |
|
74 |
2974
|
75 private: |
|
76 |
4645
|
77 // No copying! |
|
78 |
|
79 octave_builtin (const octave_builtin& ob); |
|
80 |
|
81 octave_builtin& operator = (const octave_builtin& ob); |
2974
|
82 |
4612
|
83 DECLARE_OCTAVE_ALLOCATOR |
2974
|
84 |
4612
|
85 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2974
|
86 }; |
|
87 |
|
88 #endif |
|
89 |
|
90 /* |
|
91 ;;; Local Variables: *** |
|
92 ;;; mode: C++ *** |
|
93 ;;; End: *** |
|
94 */ |