pt-loop.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-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 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include "quit.h"
00028 
00029 #include "error.h"
00030 #include "gripes.h"
00031 #include "oct-map.h"
00032 #include "oct-lvalue.h"
00033 #include "ov.h"
00034 #include "pt-arg-list.h"
00035 #include "pt-bp.h"
00036 #include "pt-cmd.h"
00037 #include "pt-exp.h"
00038 #include "pt-jump.h"
00039 #include "pt-loop.h"
00040 #include "pt-stmt.h"
00041 #include "pt-walk.h"
00042 #include "unwind-prot.h"
00043 
00044 // While.
00045 
00046 tree_while_command::~tree_while_command (void)
00047 {
00048   delete expr;
00049   delete list;
00050   delete lead_comm;
00051   delete trail_comm;
00052 }
00053 
00054 tree_command *
00055 tree_while_command::dup (symbol_table::scope_id scope,
00056                          symbol_table::context_id context) const
00057 {
00058   return new tree_while_command (expr ? expr->dup (scope, context) : 0,
00059                                  list ? list->dup (scope, context) : 0,
00060                                  lead_comm ? lead_comm->dup () : 0,
00061                                  trail_comm ? trail_comm->dup (): 0,
00062                                  line (), column ());
00063 }
00064 
00065 void
00066 tree_while_command::accept (tree_walker& tw)
00067 {
00068   tw.visit_while_command (*this);
00069 }
00070 
00071 // Do-Until
00072 
00073 tree_command *
00074 tree_do_until_command::dup (symbol_table::scope_id scope,
00075                             symbol_table::context_id context) const
00076 {
00077   return new tree_do_until_command (expr ? expr->dup (scope, context) : 0,
00078                                     list ? list->dup (scope, context) : 0,
00079                                     lead_comm ? lead_comm->dup () : 0,
00080                                     trail_comm ? trail_comm->dup (): 0,
00081                                     line (), column ());
00082 }
00083 
00084 void
00085 tree_do_until_command::accept (tree_walker& tw)
00086 {
00087   tw.visit_do_until_command (*this);
00088 }
00089 
00090 // For.
00091 
00092 tree_simple_for_command::~tree_simple_for_command (void)
00093 {
00094   delete lhs;
00095   delete expr;
00096   delete maxproc;
00097   delete list;
00098   delete lead_comm;
00099   delete trail_comm;
00100 }
00101 
00102 tree_command *
00103 tree_simple_for_command::dup (symbol_table::scope_id scope,
00104                               symbol_table::context_id context) const
00105 {
00106   return new tree_simple_for_command
00107     (parallel, lhs ? lhs->dup (scope, context) : 0,
00108      expr ? expr->dup (scope, context) : 0,
00109      maxproc ? maxproc->dup (scope, context) : 0,
00110      list ? list->dup (scope, context) : 0,
00111      lead_comm ? lead_comm->dup () : 0,
00112      trail_comm ? trail_comm->dup () : 0, line (), column ());
00113 }
00114 
00115 void
00116 tree_simple_for_command::accept (tree_walker& tw)
00117 {
00118   tw.visit_simple_for_command (*this);
00119 }
00120 
00121 tree_complex_for_command::~tree_complex_for_command (void)
00122 {
00123   delete lhs;
00124   delete expr;
00125   delete list;
00126   delete lead_comm;
00127   delete trail_comm;
00128 }
00129 
00130 tree_command *
00131 tree_complex_for_command::dup (symbol_table::scope_id scope,
00132                                symbol_table::context_id context) const
00133 {
00134   return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0,
00135                                        expr ? expr->dup (scope, context) : 0,
00136                                        list ? list->dup (scope, context) : 0,
00137                                        lead_comm ? lead_comm->dup () : 0,
00138                                        trail_comm ? trail_comm->dup () : 0,
00139                                        line (), column ());
00140 }
00141 
00142 void
00143 tree_complex_for_command::accept (tree_walker& tw)
00144 {
00145   tw.visit_complex_for_command (*this);
00146 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines