4343
|
1 /* |
|
2 |
|
3 Copyright (C) 2003 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__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include <iostream> |
|
32 |
|
33 #include "error.h" |
|
34 #include "oct-obj.h" |
|
35 #include "ov-fcn-handle.h" |
|
36 #include "pt-fcn-handle.h" |
|
37 #include "pager.h" |
|
38 #include "pt-walk.h" |
|
39 |
|
40 void |
|
41 tree_fcn_handle::print (std::ostream& os, bool pr_as_read_syntax, |
|
42 bool pr_orig_text) |
|
43 { |
|
44 print_raw (os, pr_as_read_syntax, pr_orig_text); |
|
45 } |
|
46 |
|
47 void |
|
48 tree_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax, |
|
49 bool pr_orig_text) |
|
50 { |
|
51 os << ((pr_as_read_syntax || pr_orig_text) ? "@" : "") << nm; |
|
52 } |
|
53 |
|
54 octave_value |
|
55 tree_fcn_handle::rvalue (void) |
|
56 { |
|
57 MAYBE_DO_BREAKPOINT; |
|
58 |
|
59 return make_fcn_handle (nm); |
|
60 } |
|
61 |
|
62 |
|
63 octave_value_list |
|
64 tree_fcn_handle::rvalue (int nargout) |
|
65 { |
|
66 octave_value_list retval; |
|
67 |
|
68 if (nargout > 1) |
|
69 error ("invalid number of output arguments for function handle expression"); |
|
70 else |
|
71 retval = rvalue (); |
|
72 |
|
73 return retval; |
|
74 } |
|
75 |
|
76 void |
|
77 tree_fcn_handle::accept (tree_walker& tw) |
|
78 { |
|
79 tw.visit_fcn_handle (*this); |
|
80 } |
|
81 |
|
82 /* |
|
83 ;;; Local Variables: *** |
|
84 ;;; mode: C++ *** |
|
85 ;;; End: *** |
|
86 */ |