static char *pfuncbase;
static char *macrobase;
static char *macrois;
+static char *macrotype;
static char *typebase;
static char *ptypebase;
*name = s;
}
+/* make a macro with some prefix before the name but after
+ namespace */
static char *
-make_is_macro(char *base)
+make_pre_macro(char *base, char *pre)
{
char *s1,*s2;
char *s;
separns_replace_sep(base,&s1,&s2,'_');
if(s1)
- s = g_strconcat(s1,"_IS_",s2,NULL);
+ s = g_strconcat(s1,"_",pre,"_",s2,NULL);
else
- s = g_strconcat("IS_",s2,NULL);
+ s = g_strconcat(pre,"_",s2,NULL);
g_strup(s);
macrobase = replace_sep(((Class *)class)->otype,'_');
g_strup(macrobase);
- macrois = make_is_macro(((Class *)class)->otype);
+ macrois = make_pre_macro(((Class *)class)->otype,"IS");
+ macrotype = make_pre_macro(((Class *)class)->otype,"TYPE");
typebase = remove_sep(((Class *)class)->otype);
out_printf(out,"%s != NULL",fa->name);
break;
case TYPE_CHECK:
- s = make_is_macro(fa->atype->name);
+ s = make_pre_macro(fa->atype->name,"IS");
out_printf(out,"%s (%s)",s,fa->name);
g_free(s);
break;
case OVERRIDE_METHOD:
out_addline_infile(out,m->line_no);
print_method(out,"static ","\n"," ","\n",m,FALSE);
+ s = replace_sep(m->otype,'_');
+ g_strup(s);
+ out_printf(out,"#define PARENT_HANDLER(args...) \\\n"
+ "\t{ if(%s_CLASS(parent_class)->%s) \\\n"
+ "\t\t(* %s_CLASS(parent_class)->%s)(##args); }\n",
+ s,m->id,s,m->id);
+ g_free(s);
print_method_body(m,TRUE);
+ out_printf(out,"#undef PARENT_HANDLER\n");
break;
default:
break;
continue;
if(n==node ||
line_no>=nline_no ||
- strcmp(nid,id)!=0)
+ strcmp(nid,id)!=0 ||
+ n->type != node->type)
continue;
s = g_strdup_printf("symbol '%s' redefined, "
"first defined on line %d",
signals = count_signals(c);
arguments = count_arguments(c);
overrides = count_overrides(c);
-
- out_printf(outh,"\n#define %s(obj)\t"
+
+ out_printf(outh,"\n#define %s\t"
+ "(%s_get_type())\n",
+ macrotype,funcbase);
+ out_printf(outh,"#define %s(obj)\t"
"GTK_CHECK_CAST((obj),%s_get_type(),%s)\n",
macrobase,funcbase,typebase);
out_printf(outh,"#define %s_CLASS(klass)\t"