changeset 4214:b9317f3973ec

[project @ 2002-12-04 04:57:01 by jwe]
author jwe
date Wed, 04 Dec 2002 04:57:01 +0000
parents f8f7fc582c62
children bc6059c5ddc7
files ChangeLog configure.in src/ChangeLog src/Makefile.in src/lex.l src/oct-obj.h src/ov-usr-fcn.h src/parse.h src/pt-plot.cc src/symtab.cc src/symtab.h src/toplev.cc src/unwind-prot.cc src/unwind-prot.h
diffstat 14 files changed, 105 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 04 04:19:15 2002 +0000
+++ b/ChangeLog	Wed Dec 04 04:57:01 2002 +0000
@@ -1,3 +1,8 @@
+2002-12-03  Nix  <nix@esperi.demon.co.uk>
+
+	* configure.in: Use AC_CHECK_DECL in conjunction with
+        AC_DECL_SYS_SIGLIST to ensure signal.h is searched.
+
 2002-12-03  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* configure.in: Dont't set SONAME_FLAGS for alpha alpha*-dec-osf*
--- a/configure.in	Wed Dec 04 04:19:15 2002 +0000
+++ b/configure.in	Wed Dec 04 04:57:01 2002 +0000
@@ -22,7 +22,7 @@
 ### 02111-1307, USA. 
 
 AC_INIT
-AC_REVISION($Revision: 1.397 $)
+AC_REVISION($Revision: 1.398 $)
 AC_PREREQ(2.52)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -1123,7 +1123,9 @@
 ### Signal stuff.
 
 AC_TYPE_SIGNAL
