X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/c190a2ae41238682c1430b8482683b6a7c15c66b..b9f22ab5a7f4d4bfe0932debf8864a21b5c852cd:/src/main.c diff --git a/src/main.c b/src/main.c index 625f7bd..02db339 100644 --- a/src/main.c +++ b/src/main.c @@ -19,6 +19,7 @@ * USA. */ +#include "config.h" #include #include #include @@ -26,11 +27,7 @@ #include #include "tree.h" -#include "y.tab.h" - -#ifndef VERSION -#define VERSION "0.0.1" -#endif +#include "parse.h" char *filename = "stdin"; @@ -272,7 +269,7 @@ put_pub_method(Method *m) m->scope == CLASS_INIT_METHOD) return; - print_method(outh,"\t","","\t",";",m); + print_method(outh,"","\t","\t",";",m); } static void @@ -621,6 +618,20 @@ set_def_handlers(Class *c, char *oname) } } +static int +is_arguments(Class *c) +{ + GList *li; + + for(li=c->nodes;li;li=g_list_next(li)) { + Node *n = li->data; + if(n->type == ARGUMENT_NODE) + return TRUE; + } + return FALSE; +} + + static void make_arguments(Class *c) { @@ -659,8 +670,11 @@ make_arguments(Class *c) g_string_free(flags,TRUE); } - fprintf(out,"\n\tgtk_object_class->set_arg = __object_set_arg;\n" - "\tgtk_object_class->get_arg = __object_get_arg;\n"); + if(is_arguments(c)) { + fprintf(out, + "\n\tgtk_object_class->set_arg = __object_set_arg;\n" + "\tgtk_object_class->get_arg = __object_get_arg;\n"); + } } static void @@ -1021,12 +1035,14 @@ generate_outfiles(void) fprintf(outh,"guint\t%s_get_type\t(void);\n",funcbase); - fprintf(out,"static void __object_set_arg " - "(GtkObject *object, GtkArg *arg, " - "guint arg_id);\n" - "static void __object_get_arg " - "(GtkObject *object, GtkArg *arg, " - "guint arg_id);\n"); + if(is_arguments(c)) { + fprintf(out,"static void __object_set_arg " + "(GtkObject *object, GtkArg *arg, " + "guint arg_id);\n" + "static void __object_get_arg " + "(GtkObject *object, GtkArg *arg, " + "guint arg_id);\n"); + } for(l=c->nodes;l;l=g_list_next(l)) { Node *n = l->data; @@ -1051,8 +1067,10 @@ generate_outfiles(void) add_inits(c); - add_getset_arg(c, TRUE); - add_getset_arg(c, FALSE); + if(is_arguments(c)) { + add_getset_arg(c, TRUE); + add_getset_arg(c, FALSE); + } for(l=c->nodes;l;l=g_list_next(l)) { Node *n = l->data;