Added class/return value fixes from Bill.
git-svn-id: file:///fltk/svn/fltk/trunk@101 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
90a6a06b7f
commit
df0ec23603
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Function_Type.cxx,v 1.5 1998/10/21 16:28:52 mike Exp $"
|
||||
// "$Id: Fl_Function_Type.cxx,v 1.6 1998/11/25 13:18:46 mike Exp $"
|
||||
//
|
||||
// C function type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -183,11 +183,9 @@ void Fl_Function_Type::write_code1() {
|
||||
constructor=0;
|
||||
havewidgets = 0;
|
||||
Fl_Type *child;
|
||||
const char* widget_type = 0;
|
||||
for (child = next; child && child->level > level; child = child->next)
|
||||
if (child->is_widget()) {
|
||||
havewidgets = 1;
|
||||
widget_type = subclassname(child);
|
||||
break;
|
||||
}
|
||||
write_c("\n");
|
||||
@ -195,9 +193,8 @@ void Fl_Function_Type::write_code1() {
|
||||
write_c("int main(int argc, char **argv) {\n");
|
||||
else {
|
||||
const char* t = return_type;
|
||||
const char* star = "";
|
||||
if (!t) {
|
||||
if (havewidgets) {t = widget_type; star = "*";}
|
||||
if (havewidgets) t = "Fl_Window*";
|
||||
else t = "void";
|
||||
}
|
||||
const char* k = class_name();
|
||||
@ -210,16 +207,16 @@ void Fl_Function_Type::write_code1() {
|
||||
if (n == strlen(k) && !strncmp(name(), k, n)) constructor = 1;
|
||||
}
|
||||
write_h(" ");
|
||||
if (!constructor) {write_h("%s%s ", t, star); write_c("%s%s ", t,star);}
|
||||
if (!constructor) {write_h("%s ", t); write_c("%s ", t);}
|
||||
write_h("%s;\n", name());
|
||||
write_c("%s::%s {\n", k, name());
|
||||
} else {
|
||||
if (public_) write_h("%s%s %s;\n", t, star, name());
|
||||
if (public_) write_h("%s %s;\n", t, name());
|
||||
else write_c("static ");
|
||||
write_c("%s%s %s {\n", t, star, name());
|
||||
write_c("%s %s {\n", t, name());
|
||||
}
|
||||
}
|
||||
if (havewidgets) write_c(" %s* w;\n", widget_type);
|
||||
if (havewidgets) write_c(" Fl_Window* w;\n");
|
||||
indentation += 2;
|
||||
}
|
||||
|
||||
@ -688,5 +685,5 @@ void Fl_Class_Type::write_code2() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Function_Type.cxx,v 1.5 1998/10/21 16:28:52 mike Exp $".
|
||||
// End of "$Id: Fl_Function_Type.cxx,v 1.6 1998/11/25 13:18:46 mike Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Widget_Type.cxx,v 1.7 1998/11/18 18:40:09 mike Exp $"
|
||||
// "$Id: Fl_Widget_Type.cxx,v 1.8 1998/11/25 13:18:47 mike Exp $"
|
||||
//
|
||||
// Widget type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -1210,7 +1210,7 @@ void Fl_Widget_Type::write_static() {
|
||||
write_c("\n");
|
||||
if (!public_) write_c("static ");
|
||||
else write_h("extern %s *%s;\n", t, c);
|
||||
write_c("%s *%s=NULL;\n", t, c);
|
||||
write_c("%s *%s=(%s *)0;\n", t, c, t);
|
||||
}
|
||||
if (callback() && !is_name(callback())) {
|
||||
// see if 'o' or 'v' used, to prevent unused argument warnings:
|
||||
@ -1266,7 +1266,7 @@ void Fl_Widget_Type::write_code1() {
|
||||
if (class_name()) {
|
||||
write_public(public_);
|
||||
write_h(" %s *%s;\n", t, c);
|
||||
} else if (!public_)
|
||||
} else if (public_)
|
||||
write_h("extern %s *%s;\n", t, c);
|
||||
}
|
||||
if (class_name() && callback() && !is_name(callback())) {
|
||||
@ -1290,7 +1290,7 @@ void Fl_Widget_Type::write_code1() {
|
||||
if (varused) write_c("{ %s* o = ", t);
|
||||
if (name()) write_c("%s = ", name());
|
||||
if (is_window()) {
|
||||
write_c("w = new %s(%d, %d", t, o->w(), o->h());
|
||||
write_c("new %s(%d, %d", t, o->w(), o->h());
|
||||
// prevent type() code from being emitted:
|
||||
((Fl_Widget_Type*)factory)->o->type(o->type());
|
||||
} else {
|
||||
@ -1302,6 +1302,7 @@ void Fl_Widget_Type::write_code1() {
|
||||
}
|
||||
write_c(");\n");
|
||||
indentation += 2;
|
||||
if (is_window()) write_c("%sw = o;\n",indent());
|
||||
if (varused) write_widget_code();
|
||||
}
|
||||
|
||||
@ -1699,5 +1700,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Widget_Type.cxx,v 1.7 1998/11/18 18:40:09 mike Exp $".
|
||||
// End of "$Id: Fl_Widget_Type.cxx,v 1.8 1998/11/25 13:18:47 mike Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user