A better static method patch from Bill.
git-svn-id: file:///fltk/svn/fltk/trunk@204 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
0bf87f77e4
commit
75e439ebbf
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Function_Type.cxx,v 1.10 1999/01/07 19:17:09 mike Exp $"
|
||||
// "$Id: Fl_Function_Type.cxx,v 1.11 1999/01/07 21:21:20 mike Exp $"
|
||||
//
|
||||
// C function type code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -193,28 +193,33 @@ void Fl_Function_Type::write_code1() {
|
||||
write_c("int main(int argc, char **argv) {\n");
|
||||
else {
|
||||
const char* t = return_type;
|
||||
// from matt: let the user type "static " at the start of type
|
||||
// in order to declare a static method;
|
||||
int is_static = 0;
|
||||
if (t) {
|
||||
if (!strcmp(t,"static")) {is_static = 1; t = 0;}
|
||||
else if (!strncmp(t,"static ",7)) {is_static = 1; t += 7;}
|
||||
}
|
||||
if (!t) {
|
||||
if (havewidgets) t = "Fl_Window*";
|
||||
else t = "void";
|
||||
}
|
||||
|
||||
// Remove leading spacing and "static" declarations...
|
||||
const char* t1 = t;
|
||||
while (*t1==' ') t1++;
|
||||
if (!strncmp(t1, "static ", 7)) t1+= 7;
|
||||
while (*t1==' ') t1++;
|
||||
|
||||
const char* k = class_name();
|
||||
if (k) {
|
||||
write_public(public_);
|
||||
if (name()[0] == '~')
|
||||
constructor = 1;
|
||||
else {
|
||||
size_t n; for (n=0; name()[n] && name()[n]!='('; n++);
|
||||
if (n == strlen(k) && !strncmp(name(), k, n)) constructor = 1;
|
||||
size_t n = strlen(k);
|
||||
if (!strncmp(name(), k, n) && name()[n] == '(') constructor = 1;
|
||||
}
|
||||
write_h(" ");
|
||||
if (!constructor) {write_h("%s ", t); write_c("%s ", t);}
|
||||
if (!constructor) {
|
||||
if (is_static) write_h("static ");
|
||||
write_h("%s ", t);
|
||||
write_c("%s ", t);
|
||||
}
|
||||
write_h("%s;\n", name());
|
||||
write_c("%s::%s {\n", k, name());
|
||||
} else {
|
||||
@ -692,5 +697,5 @@ void Fl_Class_Type::write_code2() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Function_Type.cxx,v 1.10 1999/01/07 19:17:09 mike Exp $".
|
||||
// End of "$Id: Fl_Function_Type.cxx,v 1.11 1999/01/07 21:21:20 mike Exp $".
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user