summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1999-01-07 21:21:20 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1999-01-07 21:21:20 +0000
commit75e439ebbf0e3704fd8ffb12c5aeb03e0d97c3f5 (patch)
tree9020a45dc1508e6262a06f4b457cf148bbe3a57e
parent0bf87f77e47b04e32251e446cacdd12b121e71f3 (diff)
A better static method patch from Bill.
git-svn-id: file:///fltk/svn/fltk/trunk@204 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fluid/Fl_Function_Type.cxx27
1 files changed, 16 insertions, 11 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index e3d6a0b56..9dd1d1f53 100644
--- a/fluid/Fl_Function_Type.cxx
+++ b/fluid/Fl_Function_Type.cxx
@@ -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 $".
//