# HG changeset patch # User jwe # Date 1115060192 0 # Node ID f9afe97d6d1444710b2561aee4ee1a1215fce09a # Parent ac8d64b9e76a9c4167653f69eb03ff1ef7618967 [project @ 2005-05-02 18:56:32 by jwe] diff -r ac8d64b9e76a -r f9afe97d6d14 doc/ChangeLog --- 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 + + * 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 * interpreter/sparse.txi: Add matrix_type, spkron, and document diff -r ac8d64b9e76a -r f9afe97d6d14 doc/interpreter/munge-texi.cc --- 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");