summaryrefslogtreecommitdiff
path: root/fluid/code.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/code.cxx')
-rw-r--r--fluid/code.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/fluid/code.cxx b/fluid/code.cxx
index f21dc7459..5d2270951 100644
--- a/fluid/code.cxx
+++ b/fluid/code.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: code.cxx,v 1.9.2.1 1999/07/31 08:00:09 bill Exp $"
+// "$Id: code.cxx,v 1.9.2.2 1999/08/05 08:01:39 bill Exp $"
//
// Code output routines for the Fast Light Tool Kit (FLTK).
//
@@ -104,9 +104,9 @@ const char* indent() {
////////////////////////////////////////////////////////////////
// declarations/include files:
-// These are sorted in alphabetical order and only included once each:
-// Relies on '#' being less than any letter to put #include first.
-// I use a binary tree to sort these out.
+// Each string generated by write_declare is written only once to
+// the header file. This is done by keeping a binary tree of all
+// the calls so far and not printing it if it is in the tree.
struct included {
char *text;
@@ -120,7 +120,6 @@ struct included {
included::~included() {
delete left;
- fprintf(header_file,"%s\n",text);
free((void *)text);
delete right;
}
@@ -139,6 +138,7 @@ int write_declare(const char *format, ...) {
else if (i < 0) p = &((*p)->left);
else p = &((*p)->right);
}
+ fprintf(header_file,"%s\n",buf);
*p = new included(buf);
return 1;
}
@@ -278,13 +278,11 @@ int write_code(const char *s, const char *t) {
fprintf(header_file, "#define %s\n", define_name);
}
- Fl_Type *p;
- for (p = Fl_Type::first; p; p = p->next) p->write_declare();
- delete included_root; included_root = 0;
+ write_declare("#include <FL/Fl.H>");
if (t && include_H_from_C)
write_c("#include \"%s\"\n", filename_name(t));
- for (p = Fl_Type::first; p;) {
+ for (Fl_Type* p = Fl_Type::first; p;) {
// write all static data for this & all children first
p->write_static();
for (Fl_Type* q = p->next; q && q->level > p->level; q = q->next)
@@ -293,6 +291,8 @@ int write_code(const char *s, const char *t) {
p = write_code(p);
}
+ delete included_root; included_root = 0;
+
if (!s) return 1;
int x = fclose(code_file);
code_file = 0;
@@ -304,7 +304,6 @@ int write_code(const char *s, const char *t) {
////////////////////////////////////////////////////////////////
-void Fl_Type::write_declare() {}
void Fl_Type::write_static() {}
void Fl_Type::write_code1() {
write_h("// Header for %s\n", title());
@@ -313,5 +312,5 @@ void Fl_Type::write_code1() {
void Fl_Type::write_code2() {}
//
-// End of "$Id: code.cxx,v 1.9.2.1 1999/07/31 08:00:09 bill Exp $".
+// End of "$Id: code.cxx,v 1.9.2.2 1999/08/05 08:01:39 bill Exp $".
//