diff src/parse.y @ 4051:b79da8779a0e

[project @ 2002-08-17 19:38:32 by jwe]
author jwe
date Sat, 17 Aug 2002 19:38:33 +0000
parents 9678c5526190
children b4fa31442a78
line wrap: on
line diff
--- a/src/parse.y	Sat Aug 17 02:18:18 2002 +0000
+++ b/src/parse.y	Sat Aug 17 19:38:33 2002 +0000
@@ -38,8 +38,6 @@
 #include <cstdlib>
 #endif
 
-#include <strstream.h>
-
 #include "Cell.h"
 #include "Matrix.h"
 #include "cmd-edit.h"
@@ -47,6 +45,7 @@
 #include "file-ops.h"
 #include "file-stat.h"
 #include "oct-time.h"
+#include "lo-sstream.h"
 
 #include "comment-list.h"
 #include "defun.h"
@@ -1483,7 +1482,7 @@
 {
   int err_col = current_input_column - 1;
 
-  std::ostrstream output_buf;
+  OSSTREAM output_buf;
 
   if (reading_fcn_file || reading_script_file)
     output_buf << "parse error near line " << input_line_number
@@ -1503,7 +1502,7 @@
       if (current_input_line[len-1] == '\n')
         current_input_line.resize (len-1);
 
-// Print the line, maybe with a pointer near the error token.
+      // Print the line, maybe with a pointer near the error token.
 
       output_buf << ">>> " << current_input_line << "\n";
 
@@ -1516,13 +1515,11 @@
       output_buf << "^";
     }
 
-  output_buf << "\n" << std::ends;
-
-  char *msg = output_buf.str ();
-
-  parse_error ("%s", msg);
-
-  delete [] msg;
+  output_buf << "\n" << OSSTREAM_ENDS;
+
+  parse_error ("%s", OSSTREAM_C_STR (output_buf));
+
+  OSSTREAM_FREEZE (output_buf);
 }
 
 // Error mesages for mismatched end tokens.
@@ -1702,19 +1699,17 @@
 	{
 	  tree_constant *tc_retval = new tree_constant (tmp);
 
-	  std::ostrstream buf;
+	  OSSTREAM buf;
 
 	  tree_print_code tpc (buf);
 
 	  e->accept (tpc);
 
-	  buf << std::ends;
-
-	  char *s = buf.str ();
-
-	  tc_retval->stash_original_text (s);
-
-	  delete [] s;
+	  buf << OSSTREAM_ENDS;
+
+	  tc_retval->stash_original_text (OSSTREAM_STR (buf));
+
+	  OSSTREAM_FREEZE (buf);
 
 	  delete e;
 
@@ -1749,19 +1744,17 @@
 	{
 	  tree_constant *tc_retval = new tree_constant (tmp);
 
-	  std::ostrstream buf;
+	  OSSTREAM buf;
 
 	  tree_print_code tpc (buf);
 
 	  e->accept (tpc);
 
-	  buf << std::ends;
-
-	  char *s = buf.str ();
-
-	  tc_retval->stash_original_text (s);
-
-	  delete [] s;
+	  buf << OSSTREAM_ENDS;
+
+	  tc_retval->stash_original_text (OSSTREAM_STR (buf));
+
+	  OSSTREAM_FREEZE (buf);
 
 	  delete e;
 
@@ -1805,19 +1798,17 @@
 		{
 		  tree_constant *tc_retval = new tree_constant (tmp);
 
-		  std::ostrstream buf;
+		  OSSTREAM buf;
 
 		  tree_print_code tpc (buf);
 
 		  e->accept (tpc);
 
-		  buf << std::ends;
-
-		  char *s = buf.str ();
-
-		  tc_retval->stash_original_text (s);
-
-		  delete [] s;
+		  buf << OSSTREAM_ENDS;
+
+		  tc_retval->stash_original_text (OSSTREAM_STR (buf));
+
+		  OSSTREAM_FREEZE (buf);
 
 		  delete e;
 
@@ -2724,19 +2715,17 @@
 	{
 	  tree_constant *tc_retval = new tree_constant (tmp);
 
-	  std::ostrstream buf;
+	  OSSTREAM buf;
 
 	  tree_print_code tpc (buf);
 
 	  m->accept (tpc);
 
-	  buf << std::ends;
-
-	  char *s = buf.str ();
-
-	  tc_retval->stash_original_text (s);
-
-	  delete [] s;
+	  buf << OSSTREAM_ENDS;
+
+	  tc_retval->stash_original_text (OSSTREAM_STR (buf));
+
+	  OSSTREAM_FREEZE (buf);
 
 	  delete m;