Author: engelsman
Date: 2009-03-27 13:05:03 -0700 (Fri, 27 Mar 2009)
New Revision: 6727
Log:
fluid: fix erroneous declaration of user-defined static function (STR #2011)
Modified:
branches/branch-1.3/fluid/Fl_Menu_Type.cxx
branches/branch-1.3/fluid/Fl_Type.cxx
branches/branch-1.3/fluid/Fl_Type.h
Modified: branches/branch-1.3/fluid/Fl_Menu_Type.cxx
===================================================================
--- branches/branch-1.3/fluid/Fl_Menu_Type.cxx 2009-03-27 16:52:31 UTC (rev
6726)
+++ branches/branch-1.3/fluid/Fl_Menu_Type.cxx 2009-03-27 20:05:03 UTC (rev
6727)
@@ -170,7 +170,7 @@
#include "Fluid_Image.h"
void Fl_Menu_Item_Type::write_static() {
- if (callback() && is_name(callback()))
+ if (callback() && is_name(callback()) && !user_defined(callback()))
write_declare("extern void %s(Fl_Menu_*, %s);", callback(),
user_data_type() ? user_data_type() : "void*");
for (int n=0; n < NUM_EXTRA_CODE; n++) {
Modified: branches/branch-1.3/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-1.3/fluid/Fl_Type.cxx 2009-03-27 16:52:31 UTC (rev
6726)
+++ branches/branch-1.3/fluid/Fl_Type.cxx 2009-03-27 20:05:03 UTC (rev
6727)
@@ -994,6 +994,24 @@
void Fl_Type::copy_properties() {
}
+/**
+ * Check whether callback name is declared anywhere else by the user
+ *
+ * \b Warning: this just checks that the name is declared somewhere,
+ * but it should probably also check that the name corresponds to a
+ * plain function or a member function within the same class and that
+ * the parameter types match.
+ */
+int Fl_Type::user_defined(const char* cbname) const {
+ for (Fl_Type* p = Fl_Type::first; p ; p = p->next)
+ if (strcmp(p->type_name(), "Function") == 0 && p->name() != 0)
+ if (strncmp(p->name(), cbname, strlen(cbname)) == 0)
+ if (p->name()[strlen(cbname)] == '(')
+ return 1;
+ return 0;
+}
+
+
//
// End of "$Id$".
//
Modified: branches/branch-1.3/fluid/Fl_Type.h
===================================================================
--- branches/branch-1.3/fluid/Fl_Type.h 2009-03-27 16:52:31 UTC (rev 6726)
+++ branches/branch-1.3/fluid/Fl_Type.h 2009-03-27 20:05:03 UTC (rev 6727)
@@ -77,6 +77,9 @@
int code_line, header_line;
int code_line_end, header_line_end;
+protected:
+ int user_defined(const char* cbname) const;
+
public:
virtual ~Fl_Type();
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit