summaryrefslogtreecommitdiff
path: root/fluid/code.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2006-07-27 19:26:11 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2006-07-27 19:26:11 +0000
commitd9eecaf4ab21a39b37eaf5f13bba523a61559781 (patch)
tree48943f84e5cc65aa86331df002cb2af986fd870d /fluid/code.cxx
parent0043e7a44daa1b910d82d37a20c23b2b11245ed3 (diff)
Fix problems with new FLUID output, add common to closing braces to show
what widget is being closed, and bump the version number to 1.1.8 in the repo... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5271 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/code.cxx')
-rw-r--r--fluid/code.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/fluid/code.cxx b/fluid/code.cxx
index 597f77ef3..df23e3a75 100644
--- a/fluid/code.cxx
+++ b/fluid/code.cxx
@@ -153,8 +153,18 @@ int write_declare(const char *format, ...) {
////////////////////////////////////////////////////////////////
+// silly thing to prevent declaring unused variables:
+// When this symbol is on, all attempts to write code don't write
+// anything, but set a variable if it looks like the variable "o" is used:
+int varused_test;
+int varused;
+
// write an array of C characters (adds a null):
void write_cstring(const char *w, int length) {
+ if (varused_test) {
+ varused = 1;
+ return;
+ }
const char *e = w+length;
int linelength = 1;
putc('\"', code_file);
@@ -221,6 +231,10 @@ void write_cstring(const char *w) {write_cstring(w,strlen(w));}
// write an array of C binary data (does not add a null):
void write_cdata(const char *s, int length) {
+ if (varused_test) {
+ varused = 1;
+ return;
+ }
const unsigned char *w = (const unsigned char *)s;
const unsigned char *e = w+length;
int linelength = 1;
@@ -238,6 +252,10 @@ void write_cdata(const char *s, int length) {
}
void write_c(const char* format,...) {
+ if (varused_test) {
+ varused = 1;
+ return;
+ }
va_list args;
va_start(args, format);
vfprintf(code_file, format, args);
@@ -245,6 +263,7 @@ void write_c(const char* format,...) {
}
void write_h(const char* format,...) {
+ if (varused_test) return;
va_list args;
va_start(args, format);
vfprintf(header_file, format, args);