|
commit 0d435d51aca65f76702369a1a7d389ee0e31e1e2
Author: Matthias Melcher <git@matthiasm.com>
AuthorDate: Mon Dec 20 01:19:00 2021 +0100
Commit: Matthias Melcher <github@matthiasm.com>
CommitDate: Mon Dec 20 01:23:59 2021 +0100
GitHub #328: removed stray ';' in Fluid code generation.
fluid/Fl_Function_Type.cxx | 3 +--
fluid/code.cxx | 24 ++++++++++++++++++------
src/Fl_File_Chooser.fl | 4 ++--
src/Fl_Help_Dialog.fl | 5 ++---
4 files changed, 23 insertions(+), 13 deletions(-)
diff --git fluid/Fl_Function_Type.cxx fluid/Fl_Function_Type.cxx
index ab3672e..a4ab673 100644
--- fluid/Fl_Function_Type.cxx
+++ fluid/Fl_Function_Type.cxx
@@ -994,9 +994,8 @@ void Fl_Decl_Type::write_code1() {
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:
+ // lose spaces between text and comment, if any
while (e>c && e[-1]==' ') e--;
- while (e>c && e[-1]==';') e--;
if (class_name(1)) {
write_public(public_);
write_comment_h(indent(1));
diff --git fluid/code.cxx fluid/code.cxx
index d6b4bdc..da40970 100644
--- fluid/code.cxx
+++ fluid/code.cxx
@@ -384,12 +384,20 @@ void write_c(const char* format,...) {
/**
Write code (c) of size (n) to C file, with optional comment (com) w/o trailing space.
+ if the code line does not end in a ';' or '}', a ';' will be added.
+ \param[in] indent indentation string for all lines
+ \param[in] n number of bytes in code line
+ \param[in] c line of code
+ \param[in] com optional commentary
*/
void write_cc(const char *indent, int n, const char *c, const char *com) {
+ write_c("%s%.*s", indent, n, c);
+ char cc = c[n-1];
+ if (cc!='}' && cc!=';')
+ write_c(";");
if (*com)
- write_c("%s%.*s; %s\n", indent, n, c, com);
- else
- write_c("%s%.*s;\n", indent, n, c);
+ write_c(" %s", com);
+ write_c("\n");
}
/**
@@ -406,16 +414,20 @@ void write_h(const char* format,...) {
/**
Write code (c) of size (n) to H file, with optional comment (com) w/o trailing space.
+ if the code line does not end in a ';' or '}', a ';' will be added.
\param[in] indent indentation string for all lines
\param[in] n number of bytes in code line
\param[in] c line of code
\param[in] com optional commentary
*/
void write_hc(const char *indent, int n, const char* c, const char *com) {
+ write_h("%s%.*s", indent, n, c);
+ char cc = c[n-1];
+ if (cc!='}' && cc!=';')
+ write_h(";");
if (*com)
- write_h("%s%.*s; %s\n", indent, n, c, com);
- else
- write_h("%s%.*s;\n", indent, n, c);
+ write_h(" %s", com);
+ write_h("\n");
}
/**
diff --git src/Fl_File_Chooser.fl src/Fl_File_Chooser.fl
index 7bffa64..1dcf365 100644
--- src/Fl_File_Chooser.fl
+++ src/Fl_File_Chooser.fl
@@ -54,7 +54,7 @@ class FL_EXPORT Fl_File_Chooser {open
}
decl {void fileListCB();} {private local
}
- decl {void fileNameCB();} {private local
+ decl {void fileNameCB();} {selected private local
}
decl {void newdir();} {private local
}
@@ -77,7 +77,7 @@ class FL_EXPORT Fl_File_Chooser {open
callback {fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
-window->hide();} open selected
+window->hide();} open
private xywh {1171 438 490 380} type Double hide resizable
code0 {if (title) window->label(title);} modal
} {
diff --git src/Fl_Help_Dialog.fl src/Fl_Help_Dialog.fl
index 6aeb12e..ba61419 100644
--- src/Fl_Help_Dialog.fl
+++ src/Fl_Help_Dialog.fl
@@ -192,8 +192,7 @@ fl_register_images();} {}
code {view_->set_changed();
int ret = view_->load(f);
window_->label(view_->title());
-return ret;} {selected
- }
+return ret;} {}
}
Function {position(int xx, int yy)} {return_type void
} {
@@ -233,7 +232,7 @@ else
} {
code {view_->topline(n);} {}
}
- Function {topline(int n)} {return_type void
+ Function {topline(int n)} {selected return_type void
} {
code {view_->topline(n);} {}
}
[ Direct Link to Message ] | |