Octave-Forge - Extra packages for GNU Octave | |
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code |
00001 /* 00002 00003 Copyright (C) 1994, 1995, 1996, 1997, 1999, 2002, 2003, 2004, 2005, 00004 2006, 2007, 2008, 2009 John W. Eaton 00005 00006 This file is part of Octave. 00007 00008 Octave is free software; you can redistribute it and/or modify it 00009 under the terms of the GNU General Public License as published by the 00010 Free Software Foundation; either version 3 of the License, or (at your 00011 option) any later version. 00012 00013 Octave is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00016 for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Octave; see the file COPYING. If not, see 00020 <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 #if !defined (octave_tree_misc_h) 00025 #define octave_tree_misc_h 1 00026 00027 class Cell; 00028 00029 class octave_value; 00030 class octave_value_list; 00031 00032 class tree_identifier; 00033 class tree_index_expression; 00034 class tree_va_return_list; 00035 00036 class tree_walker; 00037 00038 #include "base-list.h" 00039 #include "pt-decl.h" 00040 #include "symtab.h" 00041 00042 // Parameter lists. Used to hold the list of input and output 00043 // parameters in a function definition. Elements are identifiers 00044 // only. 00045 00046 class 00047 tree_parameter_list : public octave_base_list<tree_decl_elt *> 00048 { 00049 public: 00050 00051 enum in_or_out 00052 { 00053 in = 1, 00054 out = 2 00055 }; 00056 00057 tree_parameter_list (void) 00058 : marked_for_varargs (0) { } 00059 00060 tree_parameter_list (tree_decl_elt *t) 00061 : marked_for_varargs (0) { append (t); } 00062 00063 ~tree_parameter_list (void); 00064 00065 void mark_as_formal_parameters (void); 00066 00067 bool validate (in_or_out type); 00068 00069 bool takes_varargs (void) const { return marked_for_varargs != 0; } 00070 00071 bool varargs_only (void) { return (marked_for_varargs < 0); } 00072 00073 void initialize_undefined_elements (const std::string& warnfor, 00074 int nargout, const octave_value& val); 00075 00076 void define_from_arg_vector (const octave_value_list& args); 00077 00078 void undefine (void); 00079 00080 bool is_defined (void); 00081 00082 octave_value_list convert_to_const_vector (int nargout, const Cell& varargout); 00083 00084 tree_parameter_list *dup (symbol_table::scope_id scope, 00085 symbol_table::context_id context) const; 00086 00087 void accept (tree_walker& tw); 00088 00089 private: 00090 00091 int marked_for_varargs; 00092 00093 void mark_varargs (void) { marked_for_varargs = 1; } 00094 00095 void mark_varargs_only (void) { marked_for_varargs = -1; } 00096 00097 // No copying! 00098 00099 tree_parameter_list (const tree_parameter_list&); 00100 00101 tree_parameter_list& operator = (const tree_parameter_list&); 00102 }; 00103 00104 // Return lists. Used to hold the right hand sides of multiple 00105 // assignment expressions. 00106 00107 class 00108 tree_return_list : public octave_base_list<tree_index_expression *> 00109 { 00110 public: 00111 00112 tree_return_list (void) { } 00113 00114 tree_return_list (tree_index_expression *t) { append (t); } 00115 00116 ~tree_return_list (void); 00117 00118 tree_return_list *dup (symbol_table::scope_id scope, 00119 symbol_table::context_id context) const; 00120 00121 void accept (tree_walker& tw); 00122 00123 private: 00124 00125 // No copying! 00126 00127 tree_return_list (const tree_return_list&); 00128 00129 tree_return_list& operator = (const tree_return_list&); 00130 }; 00131 00132 class 00133 tree_va_return_list : public octave_base_list<octave_value> 00134 { 00135 public: 00136 00137 tree_va_return_list (void) { } 00138 00139 ~tree_va_return_list (void) { } 00140 00141 private: 00142 00143 // No copying! 00144 00145 tree_va_return_list (const tree_va_return_list&); 00146 00147 tree_va_return_list& operator = (const tree_va_return_list&); 00148 }; 00149 00150 #endif 00151 00152 /* 00153 ;;; Local Variables: *** 00154 ;;; mode: C++ *** 00155 ;;; End: *** 00156 */