Patch from Clemens Hintze to allow declaratons of "typedef" to work.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@954 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 1999-12-17 18:35:00 +00:00
parent e7f42fa15f
commit b101ac281d
5 changed files with 13 additions and 42 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Function_Type.cxx,v 1.15.2.9 1999/08/17 05:33:12 bill Exp $"
// "$Id: Fl_Function_Type.cxx,v 1.15.2.10 1999/12/17 18:34:55 bill Exp $"
//
// C function type code for the Fast Light Tool Kit (FLTK).
//
@ -449,10 +449,11 @@ Fl_Decl_Type Fl_Decl_type;
void Fl_Decl_Type::write_code1() {
const char* c = name();
if (!c) return;
// handle putting #include or extern into decl:
// handle putting #include or extern or typedef into decl:
if (!isalpha(*c) && *c != '~'
|| !strncmp(c,"extern",6) && isspace(c[6])
|| !strncmp(c,"class",5) && isspace(c[5])
|| !strncmp(c,"typedef",7) && isspace(c[7])
// || !strncmp(c,"struct",6) && isspace(c[6])
) {
if (public_)
@ -660,5 +661,5 @@ void Fl_Class_Type::write_code2() {
}
//
// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.9 1999/08/17 05:33:12 bill Exp $".
// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.10 1999/12/17 18:34:55 bill Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.7 1999/09/08 06:05:00 bill Exp $"
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.8 1999/12/17 18:34:56 bill Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
@ -1219,6 +1219,7 @@ int isdeclare(const char *c) {
while (isspace(*c)) c++;
if (*c == '#') return 1;
if (!strncmp(c,"extern",6)) return 1;
if (!strncmp(c,"typedef",7)) return 1;
return 0;
}
@ -1745,5 +1746,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
}
//
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.7 1999/09/08 06:05:00 bill Exp $".
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.8 1999/12/17 18:34:56 bill Exp $".
//

View File

@ -181,7 +181,7 @@ Fl_Window* make_decl_panel() {
}
{ Fl_Input* o = decl_input = new Fl_Input(10, 50, 270, 25, "can be any declartion, like \"int x;\",\nan external symbol like \"extern int\
foo();\",\na #directive like \"#include <foo.h>\",\nor a comment like \"//foo\
\" or \"/*foo*/\"");
\" or \"/*foo*/\",\nor typedef like \"typedef char byte;\"");
o->labelsize(12);
o->align(FL_ALIGN_BOTTOM_LEFT);
o->when(FL_WHEN_NEVER);

View File

@ -9,14 +9,14 @@ Function {make_function_panel()} {open
} {
Fl_Window function_panel {
label {function/method} open
xywh {975 642 287 173} resizable modal visible
xywh {774 432 287 173} hide resizable modal
} {
Fl_Light_Button f_public_button {
label public
xywh {10 15 65 25} labelsize 10 when 0
}
Fl_Light_Button f_c_button {
label {C declaration} selected
label {C declaration}
xywh {90 15 90 25} labelsize 10
}
Fl_Input f_name_input {
@ -116,7 +116,7 @@ Function {make_decl_panel()} {open
} {
Fl_Window decl_panel {
label declaration open
xywh {282 823 290 176} hide resizable
xywh {282 823 290 176} resizable visible
} {
Fl_Light_Button decl_public_button {
label public
@ -126,7 +126,8 @@ Function {make_decl_panel()} {open
label {can be any declartion, like "int x;",
an external symbol like "extern int foo();",
a \#directive like "\#include <foo.h>",
or a comment like "//foo" or "/*foo*/"}
or a comment like "//foo" or "/*foo*/",
or typedef like "typedef char byte;"}
xywh {10 50 270 25} labelsize 12 align 6 when 0 resizable
}
Fl_Return_Button decl_panel_ok {

View File

@ -16,22 +16,11 @@ extern Fl_Return_Button *f_panel_ok;
#include <FL/Fl_Button.H>
extern Fl_Button *f_panel_cancel;
Fl_Window* make_function_panel();
extern Fl_Window *function_panel;
extern Fl_Light_Button *f_public_button;
extern Fl_Light_Button *f_c_button;
extern Fl_Input *f_name_input;
extern Fl_Input *f_return_type_input;
extern Fl_Return_Button *f_panel_ok;
extern Fl_Button *f_panel_cancel;
extern Fl_Window *code_panel;
extern Fl_Input *code_input;
extern Fl_Return_Button *code_panel_ok;
extern Fl_Button *code_panel_cancel;
Fl_Window* make_code_panel();
extern Fl_Window *code_panel;
extern Fl_Input *code_input;
extern Fl_Return_Button *code_panel_ok;
extern Fl_Button *code_panel_cancel;
extern Fl_Window *codeblock_panel;
extern Fl_Input *code_before_input;
#include <FL/Fl_Box.H>
@ -39,33 +28,18 @@ extern Fl_Input *code_after_input;
extern Fl_Return_Button *codeblock_panel_ok;
extern Fl_Button *codeblock_panel_cancel;
Fl_Window* make_codeblock_panel();
extern Fl_Window *codeblock_panel;
extern Fl_Input *code_before_input;
extern Fl_Input *code_after_input;
extern Fl_Return_Button *codeblock_panel_ok;
extern Fl_Button *codeblock_panel_cancel;
extern Fl_Window *declblock_panel;
extern Fl_Input *decl_before_input;
extern Fl_Input *decl_after_input;
extern Fl_Return_Button *declblock_panel_ok;
extern Fl_Button *declblock_panel_cancel;
Fl_Window* make_declblock_panel();
extern Fl_Window *declblock_panel;
extern Fl_Input *decl_before_input;
extern Fl_Input *decl_after_input;
extern Fl_Return_Button *declblock_panel_ok;
extern Fl_Button *declblock_panel_cancel;
extern Fl_Window *decl_panel;
extern Fl_Light_Button *decl_public_button;
extern Fl_Input *decl_input;
extern Fl_Return_Button *decl_panel_ok;
extern Fl_Button *decl_panel_cancel;
Fl_Window* make_decl_panel();
extern Fl_Window *decl_panel;
extern Fl_Light_Button *decl_public_button;
extern Fl_Input *decl_input;
extern Fl_Return_Button *decl_panel_ok;
extern Fl_Button *decl_panel_cancel;
extern Fl_Window *class_panel;
extern Fl_Light_Button *c_public_button;
extern Fl_Input *c_name_input;
@ -73,10 +47,4 @@ extern Fl_Input *c_subclass_input;
extern Fl_Return_Button *c_panel_ok;
extern Fl_Button *c_panel_cancel;
Fl_Window* make_class_panel();
extern Fl_Window *class_panel;
extern Fl_Light_Button *c_public_button;
extern Fl_Input *c_name_input;
extern Fl_Input *c_subclass_input;
extern Fl_Return_Button *c_panel_ok;
extern Fl_Button *c_panel_cancel;
#endif