From 8a3d3684acd4f13da57e39060ed2a88e625a1d2d Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 11 Jul 2020 18:45:14 +0200 Subject: 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 --- fluid/code.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'fluid/code.cxx') 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 int write_number; int write_sourceview; -- cgit v1.2.3