changeset 3575:7576a76f6d7b

[project @ 2000-02-04 11:02:49 by jwe]
author jwe
date Fri, 04 Feb 2000 11:02:51 +0000
parents 787bb9d8f60e
children 168277402d7c
files doc/ChangeLog doc/interpreter/munge-texi.cc scripts/ChangeLog scripts/gethelp.cc src/ChangeLog src/lex.l
diffstat 6 files changed, 51 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog	Fri Feb 04 10:13:26 2000 +0000
+++ b/doc/ChangeLog	Fri Feb 04 11:02:51 2000 +0000
@@ -1,3 +1,7 @@
+2000-02-04  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* interpreter/munge-texi.cc: Sprinkle with std:: qualifier.
+
 2000-01-28  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* interpreter/Makefile.in (clean-texi): Avoid removing octave.texi.
--- a/doc/interpreter/munge-texi.cc	Fri Feb 04 10:13:26 2000 +0000
+++ b/doc/interpreter/munge-texi.cc	Fri Feb 04 11:02:51 2000 +0000
@@ -20,8 +20,8 @@
 
 */
 
-#include <iostream.h>
-#include <fstream.h>
+#include <iostream>
+#include <fstream>
 #include <string>
 #include <cctype>
 
@@ -31,26 +31,26 @@
 
 static const char doc_delim = '';
 
-static CHMap<string> help_text = CHMap<string> (string ());
+static CHMap<std::string> help_text = CHMap<std::string> (std::string ());
 
 static void
-fatal (const string& msg)
+fatal (const std::string& msg)
 {
-  cerr << msg << "\n";
+  std::cerr << msg << "\n";
   exit (1);
 }
 
 static void
 usage (void)
 {
-  cerr << "usage: munge-texi -d DOCSTRING-FILE file ...\n";
+  std::cerr << "usage: munge-texi -d DOCSTRING-FILE file ...\n";
   exit (1);
 }
 
-static string
+static std::string
 extract_symbol_name (istream& is)
 {
-  string symbol_name;
+  std::string symbol_name;
 
   int c;
   while ((c = is.get ()) != EOF && c != '\n')
@@ -59,10 +59,10 @@
   return symbol_name;
 }
 
-static string
-extract_docstring (istream& is)
+static std::string
+extract_docstring (std::istream& is)
 {
-  string doc;
+  std::string doc;
 
   int c;
   while ((c = is.get ()) != EOF && c != doc_delim)
@@ -72,16 +72,16 @@
 }
 
 static void
