- 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
This commit is contained in:
Matthias Melcher 2006-08-23 11:00:22 +00:00
parent ae68d64252
commit 17428cce3e
2 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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);
}
}
}