diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1999-02-19 14:53:04 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1999-02-19 14:53:04 +0000 |
| commit | 3702edc89dddcbc63166a543c3ae24ffceebdaaf (patch) | |
| tree | a3512d1fd0ba83cf8acad7b004d43825f051b2c8 /fluid/Fl_Function_Type.cxx | |
| parent | 9b0162e21250da6421cc116d404cd297e13a4e47 (diff) | |
Added comment parsing in _c_check().
git-svn-id: file:///fltk/svn/fltk/trunk@304 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Function_Type.cxx')
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index dac17f78a..3b19bdb64 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Function_Type.cxx,v 1.14 1999/02/19 14:33:22 mike Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15 1999/02/19 14:53:04 mike Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -32,7 +32,6 @@ //////////////////////////////////////////////////////////////// // quick check of any C code for legality, returns an error message -// these currently require comments to parse correctly! static char buffer[128]; // for error messages @@ -58,15 +57,36 @@ const char *_c_check(const char * & c, int type) { if (!type) return 0; sprintf(buffer, "missing %c", type); return buffer; + case '/': + // Skip comments as needed... + if (*c == '/') { + while (*c != '\n' && *c) c++; + } else if (*c == '*') { + c++; + while ((*c != '*' || c[1] != '/') && *c) c++; + if (*c == '*') c+=2; + else { + return "unterminated /* ... */ comment"; + } + } + break; case '{': if (type==')') goto UNEXPECTED; - d = _c_check(c,'}'); if (d) return d; break; + d = _c_check(c,'}'); + if (d) return d; + break; case '(': - d = _c_check(c,')'); if (d) return d; break; + d = _c_check(c,')'); + if (d) return d; + break; case '\"': - d = _q_check(c,'\"'); if (d) return d; break; + d = _q_check(c,'\"'); + if (d) return d; + break; case '\'': - d = _q_check(c,'\''); if (d) return d; break; + d = _q_check(c,'\''); + if (d) return d; + break; case '}': case ')': case '#': @@ -709,5 +729,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.14 1999/02/19 14:33:22 mike Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15 1999/02/19 14:53:04 mike Exp $". // |
