diff options
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 14 |
2 files changed, 11 insertions, 5 deletions
@@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.8 + - Fluid Code Declarations can now handle + C++ style comments (STR #1383) - Fixed uninitialized data in OS X and WIN32 timout functions (STR #1374). - Fixed speed issues when measuring text on OS X diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 4805f0a68..d993b248f 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -607,23 +607,27 @@ void Fl_Decl_Type::write_code1() { write_c("%s\n", c); return; } + // find the first C++ style comment + const char* e = c+strlen(c), *csc = c; + while (csc<e && (csc[0]!='/' || csc[1]!='/')) csc++; + if (csc!=e) e = csc; // comment found // lose all trailing semicolons so I can add one: - const char* e = c+strlen(c); + while (e>c && e[-1]==' ') e--; while (e>c && e[-1]==';') e--; if (class_name(1)) { write_public(public_); - write_h(" %.*s;\n", (int)(e-c), c); + write_h(" %.*s; %s\n", (int)(e-c), c, csc); } else { if (public_) { if (static_) write_h("extern "); - write_h("%.*s;\n", (int)(e-c), c); + write_h("%.*s; %s\n", (int)(e-c), c, csc); if (static_) - write_c("%.*s;\n", (int)(e-c), c); + write_c("%.*s; %s\n", (int)(e-c), c, csc); } else { if (static_) write_c("static "); - write_c("%.*s;\n", (int)(e-c), c); + write_c("%.*s; %s\n", (int)(e-c), c, csc); } } } |
