Skip to content

Commit

Permalink
Patch from Clemens Hintze to allow declaratons of "typedef" to work.
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@954 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
spitzak committed Dec 17, 1999
1 parent e7f42fa commit b101ac2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 42 deletions.
7 changes: 4 additions & 3 deletions fluid/Fl_Function_Type.cxx
@@ -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).
//
Expand Down Expand Up @@ -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_)
Expand Down Expand Up @@ -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 $".
//
5 changes: 3 additions & 2 deletions fluid/Fl_Widget_Type.cxx
@@ -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).
//
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 $".
//
2 changes: 1 addition & 1 deletion fluid/function_panel.cxx
Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions fluid/function_panel.fl
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
32 changes: 0 additions & 32 deletions fluid/function_panel.h
Expand Up @@ -16,67 +16,35 @@ 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>
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;
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

0 comments on commit b101ac2

Please sign in to comment.