changeset 5334:f9afe97d6d14

[project @ 2005-05-02 18:56:32 by jwe]
author jwe
date Mon, 02 May 2005 18:56:32 +0000
parents ac8d64b9e76a
children a892ee7ac114
files doc/ChangeLog doc/interpreter/munge-texi.cc
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog	Mon May 02 18:16:51 2005 +0000
+++ b/doc/ChangeLog	Mon May 02 18:56:32 2005 +0000
@@ -1,3 +1,8 @@
+2005-05-02  John W. Eaton  <jwe@octave.org>
+
+	* interpreter/munge-texi.cc (skip_comments): New function.
+	(process_doc_file): Use it to skip comments at beginning of file.
+
 2005-04-29  David Bateman  <dbateman@free.fr>
 
 	* interpreter/sparse.txi: Add matrix_type, spkron, and document
--- a/doc/interpreter/munge-texi.cc	Mon May 02 18:16:51 2005 +0000
+++ b/doc/interpreter/munge-texi.cc	Mon May 02 18:56:32 2005 +0000
@@ -74,12 +74,35 @@
 }
 
 static void
+skip_comments (std::ifstream& is)
+{
+  int c;
+
+  bool in_comment = false;
+
+  while ((c = is.get ()) != EOF)
+    {
+      if (c == '#')
+	in_comment = true;
+      else if (c == '\n')
+	in_comment = false;
+      else if (! (in_comment || ::isspace (c)))
+	{
+	  is.putback (c);
+	  break;
+	}
+    }
+}
+
+static void
 process_doc_file (const std::string& fname)
 {
   std::ifstream infile (fname.c_str ());
 
   if (infile)
     {
+      skip_comments (infile);
+
       if (infile.get () != doc_delim)
 	fatal ("invalid doc file format");