# HG changeset patch # User jwe # Date 863766349 0 # Node ID ae20b3f37f5e9e406e1dd0159c2cecd9b99dae87 # Parent 35b3211c6ff992251770b9814459a7f203dfb233 [project @ 1997-05-16 07:05:15 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ Fri May 16 00:07:11 1997 John W. Eaton + * pt-all.h: New file. + * parse.y, lex.l, pt-pr-code.cc: Use it. + + * pt.h: Rename from pt-base.h. + + * All parse tree classes: Add private copy constructors and + assignment operators to prevent copying. + + * pt-base.cc: Delete. + * unwind-prot.h, unwind-prot.cc: Make a bit more object-oriented. Change all uses of unwind_protect stuff to match. diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -70,11 +70,11 @@ ov-str-mat.h ov-bool-mat.h ov-bool.h ov-file.h ov.h \ ov-fcn.h ov-builtin.h ov-mapper.h ov-usr-fcn.h ov-typeinfo.h -PT_INCLUDES := pt-arg-list.h pt-assign.h pt-base.h pt-binop.h \ - pt-cmd.h pt-colon.h pt-const.h pt-decl.h pt-except.h \ - pt-exp.h pt-id.h pt-idx.h pt-indir.h pt-jump.h pt-loop.h \ - pt-mat.h pt-misc.h pt-plot.h pt-pr-code.h pt-select.h \ - pt-stmt.h pt-unop.h pt-walk.h +PT_INCLUDES := pt-all.h pt-arg-list.h pt-assign.h pt-base.h \ + pt-binop.h pt-cmd.h pt-colon.h pt-const.h pt-decl.h \ + pt-except.h pt-exp.h pt-id.h pt-idx.h pt-indir.h \ + pt-jump.h pt-loop.h pt-mat.h pt-misc.h pt-plot.h \ + pt-pr-code.h pt-select.h pt-stmt.h pt-unop.h pt-walk.h INCLUDES := BaseSLList.h Map.h SLList.h SLStack.h Stack.h defun-dld.h \ defun-int.h defun.h dirfns.h dynamic-ld.h error.h file-io.h \ @@ -111,7 +111,7 @@ ov-bool-mat.cc ov-bool.cc ov-file.cc ov.cc ov-fcn.cc \ ov-builtin.cc ov-mapper.cc ov-usr-fcn.cc ov-typeinfo.cc -PT_SRC := pt-arg-list.cc pt-assign.cc pt-base.cc pt-binop.cc \ +PT_SRC := pt-arg-list.cc pt-assign.cc pt-binop.cc \ pt-cmd.cc pt-colon.cc pt-const.cc pt-decl.cc pt-except.cc \ pt-exp.cc pt-id.cc pt-idx.cc pt-indir.cc pt-jump.cc \ pt-loop.cc pt-mat.cc pt-misc.cc pt-plot.cc pt-pr-code.cc \ diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -51,30 +51,7 @@ #include "lex.h" #include "ov.h" #include "parse.h" -#include "pt-arg-list.h" -#include "pt-assign.h" -#include "pt-base.h" -#include "pt-binop.h" -#include "pt-cmd.h" -#include "pt-colon.h" -#include "pt-const.h" -#include "pt-decl.h" -#include "pt-except.h" -#include "pt-exp.h" -#include "pt-id.h" -#include "pt-idx.h" -#include "pt-indir.h" -#include "pt-jump.h" -#include "pt-loop.h" -#include "pt-mat.h" -#include "pt-misc.h" -#include "pt-plot.h" -#include "pt-pr-code.h" -#include "pt-select.h" -#include "pt-stmt.h" -#include "pt-unop.h" -#include "pt-pr-code.h" -#include "pt-walk.h" +#include "pt-all.h" #include "symtab.h" #include "token.h" #include "toplev.h" diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -48,30 +48,7 @@ #include "toplev.h" #include "pager.h" #include "parse.h" -#include "pt-arg-list.h" -#include "pt-assign.h" -#include "pt-base.h" -#include "pt-binop.h" -#include "pt-cmd.h" -#include "pt-colon.h" -#include "pt-const.h" -#include "pt-decl.h" -#include "pt-except.h" -#include "pt-exp.h" -#include "pt-id.h" -#include "pt-idx.h" -#include "pt-indir.h" -#include "pt-jump.h" -#include "pt-loop.h" -#include "pt-mat.h" -#include "pt-misc.h" -#include "pt-plot.h" -#include "pt-pr-code.h" -#include "pt-select.h" -#include "pt-stmt.h" -#include "pt-unop.h" -#include "pt-pr-code.h" -#include "pt-walk.h" +#include "pt-all.h" #include "symtab.h" #include "token.h" #include "utils.h" diff --git a/src/pt-base.h b/src/pt-base.h deleted file mode 100644 --- a/src/pt-base.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - -Copyright (C) 1996, 1997 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#if !defined (octave_tree_base_h) -#define octave_tree_base_h 1 - -#if defined (__GNUG__) -#pragma interface -#endif - -class tree_walker; - -// Base class for the parse tree. - -class -tree -{ -public: - - tree (int l = -1, int c = -1) - { - line_num = l; - column_num = c; - } - - virtual int line (void) const - { return line_num; } - - virtual int column (void) const - { return column_num; } - - virtual void accept (tree_walker& tw) = 0; - -private: - - // The input line and column where we found the text that was - // eventually converted to this tree node. - int line_num; - int column_num; -}; - -#endif - -/* -;;; Local Variables: *** -;;; mode: C++ *** -;;; End: *** -*/ diff --git a/src/pt.h b/src/pt.h new file mode 100644 --- /dev/null +++ b/src/pt.h @@ -0,0 +1,75 @@ +/* + +Copyright (C) 1996, 1997 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_tree_h) +#define octave_tree_h 1 + +#if defined (__GNUG__) +#pragma interface +#endif + +class tree_walker; + +// Base class for the parse tree. + +class +tree +{ +public: + + tree (int l = -1, int c = -1) + { + line_num = l; + column_num = c; + } + + virtual ~tree (void) { } + + virtual int line (void) const + { return line_num; } + + virtual int column (void) const + { return column_num; } + + virtual void accept (tree_walker& tw) = 0; + +private: + + // The input line and column where we found the text that was + // eventually converted to this tree node. + int line_num; + int column_num; + + // No copying! + + tree (const tree&); + + tree& operator = (const tree&); +}; + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/