Mercurial > hg > octave-nkf
annotate src/ov-builtin.h @ 7708:b42abee70a98
fread, fwrite: allow SKIP arg to be omitted
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 14 Apr 2008 13:13:25 -0400 |
parents | 443a8f5a50fd |
children | 5adeea5de26c |
rev | line source |
---|---|
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 | |
7349 | 38 OCTINTERP_API |
2974 | 39 octave_builtin : public octave_function |
40 { | |
41 public: | |
42 | |
4645 | 43 octave_builtin (void) { } |
4642 | 44 |
2974 | 45 typedef octave_value_list (*fcn) (const octave_value_list&, int); |
46 | |
3523 | 47 octave_builtin (fcn ff, const std::string& nm = std::string (), |
48 const std::string& ds = std::string ()) | |
2974 | 49 : octave_function (nm, ds), f (ff) { } |
50 | |
51 ~octave_builtin (void) { } | |
52 | |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7349
diff
changeset
|
53 octave_value subsref (const std::string& type, |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7349
diff
changeset
|
54 const std::list<octave_value_list>& idx) |
4271 | 55 { |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7349
diff
changeset
|
56 octave_value_list tmp = subsref (type, idx, 1); |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7349
diff
changeset
|
57 return tmp.length () > 0 ? tmp(0) : octave_value (); |
4271 | 58 } |
59 | |
4247 | 60 octave_value_list subsref (const std::string& type, |
4219 | 61 const std::list<octave_value_list>& idx, |
3933 | 62 int nargout); |
63 | |
4654 | 64 octave_function *function_value (bool = false) { return this; } |
2974 | 65 |
3325 | 66 bool is_builtin_function (void) const { return true; } |
67 | |
3544 | 68 octave_value_list |
69 do_multi_index_op (int nargout, const octave_value_list& args); | |
2974 | 70 |
3325 | 71 protected: |
72 | |
73 // A pointer to the actual function. | |
74 fcn f; | |
75 | |
2974 | 76 private: |
77 | |
4645 | 78 // No copying! |
79 | |
80 octave_builtin (const octave_builtin& ob); | |
81 | |
82 octave_builtin& operator = (const octave_builtin& ob); | |
2974 | 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 */ |