Mercurial > hg > octave-lyh
diff doc/interpreter/munge-texi.cc @ 5334:f9afe97d6d14
[project @ 2005-05-02 18:56:32 by jwe]
author | jwe |
---|---|
date | Mon, 02 May 2005 18:56:32 +0000 |
parents | 4c8a2e4e0717 |
children | 93c65f2a5668 |
line wrap: on
line diff
--- a/doc/interpreter/munge-texi.cc +++ b/doc/interpreter/munge-texi.cc @@ -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");