fluid: fix erroneous declaration of user-defined static function (STR #2011)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6727 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f91d962536
commit
88a23466e3
@ -170,7 +170,7 @@ const char* Fl_Menu_Item_Type::menu_name(int& i) {
|
||||
#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++) {
|
||||
|
@ -994,6 +994,24 @@ void Fl_Type::leave_live_mode() {
|
||||
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$".
|
||||
//
|
||||
|
@ -77,6 +77,9 @@ public: // things that should not be public:
|
||||
int code_line, header_line;
|
||||
int code_line_end, header_line_end;
|
||||
|
||||
protected:
|
||||
int user_defined(const char* cbname) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Fl_Type();
|
||||
|
Loading…
Reference in New Issue
Block a user