-AC_DECL_SYS_SIGLIST
+AC_CHECK_DECL([sys_siglist],
+  [AC_DEFINE(SYS_SIGLIST_DECLARED, 1, [Define if your system has a declaration of sys_siglist.])],
+  [AC_CHECK_DECLS([sys_siglist])], [#include <signal.h>])
 AC_MSG_CHECKING([for sys_siglist variable])
 AC_TRY_LINK([#include <stdio.h>],
   [extern char *sys_siglist[]; printf ("%s\n", sys_siglist[1]);],
--- a/src/ChangeLog	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/ChangeLog	Wed Dec 04 04:57:01 2002 +0000
@@ -1,6 +1,24 @@
 2002-12-03  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
-	* utils.cc: Don't include SLStack.h.
+	* TEMPLATE-INST/SLStack-i.cc, TEMPLATE-INST/SLStack-ovl.cc,
+	TEMPLATE-INST/SLStack-pc.cc, TEMPLATE-INST/SLStack-str.cc,
+	TEMPLATE-INST/SLStack-sym.cc, TEMPLATE-INST/SLStack-tok.cc,
+	TEMPLATE-INST/SLStack-ue.cc, TEMPLATE-INST/SLStack-ui.cc:
+	Delete unnecessary files.
+	* Makefile.in (TI_XSRC): Delete them from the list.
+
+	* toplev.cc (octave_atexit_functions): Now std::stack, not SLStack.
+	* pt-plot.cc (tmp_files): Likewise. 
+	* lex.l (token_stack): Likewise.
+	(class bracket_brace_paren_nesting_level): Make context a data
+	member instead of deriving from SLStack object.
+	Use std::stack instead of SLStack.
+	* ov-usr-fcn.h (octave_user_function::saved_args): Likewise.
+	* symtab.h (symbol_record::context): Likewise.
+	(symbol_record::global_link_context): Likewise.
+
+	* unwind-prot.h (unwind_protect::elt_list): Rename from list.
+	Now std::stack, not SLStack.
 
 	* pt-stmt.h (tree_statement_list): Make list member data instead
 	of deriving from SLList object.
--- a/src/Makefile.in	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/Makefile.in	Wed Dec 04 04:57:01 2002 +0000
@@ -92,9 +92,7 @@
 
 TI_XSRC := Array-oc.cc Array-os.cc Array-sym.cc Array-tc.cc Map-fnc.cc \
 	Map-oct-obj.cc Map-tc.cc SLList-expr.cc SLList-misc.cc \
-	SLList-plot.cc SLList-tc.cc SLList-tm.cc SLStack-i.cc \
-	SLStack-ovl.cc SLStack-pc.cc SLStack-str.cc SLStack-sym.cc \
-	SLStack-tok.cc SLStack-ue.cc SLStack-ui.cc
+	SLList-plot.cc SLList-tc.cc SLList-tm.cc
 
 TI_SRC := $(addprefix TEMPLATE-INST/, $(TI_XSRC))
 
--- a/src/lex.l	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/lex.l	Wed Dec 04 04:57:01 2002 +0000
@@ -32,6 +32,7 @@
 #include <cstring>
 
 #include <string>
+#include <stack>
 
 #ifdef HAVE_UNISTD_H
 #ifdef HAVE_SYS_TYPES_H
@@ -40,8 +41,6 @@
 #include <unistd.h>
 #endif
 
-#include "SLStack.h"
-
 #include "cmd-edit.h"
 #include "quit.h"
 #include "lo-sstream.h"
@@ -87,7 +86,7 @@
 //
 // XXX FIXME XXX -- this should really be static, but that causes
 // problems on some systems.
-SLStack <token*> token_stack;
+std::stack <token*> token_stack;
 
 // Did eat_whitespace() eat a space or tab, or a newline, or both?
 
@@ -99,29 +98,36 @@
 
 // Is the closest nesting level a square bracket, squiggly brace or a paren?
 
-class bracket_brace_paren_nesting_level : public SLStack <int>
+class bracket_brace_paren_nesting_level
 {
 public:
 
-  bracket_brace_paren_nesting_level (void) : SLStack<int> () { }
+  bracket_brace_paren_nesting_level (void) : context () { }
 
   ~bracket_brace_paren_nesting_level (void) { }
 
-  void bracket (void) { push (BRACKET); }
-  bool is_bracket (void) { return ! empty () && top () == BRACKET; }
-
-  void brace (void) { push (BRACE); }
-  bool is_brace (void) { return ! empty () && top () == BRACE; }
-
-  void paren (void) { push (PAREN); }
-  bool is_paren (void) { return ! empty () && top () == PAREN; }
-
-  bool none (void) { return empty (); }
-
-  void remove (void) { if (! empty ()) SLStack<int>::pop (); }
+  void bracket (void) { context.push (BRACKET); }
+  bool is_bracket (void)
+    { return ! context.empty () && context.top () == BRACKET; }
+
+  void brace (void) {  context.push (BRACE); }
+  bool is_brace (void)
+    { return ! context.empty () && context.top () == BRACE; }
+
+  void paren (void) {  context.push (PAREN); }
+  bool is_paren (void)
+    { return ! context.empty () && context.top () == PAREN; }
+
+  bool none (void) { return context.empty (); }
+
+  void remove (void) { if (! context.empty ()) context.pop (); }
+
+  void clear (void) { while (! context.empty ()) context.pop (); }
 
 private:
 
+  std::stack<int> context;
+
   enum { BRACKET = 1, BRACE = 2, PAREN = 3 };
 
   bracket_brace_paren_nesting_level (const bracket_brace_paren_nesting_level&);
@@ -819,7 +825,10 @@
   // Clear out the stack of token info used to track line and column
   // numbers.
   while (! token_stack.empty ())
-    delete token_stack.pop ();
+    {
+      delete token_stack.top ();
+      token_stack.pop ();
+    }
 
   // Can be reset by defining a function.
   if (! (reading_script_file || reading_fcn_file))
--- a/src/oct-obj.h	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/oct-obj.h	Wed Dec 04 04:57:01 2002 +0000
@@ -102,6 +102,11 @@
   void *operator new (size_t size)
     { return allocator.alloc (size); }
 
+  // XXX FIXME XXX -- without this, I have errors with the stack of
+  // octave_value_list objects in ov-usr-fcn.h.  Why?
+  void *operator new (size_t size, void *p)
+    { return ::operator new (size, p); }
+
   void operator delete (void *p, size_t size)
     { allocator.free (p, size); }
 
--- a/src/ov-usr-fcn.h	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/ov-usr-fcn.h	Wed Dec 04 04:57:01 2002 +0000
@@ -30,14 +30,13 @@
 #include <ctime>
 
 #include <string>
+#include <stack>
 
 #include "comment-list.h"
 #include "oct-obj.h"
 #include "ov-fcn.h"
 #include "ov-typeinfo.h"
 
-#include "SLStack.h"
-
 class string_vector;
 
 class octave_value;
@@ -134,7 +133,10 @@
       if (saved_args.empty ())
 	args_passed = octave_value_list ();
       else
-	args_passed = saved_args.pop ();
+	{
+	  args_passed = saved_args.top ();
+	  saved_args.pop ();
+	}
     }
 
   octave_value_list subsref (const std::string type,
@@ -213,7 +215,7 @@
   octave_value_list args_passed;
 
   // A place to store the passed args for recursive calls.
-  SLStack<octave_value_list> saved_args;
+  std::stack<octave_value_list> saved_args;
 
   // The number of arguments passed in.
   int num_args_passed;
--- a/src/parse.h	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/parse.h	Wed Dec 04 04:57:01 2002 +0000
@@ -27,8 +27,6 @@
 
 #include <string>
 
-#include "SLStack.h"
-
 extern void reset_parser (void);
 extern int yylex (void);
 extern int yyparse (void);
--- a/src/pt-plot.cc	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/pt-plot.cc	Wed Dec 04 04:57:01 2002 +0000
@@ -33,6 +33,7 @@
 #include <fstream>
 #include <iostream>
 #include <string>
+#include <stack>
 
 #ifdef HAVE_UNISTD_H
 #ifdef HAVE_SYS_TYPES_H
@@ -41,7 +42,6 @@
 #include <unistd.h>
 #endif
 
-#include "SLStack.h"
 #include "procstream.h"
 
 #include "file-ops.h"
@@ -91,7 +91,7 @@
 //
 // XXX FIXME XXX -- this should really be static, but that causes
 // problems on some systems.
-SLStack <std::string> tmp_files;
+std::stack <std::string> tmp_files;
 
 // Pipe to gnuplot.
 static oprocstream *plot_stream = 0;
@@ -900,7 +900,8 @@
 {
   while (! tmp_files.empty ())
     {
-      std::string filename = tmp_files.pop ();
+      std::string filename = tmp_files.top ();
+      tmp_files.pop ();
       unlink (filename.c_str ());
     }
 }
--- a/src/symtab.cc	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/symtab.cc	Wed Dec 04 04:57:01 2002 +0000
@@ -394,9 +394,11 @@
       if (--definition->count <= 0)
 	delete definition;
 
-      definition = context.pop ();
+      definition = context.top ();
+      context.pop ();
 
-      linked_to_global = global_link_context.pop ();
+      linked_to_global = global_link_context.top ();
+      global_link_context.pop ();
     }
 }
 
--- a/src/symtab.h	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/symtab.h	Wed Dec 04 04:57:01 2002 +0000
@@ -30,8 +30,7 @@
 #include <cassert>
 
 #include <string>
-
-#include "SLStack.h"
+#include <stack>
 
 #include "oct-alloc.h"
 #include "str-vec.h"
@@ -365,8 +364,8 @@
 
   // This should maybe be one stack with a structure containing all the
   // items we need to save for recursive calls...
-  SLStack <symbol_def *> context;
-  SLStack <unsigned int> global_link_context;
+  std::stack <symbol_def *> context;
+  std::stack <unsigned int> global_link_context;
 
   bool read_only_error (const char *action);
 
--- a/src/toplev.cc	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/toplev.cc	Wed Dec 04 04:57:01 2002 +0000
@@ -574,7 +574,7 @@
 
 // XXX FIXME XXX -- this should really be static, but that causes
 // problems on some systems.
-SLStack<std::string> octave_atexit_functions;
+std::stack<std::string> octave_atexit_functions;
 
 void
 do_octave_atexit (void)
@@ -583,7 +583,9 @@
 
   while (! octave_atexit_functions.empty ())
     {
-      octave_value_list fcn = octave_atexit_functions.pop ();
+      octave_value_list fcn = octave_atexit_functions.top ();
+
+      octave_atexit_functions.pop ();
 
       feval (fcn, 0);
 
--- a/src/unwind-prot.cc	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/unwind-prot.cc	Wed Dec 04 04:57:01 2002 +0000
@@ -30,17 +30,13 @@
 
 #include <cstddef>
 
-#include <string>
-
-#include "SLStack.h"
-
 #include "CMatrix.h"
 
 #include "error.h"
 #include "unwind-prot.h"
 #include "utils.h"
 
-SLStack<unwind_elem> unwind_protect::list;
+std::stack<unwind_elem> unwind_protect::elt_list;
 
 class
 saved_variable
@@ -196,13 +192,15 @@
 unwind_protect::add (unwind_elem::cleanup_func fptr, void *ptr)
 {
   unwind_elem el (fptr, ptr);
-  list.push (el);
+  elt_list.push (el);
 }
 
 void
 unwind_protect::run (void)
 {
-  unwind_elem el = list.pop ();
+  unwind_elem el = elt_list.top ();
+
+  elt_list.pop ();
 
   unwind_elem::cleanup_func f = el.fptr ();
 
@@ -213,22 +211,24 @@
 void
 unwind_protect::discard (void)
 {
-  list.pop ();
+  elt_list.pop ();
 }
 
 void
 unwind_protect::begin_frame (const std::string& tag)
 {
   unwind_elem elem (tag);
-  list.push (elem);
+  elt_list.push (elem);
 }
 
 void
 unwind_protect::run_frame (const std::string& tag)
 {
-  while (! list.empty ())
+  while (! elt_list.empty ())
     {
-      unwind_elem el = list.pop ();
+      unwind_elem el = elt_list.top ();
+
+      elt_list.pop ();
 
       unwind_elem::cleanup_func f = el.fptr ();
 
@@ -243,9 +243,11 @@
 void
 unwind_protect::discard_frame (const std::string& tag)
 {
-  while (! list.empty ())
+  while (! elt_list.empty ())
     {
-      unwind_elem el = list.pop ();
+      unwind_elem el = elt_list.top ();
+
+      elt_list.pop ();
 
       if (tag == el.tag ())
 	break;
@@ -255,9 +257,11 @@
 void
 unwind_protect::run_all (void)
 {
-  while (! list.empty ())
+  while (! elt_list.empty ())
     {
-      unwind_elem el = list.pop ();
+      unwind_elem el = elt_list.top ();
+
+      elt_list.pop ();
 
       unwind_elem::cleanup_func f = el.fptr ();
 
@@ -269,7 +273,8 @@
 void
 unwind_protect::discard_all (void)
 {
-  list.clear ();
+  while (! elt_list.empty ())
+    elt_list.pop ();
 }
 
 void
--- a/src/unwind-prot.h	Wed Dec 04 04:19:15 2002 +0000
+++ b/src/unwind-prot.h	Wed Dec 04 04:57:01 2002 +0000
@@ -30,8 +30,7 @@
 #include <cstddef>
 
 #include <string>
-
-#include <SLStack.h>
+#include <stack>
 
 class
 unwind_elem
@@ -111,7 +110,7 @@
 
   static void save_var (void *ptr, void *value, size_t size);
 
-  static SLStack<unwind_elem> list;
+  static std::stack<unwind_elem> elt_list;
 };
 
 // We could get by without these macros, but they are nice to have...