Mercurial > hg > octave-lyh
annotate src/ov-builtin.h @ 14522:f739e30494c8
condest.m: Fix failing %!test.
* condest.m: Use is_function_handle rather than isscalar to determine
if input is a function handle.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 03 Apr 2012 21:16:29 -0700 |
parents | 72c96de7a403 |
children | 2960f1b2d6ea |
rev | line source |
---|---|
2974 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2974 | 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 | |
7349 | 37 OCTINTERP_API |
2974 | 38 octave_builtin : public octave_function |
39 { | |
40 public: | |
41 | |
10101
b51848e95e4b
cleanups to avoid valgrind warnings
John W. Eaton <jwe@octave.org>
parents:
10075
diff
changeset
|
42 octave_builtin (void) : octave_function (), f (0) { } |
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 (), |
10313 | 47 const std::string& ds = std::string ()) |
2974 | 48 : octave_function (nm, ds), f (ff) { } |
49 | |
50 ~octave_builtin (void) { } | |
51 | |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7349
diff
changeset
|
52 octave_value subsref (const std::string& type, |
10313 | 53 const std::list<octave_value_list>& idx) |
4271 | 54 { |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7349
diff
changeset
|
55 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
|
56 return tmp.length () > 0 ? tmp(0) : octave_value (); |
4271 | 57 } |
58 | |
4247 | 59 octave_value_list subsref (const std::string& type, |
10313 | 60 const std::list<octave_value_list>& idx, |
61 int nargout); | |
3933 | 62 |
10887
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
63 octave_value_list subsref (const std::string& type, |
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
64 const std::list<octave_value_list>& idx, |
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
65 int nargout, const std::list<octave_lvalue>* lvalue_list); |
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
66 |
4654 | 67 octave_function *function_value (bool = false) { return this; } |
2974 | 68 |
3325 | 69 bool is_builtin_function (void) const { return true; } |
70 | |
3544 | 71 octave_value_list |
72 do_multi_index_op (int nargout, const octave_value_list& args); | |
2974 | 73 |
10887
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
74 octave_value_list |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
75 do_multi_index_op (int nargout, const octave_value_list& args, |
10887
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
76 const std::list<octave_lvalue>* lvalue_list); |
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
77 |
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
78 static const std::list<octave_lvalue> *curr_lvalue_list; |
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
79 |
3325 | 80 protected: |
81 | |
82 // A pointer to the actual function. | |
83 fcn f; | |
84 | |
2974 | 85 private: |
86 | |
4645 | 87 // No copying! |
88 | |
89 octave_builtin (const octave_builtin& ob); | |
90 | |
91 octave_builtin& operator = (const octave_builtin& ob); | |
2974 | 92 |
4612 | 93 DECLARE_OCTAVE_ALLOCATOR |
2974 | 94 |
4612 | 95 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2974 | 96 }; |
97 | |
98 #endif |