From 17428cce3e9a10cf627eba282cb7b904a20eccf2 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 23 Aug 2006 11:00:22 +0000 Subject: - 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 --- CHANGES | 2 ++ fluid/Fl_Function_Type.cxx | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 9b8db58ee..7057fc1cc 100644 --- a/CHANGES +++ b/CHANGES @@ -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 (cscc && 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); } } } -- cgit v1.2.3