summaryrefslogtreecommitdiff
path: root/fluid/Fl_Function_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2006-05-18 14:40:10 +0000
committerMatthias Melcher <fltk@matthiasm.com>2006-05-18 14:40:10 +0000
commit92d0163f407e89db078d58fb51b017458be6e412 (patch)
tree9c5d5dc17ad9821453a0457d3da608378239835e /fluid/Fl_Function_Type.cxx
parentb0c7fc3ab72bf06f54dc917d6a3b318f6d7941e8 (diff)
Declarations in Fluid can now explicitly be made non-static or non-extern. This allows the declaration of types like 'enum'
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5130 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Function_Type.cxx')
-rw-r--r--fluid/Fl_Function_Type.cxx33
1 files changed, 30 insertions, 3 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index 77391abc1..b8a98ebc4 100644
--- a/fluid/Fl_Function_Type.cxx
+++ b/fluid/Fl_Function_Type.cxx
@@ -499,6 +499,7 @@ Fl_Type *Fl_Decl_Type::make() {
while (p && !p->is_decl_block()) p = p->parent;
Fl_Decl_Type *o = new Fl_Decl_Type();
o->public_ = 0;
+ o->static_ = 1;
o->name("int x;");
o->add(p);
o->factory = this;
@@ -508,11 +509,14 @@ Fl_Type *Fl_Decl_Type::make() {
void Fl_Decl_Type::write_properties() {
Fl_Type::write_properties();
if (public_) write_string("public");
+ if (!static_) write_string("global");
}
void Fl_Decl_Type::read_property(const char *c) {
if (!strcmp(c,"public")) {
public_ = 1;
+ } else if (!strcmp(c,"global")) {
+ static_ = 0;
} else {
Fl_Type::read_property(c);
}
@@ -522,6 +526,12 @@ void Fl_Decl_Type::open() {
if (!decl_panel) make_decl_panel();
decl_input->static_value(name());
decl_public_button->value(public_);
+ decl_static_button->value(static_);
+ if (public_)
+ decl_static_button->label("extern");
+ else
+ decl_static_button->label("static");
+ char pp = public_;
decl_panel->show();
const char* message = 0;
for (;;) { // repeat as long as there are errors
@@ -531,6 +541,14 @@ void Fl_Decl_Type::open() {
if (w == decl_panel_cancel) goto BREAK2;
else if (w == decl_panel_ok) break;
else if (!w) Fl::wait();
+ if (pp != decl_public_button->value()) {
+ pp = decl_public_button->value();
+ if (pp)
+ decl_static_button->label("extern");
+ else
+ decl_static_button->label("static");
+ decl_static_button->redraw();
+ }
}
const char*c = decl_input->value();
while (isspace(*c)) c++;
@@ -541,6 +559,10 @@ void Fl_Decl_Type::open() {
set_modflag(1);
public_ = decl_public_button->value();
}
+ if (static_!=decl_static_button->value()) {
+ set_modflag(1);
+ static_ = decl_static_button->value();
+ }
break;
}
BREAK2:
@@ -575,10 +597,15 @@ void Fl_Decl_Type::write_code1() {
write_h(" %.*s;\n", (int)(e-c), c);
} else {
if (public_) {
- write_h("extern %.*s;\n", (int)(e-c), c);
- write_c("%.*s;\n", (int)(e-c), c);
+ if (static_)
+ write_h("extern ");
+ write_h("%.*s;\n", (int)(e-c), c);
+ if (static_)
+ write_c("%.*s;\n", (int)(e-c), c);
} else {
- write_c("static %.*s;\n", (int)(e-c), c);
+ if (static_)
+ write_c("static ");
+ write_c("%.*s;\n", (int)(e-c), c);
}
}
}