summaryrefslogtreecommitdiff
path: root/fluid/Fl_Function_Type.cxx
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>1999-08-05 09:01:25 +0000
committerBill Spitzak <spitzak@gmail.com>1999-08-05 09:01:25 +0000
commit467e73ed0b946bf882479c941bf666716482de7e (patch)
tree5d6aa98810572aabe6fc693b512a8d1451548352 /fluid/Fl_Function_Type.cxx
parent16a999efd0f14f0a99fb01c4e8484ace744fd416 (diff)
Added Chrisophe Kalt's patch to add "extern "C"" to functions
if desired. Added Chrisophe Kalt's patch to let you create Fl_Pack. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@638 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Function_Type.cxx')
-rw-r--r--fluid/Fl_Function_Type.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index f2689d840..dbc4f5db5 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.7 1999/08/05 08:01:35 bill Exp $"
+// "$Id: Fl_Function_Type.cxx,v 1.15.2.8 1999/08/05 09:01:24 bill Exp $"
//
// C function type code for the Fast Light Tool Kit (FLTK).
//
@@ -112,12 +112,14 @@ Fl_Type *Fl_Function_Type::make() {
o->add(p);
o->factory = this;
o->public_ = 1;
+ o->cdecl_ = 0;
return o;
}
void Fl_Function_Type::write_properties() {
Fl_Type::write_properties();
if (!public_) write_string("private");
+ if (cdecl_) write_string("C");
if (return_type) {
write_string("return_type");
write_word(return_type);
@@ -127,6 +129,8 @@ void Fl_Function_Type::write_properties() {
void Fl_Function_Type::read_property(const char *c) {
if (!strcmp(c,"private")) {
public_ = 0;
+ } else if (!strcmp(c,"C")) {
+ cdecl_ = 1;
} else if (!strcmp(c,"return_type")) {
storestring(read_word(),return_type);
} else {
@@ -142,6 +146,7 @@ void Fl_Function_Type::open() {
f_return_type_input->static_value(return_type);
f_name_input->static_value(name());
f_public_button->value(public_);
+ f_c_button->value(cdecl_);
function_panel->show();
const char* message = 0;
for (;;) { // repeat as long as there are errors
@@ -165,6 +170,7 @@ void Fl_Function_Type::open() {
name(f_name_input->value());
storestring(c, return_type);
public_ = f_public_button->value();
+ cdecl_ = f_c_button->value();
break;
}
BREAK2:
@@ -242,7 +248,12 @@ void Fl_Function_Type::write_code1() {
write_h("%s;\n", s);
write_c("%s::%s {\n", k, name());
} else {
- if (public_) write_h("%s %s;\n", t, name());
+ if (public_) {
+ if (cdecl_)
+ write_h("extern \"C\" { %s %s; }\n", t, name());
+ else
+ write_h("%s %s;\n", t, name());
+ }
else write_c("static ");
write_c("%s %s {\n", t, name());
}
@@ -650,5 +661,5 @@ void Fl_Class_Type::write_code2() {
}
//
-// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.7 1999/08/05 08:01:35 bill Exp $".
+// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.8 1999/08/05 09:01:24 bill Exp $".
//