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 (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "error.h" |
|
32 #include "oct-obj.h" |
|
33 #include "ov-builtin.h" |
|
34 #include "ov.h" |
|
35 |
3219
|
36 DEFINE_OCTAVE_ALLOCATOR (octave_builtin); |
2974
|
37 |
3219
|
38 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_builtin, "built-in function"); |
2974
|
39 |
|
40 // Are any of the arguments `:'? |
|
41 |
|
42 static bool |
|
43 any_arg_is_magic_colon (const octave_value_list& args) |
|
44 { |
|
45 int nargin = args.length (); |
|
46 |
|
47 for (int i = 0; i < nargin; i++) |
|
48 if (args(i).is_magic_colon ()) |
3325
|
49 return true; |
2974
|
50 |
|
51 return false; |
|
52 } |
|
53 |
|
54 octave_value_list |
|
55 octave_builtin::do_index_op (int nargout, const octave_value_list& args) |
|
56 { |
|
57 octave_value_list retval; |
|
58 |
|
59 if (error_state) |
|
60 return retval; |
|
61 |
|
62 if (any_arg_is_magic_colon (args)) |
|
63 ::error ("invalid use of colon in function argument list"); |
|
64 else |
|
65 retval = (*f) (args, nargout); |
|
66 |
|
67 return retval; |
|
68 } |
|
69 |
|
70 /* |
|
71 ;;; Local Variables: *** |
|
72 ;;; mode: C++ *** |
|
73 ;;; End: *** |
|
74 */ |