Mercurial > hg > octave-nkf
annotate libinterp/parse-tree/pt-funcall.h @ 19087:f9cf5ae6b8a2
Add image directory to plot comparison scripts.
* compare_plot_demos.m, dump_demos.m: Add image directory to plot comparison
scripts.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 04 Jul 2014 21:40:50 -0700 |
parents | 9ca314e79956 |
children | 4197fc428c7d |
rev | line source |
---|---|
15035 | 1 /* |
2 | |
17746
c4f5c781c3ca
maint: Update copyright notices.
John W. Eaton <jwe@octave.org>
parents:
15841
diff
changeset
|
3 Copyright (C) 2012-2013 John W. Eaton |
15035 | 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 3 of the License, or (at your | |
10 option) any 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, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
23 #if !defined (octave_tree_funcall_h) | |
24 #define octave_tree_funcall_h 1 | |
25 | |
26 #include "ov.h" | |
27 #include "oct-obj.h" | |
28 #include "parse.h" | |
29 #include "pt-exp.h" | |
30 | |
31 // Function call. This class only represents function calls that have | |
32 // known functions (most useful for calls to built-in functions that | |
33 // are generated by the parser) and fixed argument lists, known at | |
34 // compile time. | |
35 | |
36 class | |
37 tree_funcall : public tree_expression | |
38 { | |
39 public: | |
40 | |
41 tree_funcall (const octave_value& f, const octave_value_list& a, | |
42 int l = -1, int c = -1) | |
43 : tree_expression (l, c), fcn (f), args (a) | |
44 { | |
45 if (! fcn.is_function ()) | |
46 error ("tree_funcall: invalid function"); | |
47 } | |
48 | |
49 ~tree_funcall (void) { } | |
50 | |
51 bool has_magic_end (void) const { return false; } | |
52 | |
53 void print (std::ostream& os, bool pr_as_read_syntax = false, | |
54 bool pr_orig_txt = true); | |
55 | |
56 void print_raw (std::ostream& os, bool pr_as_read_syntax = false, | |
57 bool pr_orig_txt = true); | |
58 | |
59 tree_funcall *dup (symbol_table::scope_id, | |
60 symbol_table::context_id context) const; | |
61 | |
62 octave_value rvalue1 (int nargout) | |
63 { | |
64 octave_value retval; | |
65 | |
66 const octave_value_list tmp = rvalue (nargout); | |
67 | |
68 if (! tmp.empty ()) | |
69 retval = tmp(0); | |
70 | |
71 return retval; | |
72 } | |
73 | |
18423
9ca314e79956
Allow to call superclass constructor without arguments.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17746
diff
changeset
|
74 octave_value_list rvalue (int nargout); |
15035 | 75 |
76 octave_value function (void) const { return fcn; } | |
77 | |
78 octave_value_list arguments (void) const { return args; } | |
79 | |
80 void accept (tree_walker& tw); | |
81 | |
82 private: | |
83 | |
84 // Function to call. Error if not a valid function at time of | |
85 // construction. | |
86 octave_value fcn; | |
87 | |
88 // Argument list. | |
89 octave_value_list args; | |
90 | |
91 // No copying! | |
92 | |
93 tree_funcall (const tree_funcall&); | |
94 | |
95 tree_funcall& operator = (const tree_funcall&); | |
96 }; | |
97 | |
98 #endif |