pt-misc.h

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