GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-misc.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2013 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 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_pt_misc_h)
24 #define octave_pt_misc_h 1
25 
26 class Cell;
27 
28 class octave_value;
29 class octave_value_list;
30 
31 class tree_identifier;
34 
35 class tree_walker;
36 
37 #include "base-list.h"
38 #include "pt-decl.h"
39 #include "symtab.h"
40 
41 // Parameter lists. Used to hold the list of input and output
42 // parameters in a function definition. Elements are identifiers
43 // only.
44 
45 class
47 {
48 public:
49 
50  enum in_or_out
51  {
52  in = 1,
53  out = 2
54  };
55 
57  : marked_for_varargs (0) { }
58 
60  : marked_for_varargs (0) { append (t); }
61 
63  : marked_for_varargs (0) { append (new tree_decl_elt (id)); }
64 
65  ~tree_parameter_list (void);
66 
67  void mark_as_formal_parameters (void);
68 
69  bool validate (in_or_out type);
70 
71  bool takes_varargs (void) const { return marked_for_varargs != 0; }
72 
73  bool varargs_only (void) { return (marked_for_varargs < 0); }
74 
75  void initialize_undefined_elements (const std::string& warnfor,
76  int nargout, const octave_value& val);
77 
78  void define_from_arg_vector (const octave_value_list& args);
79 
80  void undefine (void);
81 
82  bool is_defined (void);
83 
84  std::list<std::string> variable_names (void) const;
85 
86  octave_value_list convert_to_const_vector (int nargout,
87  const Cell& varargout);
88 
91 
92  void accept (tree_walker& tw);
93 
94 private:
95 
97 
98  void mark_varargs (void) { marked_for_varargs = 1; }
99 
100  void mark_varargs_only (void) { marked_for_varargs = -1; }
101 
102  // No copying!
103 
105 
107 };
108 
109 // Return lists. Used to hold the right hand sides of multiple
110 // assignment expressions.
111 
112 class
114 {
115 public:
116 
117  tree_return_list (void) { }
118 
120 
121  ~tree_return_list (void);
122 
125 
126  void accept (tree_walker& tw);
127 
128 private:
129 
130  // No copying!
131 
133 
135 };
136 
137 class
139 {
140 public:
141 
143 
145 
146 private:
147 
148  // No copying!
149 
151 
153 };
154 
155 #endif