diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2005-08-23 11:28:13 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2005-08-23 11:28:13 +0000 |
| commit | cd1de720b716d77810a923bc7aa7242e99db891c (patch) | |
| tree | 12970e246988c9f35564177f4396c559f33f3314 /fluid/Fl_Widget_Type.cxx | |
| parent | 7e02be0309fbe276358efeedf01b2609b07d5988 (diff) | |
FLUID now knows if a static callback is already declared in a class and won't declare it 'extern' (STR #776)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4534 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 820b4184a..47d64fa65 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1763,11 +1763,20 @@ void Fl_Widget_Type::write_static() { if (extra_code(n) && isdeclare(extra_code(n))) write_declare("%s", extra_code(n)); } - if (callback() && is_name(callback())) - write_declare("extern void %s(%s*, %s);", callback(), t, - user_data_type() ? user_data_type() : "void*"); - const char* c = array_name(this); + if (callback() && is_name(callback())) { + int write_extern_declaration = 1; + const Fl_Class_Type *cc = is_in_class(); + if (cc) { + char buf[1024]; snprintf(buf, 1023, "%s(*)", callback()); + if (cc->has_function("static void", buf)) + write_extern_declaration = 0; + } + if (write_extern_declaration) + write_declare("extern void %s(%s*, %s);", callback(), t, + user_data_type() ? user_data_type() : "void*"); + } const char* k = class_name(1); + const char* c = array_name(this); if (c && !k && !is_class()) { write_c("\n"); if (!public_) write_c("static "); |
