diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2000-04-25 01:57:51 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2000-04-25 01:57:51 +0000 |
| commit | 9e3610c75f8ceeebb8e59db2c641f21082979856 (patch) | |
| tree | 4f482a4bc220c777ce509774d4737f3534ed41bf | |
| parent | aa102a4595e162cd0568746809cd6e18fbe20cfc (diff) | |
Bug fixes where I was getting the value from the input field instead of
the global pointer (caused random crashes.)
Now default to no file variable for catgets() mode, and declare and
initialize (as needed) a static _catalog variable when a global file
variable is not provided. The catalog name is the basename of the
fluid file (no .fl)...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1084 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 16 | ||||
| -rw-r--r-- | fluid/Fl_Menu_Type.cxx | 7 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 7 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 6 | ||||
| -rw-r--r-- | fluid/code.cxx | 22 | ||||
| -rw-r--r-- | fluid/file.cxx | 6 | ||||
| -rw-r--r-- | fluid/fluid.cxx | 7 |
7 files changed, 45 insertions, 26 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 290f7389b..c757d197b 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Function_Type.cxx,v 1.15.2.12 2000/02/05 09:20:44 bill Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.13 2000/04/25 01:57:48 mike Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -30,6 +30,13 @@ #include <stdio.h> #include <ctype.h> +extern int i18n_type; +extern const char* i18n_include; +extern const char* i18n_function; +extern const char* i18n_file; +extern const char* i18n_set; +extern char i18n_program[]; + //////////////////////////////////////////////////////////////// // quick check of any C code for legality, returns an error message @@ -262,6 +269,11 @@ void Fl_Function_Type::write_code1() { } if (havewidgets) write_c(" %s* w;\n",subclassname(child)); indentation += 2; + + if (i18n_type == 2 && !i18n_file[0]) + // Initialize _catalog as needed... + write_c(" if (_catalog == (nl_catd)-1) _catalog = catopen(\"%s\", 0);\n", + i18n_program); } void Fl_Function_Type::write_code2() { @@ -665,5 +677,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.12 2000/02/05 09:20:44 bill Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.13 2000/04/25 01:57:48 mike Exp $". // diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index f3bfa8ab4..eb34a55c4 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu_Type.cxx,v 1.16.2.6 2000/04/24 18:22:47 mike Exp $" +// "$Id: Fl_Menu_Type.cxx,v 1.16.2.7 2000/04/25 01:57:49 mike Exp $" // // Menu item code for the Fast Light Tool Kit (FLTK). // @@ -227,7 +227,8 @@ void Fl_Menu_Item_Type::write_item() { write_c(")"); break; case 2 : /* POSIX catgets */ - write_c("catgets(%s,%s,%d,", i18n_file, i18n_set, msgnum ++); + write_c("catgets(%s,%s,%d,", i18n_file[0] ? i18n_file : "_catalog", + i18n_set, msgnum ++); write_cstring(label()); write_c(")"); break; @@ -462,5 +463,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) { } // -// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.6 2000/04/24 18:22:47 mike Exp $". +// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.7 2000/04/25 01:57:49 mike Exp $". // diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 6ffcb8d70..b6cef1c73 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget_Type.cxx,v 1.15.2.11 2000/04/24 18:22:48 mike Exp $" +// "$Id: Fl_Widget_Type.cxx,v 1.15.2.12 2000/04/25 01:57:49 mike Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -1350,7 +1350,8 @@ void Fl_Widget_Type::write_code1() { write_c(")"); break; case 2 : /* POSIX catgets */ - write_c("catgets(%s,%s,%d,", i18n_file, i18n_set, msgnum ++); + write_c("catgets(%s,%s,%d,", i18n_file[0] ? i18n_file : "_catalog", + i18n_set, msgnum ++); write_cstring(label()); write_c(")"); break; @@ -1768,5 +1769,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { } // -// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.11 2000/04/24 18:22:48 mike Exp $". +// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.12 2000/04/25 01:57:49 mike Exp $". // diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 0b4a6e0aa..59637e3db 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window_Type.cxx,v 1.13.2.5 2000/04/25 01:12:48 mike Exp $" +// "$Id: Fl_Window_Type.cxx,v 1.13.2.6 2000/04/25 01:57:50 mike Exp $" // // Window type code for the Fast Light Tool Kit (FLTK). // @@ -81,7 +81,7 @@ void i18n_type_cb(Fl_Choice *c, void *) { break; case 2 : /* POSIX cat */ i18n_include_input->value("<nl_types.h>"); - i18n_file_input->value("i18n_file"); + i18n_file_input->value(""); i18n_file = i18n_file_input->value(); i18n_set_input->value("1"); i18n_set = i18n_set_input->value(); @@ -752,5 +752,5 @@ int Fl_Window_Type::read_fdesign(const char* name, const char* value) { } // -// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.5 2000/04/25 01:12:48 mike Exp $". +// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.6 2000/04/25 01:57:50 mike Exp $". // diff --git a/fluid/code.cxx b/fluid/code.cxx index d1ffcde91..fbed3ab3a 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -1,5 +1,5 @@ // -// "$Id: code.cxx,v 1.9.2.4 2000/04/24 18:22:50 mike Exp $" +// "$Id: code.cxx,v 1.9.2.5 2000/04/25 01:57:51 mike Exp $" // // Code output routines for the Fast Light Tool Kit (FLTK). // @@ -285,14 +285,16 @@ int write_code(const char *s, const char *t) { } write_declare("#include <FL/Fl.H>"); - if (i18n_type && i18n_include_input->value()[0]) { - if (i18n_include_input->value()[0] != '<' && - i18n_include_input->value()[0] != '\"') - write_c("#include \"%s\"\n", i18n_include_input->value()); + if (i18n_type && i18n_include[0]) { + if (i18n_include[0] != '<' && + i18n_include[0] != '\"') + write_c("#include \"%s\"\n", i18n_include); else - write_c("#include %s\n", i18n_include_input->value()); - if (i18n_type == 2) - write_c("extern nl_catd %s;\n", i18n_file_input->value()); + write_c("#include %s\n", i18n_include); + if (i18n_type == 2) { + if (i18n_file[0]) write_c("extern nl_catd %s;\n", i18n_file); + else write_c("static nl_catd _catalog = (nl_catd)-1;\n"); + } } if (t && include_H_from_C) write_c("#include \"%s\"\n", filename_name(t)); @@ -367,7 +369,7 @@ int write_strings(const char *sfile) { msgnum = 1; fprintf(fp, "$ generated by Fast Light User Interface Designer (fluid) version %.4f\n", FL_VERSION); - fprintf(fp, "$set %s\n", i18n_set_input->value()); + fprintf(fp, "$set %s\n", i18n_set); fputs("$quote \"\n", fp); for (p = Fl_Type::first; p; p = p->next) { @@ -397,5 +399,5 @@ void Fl_Type::write_code1() { void Fl_Type::write_code2() {} // -// End of "$Id: code.cxx,v 1.9.2.4 2000/04/24 18:22:50 mike Exp $". +// End of "$Id: code.cxx,v 1.9.2.5 2000/04/25 01:57:51 mike Exp $". // diff --git a/fluid/file.cxx b/fluid/file.cxx index 3e0253d20..e66a0bad7 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -1,5 +1,5 @@ // -// "$Id: file.cxx,v 1.7.2.2 2000/04/24 18:22:50 mike Exp $" +// "$Id: file.cxx,v 1.7.2.3 2000/04/25 01:57:51 mike Exp $" // // Fluid file routines for the Fast Light Tool Kit (FLTK). // @@ -336,7 +336,7 @@ int write_file(const char *filename, int selected_only) { write_string("\ni18n_function %s", i18n_function); break; case 2 : /* POSIX catgets */ - write_string("\ni18n_file %s", i18n_file); + if (i18n_file[0]) write_string("\ni18n_file %s", i18n_file); write_string("\ni18n_set %s", i18n_set); break; } @@ -639,5 +639,5 @@ void read_fdesign() { } // -// End of "$Id: file.cxx,v 1.7.2.2 2000/04/24 18:22:50 mike Exp $". +// End of "$Id: file.cxx,v 1.7.2.3 2000/04/25 01:57:51 mike Exp $". // diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 6ef06bae0..e1e331945 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1,5 +1,5 @@ // -// "$Id: fluid.cxx,v 1.15.2.4 2000/04/24 18:22:50 mike Exp $" +// "$Id: fluid.cxx,v 1.15.2.5 2000/04/25 01:57:51 mike Exp $" // // FLUID main entry for the Fast Light Tool Kit (FLTK). // @@ -168,6 +168,7 @@ const char* i18n_include = ""; const char* i18n_function = ""; const char* i18n_file = ""; const char* i18n_set = ""; +char i18n_program[1024] = ""; void write_cb(Fl_Widget *, void *) { if (!filename) { @@ -176,6 +177,8 @@ void write_cb(Fl_Widget *, void *) { } char cname[1024]; char hname[1024]; + strcpy(i18n_program, filename_name(filename)); + filename_setext(i18n_program, ""); if (*code_file_name == '.') { strcpy(cname,filename_name(filename)); filename_setext(cname, code_file_name); @@ -457,5 +460,5 @@ int main(int argc,char **argv) { } // -// End of "$Id: fluid.cxx,v 1.15.2.4 2000/04/24 18:22:50 mike Exp $". +// End of "$Id: fluid.cxx,v 1.15.2.5 2000/04/25 01:57:51 mike Exp $". // |
