summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2006-08-23 11:00:22 +0000
committerMatthias Melcher <fltk@matthiasm.com>2006-08-23 11:00:22 +0000
commit17428cce3e9a10cf627eba282cb7b904a20eccf2 (patch)
tree242908eb91195259041727e4e2f4aaf3db887ac8 /fluid
parentae68d64252e068dd1a49be487b40fc19246bfe7e (diff)
- Fluid Code Declarations can now handle C++ style comments (STR #1383)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5343 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fl_Function_Type.cxx14
1 files changed, 9 insertions, 5 deletions
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);
}
}
}