-process_doc_file (const string& fname)
+process_doc_file (const std::string& fname)
 {
-  ifstream infile (fname.c_str ());
+  std::ifstream infile (fname.c_str ());
 
   if (infile)
     {
       if (infile.get () != doc_delim)
 	fatal ("invalid doc file format");
 
-      string symbol_name;
+      std::string symbol_name;
 
       do
 	{
@@ -89,10 +89,11 @@
 
 	  if (! symbol_name.empty ())
 	    {
-	      string doc_string = extract_docstring (infile);
+	      std::string doc_string = extract_docstring (infile);
 
 	      if (help_text.contains (symbol_name))
-		cerr << "ignoring duplicate entry for " << symbol_name << "\n";
+		std::cerr << "ignoring duplicate entry for "
+			  << symbol_name << "\n";
 	      else
 		help_text[symbol_name] = doc_string;
 	    }
@@ -104,7 +105,7 @@
 }
 
 static void
-process_texi_input_file (istream& is, ostream& os)
+process_texi_input_file (std::istream& is, std::ostream& os)
 {
   os << "@c DO NOT EDIT!  Generated automatically by munge-texi.\n\n";
 
@@ -117,7 +118,7 @@
 	{
 	  if (c == '@')
 	    {
-	      string symbol_name;
+	      std::string symbol_name;
 
 	      char buf[16];
 	      int i = 0;
@@ -141,7 +142,7 @@
 		    fatal ("end of file while reading @DOCSTRING command");
 		  else
 		    {
-		      string doc_string = help_text[symbol_name];
+		      std::string doc_string = help_text[symbol_name];
 
 		      int i = 0;
 		      while (doc_string[i] == ' ')
@@ -204,7 +205,7 @@
 	break;
     }
 
-  process_texi_input_file (cin, cout);
+  process_texi_input_file (std::cin, std::cout);
 
   return 0;
 }
--- a/scripts/ChangeLog	Fri Feb 04 10:13:26 2000 +0000
+++ b/scripts/ChangeLog	Fri Feb 04 11:02:51 2000 +0000
@@ -1,3 +1,7 @@
+2000-02-04  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* gethelp.cc: Sprinkle with std:: qualifier.
+
 2000-01-30  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* image/saveimage.m: Delete some debugging code.
--- a/scripts/gethelp.cc	Fri Feb 04 10:13:26 2000 +0000
+++ b/scripts/gethelp.cc	Fri Feb 04 11:02:51 2000 +0000
@@ -1,16 +1,16 @@
 #include <string>
-#include <iostream.h>
+#include <iostream>
 
 #ifndef NPOS
-#define NPOS string::npos
+#define NPOS std::string::npos
 #endif
 
 static bool
-looks_like_octave_copyright (const string& s)
+looks_like_octave_copyright (const std::string& s)
 {
   bool retval = false;
 
-  string t = s.substr (0, 14);
+  std::string t = s.substr (0, 14);
 
   if (t == "Copyright (C) ")
     {
@@ -39,10 +39,10 @@
 // Eat whitespace and comments from FFILE, returning the text of the
 // first block of comments that doesn't look like a copyright notice,
 
-static string
+static std::string
 extract_help_text (void)
 {
-  string help_txt;
+  std::string help_txt;
 
   bool first_comments_seen = false;
   bool begin_comment = false;
@@ -51,7 +51,7 @@
   bool discard_space = true;
   int c;
 
-  while ((c = cin.get ()) != EOF)
+  while ((c = std::cin.get ()) != EOF)
     {
       if (begin_comment)
 	{
@@ -79,7 +79,7 @@
 	      in_comment = false;
 	      discard_space = true;
 
-	      if ((c = cin.get ()) != EOF)
+	      if ((c = std::cin.get ()) != EOF)
 		{
 		  if (c == '\n')
 		    break;
@@ -132,17 +132,17 @@
 int
 main (int argc, char **argv)
 {
-  string name;
+  std::string name;
 
   if (argc != 2)
     {
-      cerr << "usage: gethelp name\n";
+      std::cerr << "usage: gethelp name\n";
       return 1;
     }
   else
     name = argv[1];
 
-  string help_text = extract_help_text ();  
+  std::string help_text = extract_help_text ();  
 
   if (! help_text.empty ())
     {
--- a/src/ChangeLog	Fri Feb 04 10:13:26 2000 +0000
+++ b/src/ChangeLog	Fri Feb 04 11:02:51 2000 +0000
@@ -1,5 +1,8 @@
 2000-02-04  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* lex.l (is_plot_keyword): Add minimum match length in call to
+	almost_match.
+
 	* Makefile.in (%.df : %.cc): Don't pass -c to compiler.
 
 2000-02-03  John W. Eaton  <jwe@bevo.che.wisc.edu>
--- a/src/lex.l	Fri Feb 04 10:13:26 2000 +0000
+++ b/src/lex.l	Fri Feb 04 11:02:51 2000 +0000
@@ -855,6 +855,7 @@
 {
   std::string retval;
 
+  // XXX FIXME XXX -- specify minimum match length for these.
   static const char *plot_styles[] = 
     {
       "boxes",
@@ -901,6 +902,7 @@
 {
   std::string retval;
 
+  // XXX FIXME XXX -- specify minimum match length for these.
   static const char *plot_axes[] = 
     {
       "x1y1",
@@ -934,21 +936,21 @@
 is_plot_keyword (const std::string& s)
 {
   const char *t = s.c_str ();
-  if (almost_match ("title", t))
+  if (almost_match ("title", t, 1))
     {
       return TITLE;
     }
-  else if (almost_match ("using", t))
+  else if (almost_match ("using", t, 1))
     {
       lexer_flags.in_plot_using = true;
       return USING;
     }
-  else if (almost_match ("with", t))
+  else if (almost_match ("with", t, 1))
     {
       lexer_flags.in_plot_style = true;
       return WITH;
     }
-  else if (almost_match ("axes", t) || almost_match ("axis", t))
+  else if (almost_match ("axes", t, 2) || almost_match ("axis", t, 2))
     {
       lexer_flags.in_plot_axes = true;
       return AXES;
@@ -1568,7 +1570,7 @@
   lexer_flags.convert_spaces_to_comma = 1;
 
   if (lexer_flags.plotting && ! lexer_flags.in_plot_range)
-    lexer_flags.past_plot_range = 1;
+    lexer_flags.past_plot_range = true;
 
   yylval.tok_val = new token (value, yytext, input_line_number,
 			      current_input_column);
@@ -2047,7 +2049,7 @@
 
       if (nesting_level.none ())
 	plot_option_kw = is_plot_keyword (tok);
-
+      
       if (lexer_flags.cant_be_identifier && plot_option_kw)
 	TOK_RETURN (plot_option_kw);
     }