]> git.draconx.ca Git - gob-dx.git/blobdiff - src/main.c
Release 0.0.2
[gob-dx.git] / src / main.c
index 625f7bd1f36157bcb2c6453fd0cfa858daa1bd83..02db339d0109ca0c53fdc775c8c119c358020a5d 100644 (file)
@@ -19,6 +19,7 @@
  * USA.
  */
 
+#include "config.h"
 #include <glib.h>
 #include <popt.h>
 #include <time.h>
 #include <string.h>
 
 #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;