diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-11 18:45:14 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-11 18:48:42 +0200 |
| commit | 8a3d3684acd4f13da57e39060ed2a88e625a1d2d (patch) | |
| tree | efe816b88b3767f7d3aa07f72b99bf33db88dde9 /fluid/code.cxx | |
| parent | e5fbfcbec1fb06dc29393a70594317904610a426 (diff) | |
Fluid: fix "trailing whitespace" errors (#100)
Fluid would write trailing whitespace at some points when generating
.cxx and .h files from .fl files.
This was an old issue but became obvious since we removed trailing
whitespace from source and header files recently.
This commit fixes all whitespace errors in files generated from .fl
files in the FLTK repository, i.e. in fluid/, src/, and test/ folders.
I can't guarantee that I found all possible whitespace errors, but
this commit:
Fixes #100
Diffstat (limited to 'fluid/code.cxx')
| -rw-r--r-- | fluid/code.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fluid/code.cxx b/fluid/code.cxx index b782ee35f..7b156f57e 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -283,6 +283,14 @@ void write_c(const char* format,...) { va_end(args); } +// write code (c) of size (n) to C file, with optional comment (com) w/o trailing space +void write_cc(const char *indent, int n, const char *c, const char *com) { + if (*com) + write_c("%s%.*s; %s\n", indent, n, c, com); + else + write_c("%s%.*s;\n", indent, n, c); +} + void write_h(const char* format,...) { if (varused_test) return; va_list args; @@ -291,6 +299,14 @@ void write_h(const char* format,...) { va_end(args); } +// write code (c) of size (n) to H file, with optional comment (com) w/o trailing space +void write_hc(const char *indent, int n, const char* c, const char *com) { + if (*com) + write_h("%s%.*s; %s\n", indent, n, c, com); + else + write_h("%s%.*s;\n", indent, n, c); +} + #include <FL/filename.H> int write_number; int write_sourceview; |
