Mercurial > hg > octave-nkf
diff src/variables.cc @ 2300:9484969866d2
[project @ 1996-06-24 07:13:26 by jwe]
author | jwe |
---|---|
date | Mon, 24 Jun 1996 07:15:11 +0000 |
parents | 46839fa1fcf3 |
children | c2c1482c34c8 |
line wrap: on
line diff
--- a/src/variables.cc +++ b/src/variables.cc @@ -411,25 +411,37 @@ // IN_PARTS, consider each block of comments separately; otherwise, // grab them all at once. +// XXX FIXME XXX -- grab_help_text() in lex.l duplicates some of this +// code! + static string gobble_leading_white_space (FILE *ffile, int in_parts) { string help_txt; - int first_comments_seen = 0; - int have_help_text = 0; - int in_comment = 0; + bool first_comments_seen = false; + bool begin_comment = false; + bool have_help_text = false; + bool in_comment = false; int c; while ((c = getc (ffile)) != EOF) { current_input_column++; + if (begin_comment) + { + if (c == '%' || c == '#') + continue; + else + begin_comment = false; + } + if (in_comment) { if (! have_help_text) { - first_comments_seen = 1; + first_comments_seen = true; help_txt += (char) c; } @@ -437,7 +449,7 @@ { input_line_number++; current_input_column = 0; - in_comment = 0; + in_comment = false; if (in_parts) { @@ -460,19 +472,20 @@ case ' ': case '\t': if (first_comments_seen) - have_help_text = 1; + have_help_text = true; break; case '\n': if (first_comments_seen) - have_help_text = 1; + have_help_text = true; input_line_number++; current_input_column = 0; continue; case '%': case '#': - in_comment = 1; + begin_comment = true; + in_comment = true; break; default: