]> git.draconx.ca Git - gob-dx.git/blobdiff - src/main.c
Release 0.90.2
[gob-dx.git] / src / main.c
index 0ed34ee56c2827e0ab8d3b9321a1fe0edf842ce0..1b2b19c034aad7c1ab1746dd76bb616caba982f8 100644 (file)
@@ -270,7 +270,10 @@ put_vs_method(Method *m)
 {
        if(m->scope != SIGNAL_LAST_METHOD &&
           m->scope != SIGNAL_FIRST_METHOD &&
-          m->scope != VIRTUAL_METHOD)
+          m->scope != PRIVATE_SIGNAL_LAST_METHOD &&
+          m->scope != PRIVATE_SIGNAL_FIRST_METHOD &&
+          m->scope != VIRTUAL_METHOD &&
+          m->scope != PRIVATE_VIRTUAL_METHOD)
                return;
 
        print_method(outh,"\t","(* ",") ",";",m);
@@ -282,7 +285,10 @@ put_pub_method(Method *m)
        if(m->scope == PRIVATE_SCOPE ||
           m->scope == OVERRIDE_METHOD ||
           m->scope == INIT_METHOD ||
-          m->scope == CLASS_INIT_METHOD)
+          m->scope == CLASS_INIT_METHOD ||
+          m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+          m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
+          m->scope == PRIVATE_VIRTUAL_METHOD)
                return;
 
        print_method(outh,"","\t","\t",";",m);
@@ -294,9 +300,15 @@ put_priv_method_prot(Method *m)
        if(m->scope == PUBLIC_SCOPE)
                return;
 
-       if(m->scope == SIGNAL_LAST_METHOD ||
-          m->scope == SIGNAL_FIRST_METHOD ||
-          m->scope == VIRTUAL_METHOD) {
+       if(m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+          m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
+          m->scope == PRIVATE_VIRTUAL_METHOD) {
+               if(m->cbuf)
+                       print_method(out,"static ","_real_"," ",";",m);
+               print_method(out,"static ",""," ",";",m);
+       } else if(m->scope == SIGNAL_LAST_METHOD ||
+                 m->scope == SIGNAL_FIRST_METHOD ||
+                 m->scope == VIRTUAL_METHOD) {
                if(!m->cbuf)
                        return;
                print_method(out,"static ","_real_"," ",";",m);
@@ -372,7 +384,9 @@ add_signal_prots(Method *m)
        char *s;
        
        if(m->scope != SIGNAL_LAST_METHOD &&
-          m->scope != SIGNAL_FIRST_METHOD)
+          m->scope != SIGNAL_FIRST_METHOD &&
+          m->scope != PRIVATE_SIGNAL_LAST_METHOD &&
+          m->scope != PRIVATE_SIGNAL_FIRST_METHOD)
                return;
 
        if(!marsh)
@@ -452,7 +466,9 @@ add_enums(Class *c)
                        if(n->type == METHOD_NODE) {
                                Method *m = (Method *)n;
                                if(m->scope == SIGNAL_LAST_METHOD ||
-                                  m->scope == SIGNAL_FIRST_METHOD) {
+                                  m->scope == SIGNAL_FIRST_METHOD ||
+                                  m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+                                  m->scope == PRIVATE_SIGNAL_FIRST_METHOD) {
                                        char *s = g_strdup(m->id);
                                        g_strup(s);
                                        out_printf(out,"\t%s_SIGNAL,\n",s);
@@ -561,12 +577,21 @@ add_signals(Class *c)
                char *mar;
                char *sig;
                int is_none;
+               int last = FALSE;
                if(n->type != METHOD_NODE ||
                   (((Method *)n)->scope != SIGNAL_FIRST_METHOD &&
-                   ((Method *)n)->scope != SIGNAL_LAST_METHOD))
+                   ((Method *)n)->scope != SIGNAL_LAST_METHOD &&
+                   ((Method *)n)->scope != PRIVATE_SIGNAL_FIRST_METHOD &&
+                   ((Method *)n)->scope != PRIVATE_SIGNAL_LAST_METHOD))
                        continue;
 
                m = (Method *)n;
+               
+               if(m->scope == SIGNAL_FIRST_METHOD ||
+                  m->scope == PRIVATE_SIGNAL_FIRST_METHOD)
+                       last = FALSE;
+               else
+                       last = TRUE;
 
                if(g_hash_table_lookup(marsh,m))
                        mar = g_strconcat("marshal_",
@@ -587,7 +612,7 @@ add_signals(Class *c)
                        "\t\t\t%s,\n"
                        "\t\t\tGTK_TYPE_%s, %d",
                        sig,m->id,
-                       m->scope==SIGNAL_LAST_METHOD?"LAST":"FIRST",
+                       last?"LAST":"FIRST",
                        typebase,m->id,mar,(char *)m->gtktypes->data,
                        is_none?0:g_list_length(m->gtktypes->next));
                g_free(mar);
@@ -618,7 +643,10 @@ set_def_handlers(Class *c, char *oname)
                if(n->type != METHOD_NODE ||
                   (((Method *)n)->scope != SIGNAL_FIRST_METHOD &&
                    ((Method *)n)->scope != SIGNAL_LAST_METHOD &&
+                   ((Method *)n)->scope != PRIVATE_SIGNAL_FIRST_METHOD &&
+                   ((Method *)n)->scope != PRIVATE_SIGNAL_LAST_METHOD &&
                    ((Method *)n)->scope != VIRTUAL_METHOD &&
+                   ((Method *)n)->scope != PRIVATE_VIRTUAL_METHOD &&
                    ((Method *)n)->scope != OVERRIDE_METHOD))
                        continue;
 
@@ -884,6 +912,7 @@ static void
 put_method(Method *m)
 {
        char *s;
+       int private = FALSE;
        out_printf(out,"\n");
        switch(m->scope) {
        case PUBLIC_SCOPE:
@@ -896,10 +925,13 @@ put_method(Method *m)
                print_method(out,"static ","\n"," ","",m);
                print_method_body(m,TRUE);
                break;
+       case PRIVATE_SIGNAL_FIRST_METHOD:
+       case PRIVATE_SIGNAL_LAST_METHOD:
+               private = TRUE;
        case SIGNAL_FIRST_METHOD:
        case SIGNAL_LAST_METHOD:
                out_addline_infile(out,m->line_no);
-               print_method(out,"","\n"," ","",m);
+               print_method(out,private?"static ":"","\n"," ","",m);
                out_addline_outfile(out);
                out_printf(out,"{\n");
                s = g_strdup(m->id);
@@ -940,9 +972,11 @@ put_method(Method *m)
                print_method(out,"static ","\n_real_"," ","",m);
                print_method_body(m,FALSE);
                break;
+       case PRIVATE_VIRTUAL_METHOD:
+               private = TRUE;
        case VIRTUAL_METHOD:
                out_addline_infile(out,m->line_no);
-               print_method(out,"","\n"," ","",m);
+               print_method(out,private?"static ":"","\n"," ","",m);
                out_addline_outfile(out);
                out_printf(out,"{\n"
                        "\t%sClass *class;\n",typebase);
@@ -1050,7 +1084,9 @@ check_duplicate_named(Class *c,Node *node,char *id, int line_no)
                if(n->type == METHOD_NODE) {
                        Method *m = (Method *)n;
                        if(m->scope == SIGNAL_LAST_METHOD ||
-                          m->scope == SIGNAL_FIRST_METHOD) {
+                          m->scope == SIGNAL_FIRST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_FIRST_METHOD) {
                                nid = m->id;
                                nline_no = m->line_no;
                        } else
@@ -1081,7 +1117,9 @@ check_duplicate_signals_args(Class *c)
                if(n->type == METHOD_NODE) {
                        Method *m = (Method *)n;
                        if(m->scope == SIGNAL_LAST_METHOD ||
-                          m->scope == SIGNAL_FIRST_METHOD)
+                          m->scope == SIGNAL_FIRST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_FIRST_METHOD)
                                check_duplicate_named(c,n,m->id,m->line_no);
                } else if(n->type == ARGUMENT_NODE) {
                        Argument *a = (Argument *)n;
@@ -1120,7 +1158,10 @@ check_vararg(Class *c)
                        if(m->scope == OVERRIDE_METHOD ||
                           m->scope == SIGNAL_LAST_METHOD ||
                           m->scope == SIGNAL_FIRST_METHOD ||
-                          m->scope == VIRTUAL_METHOD) {
+                          m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
+                          m->scope == VIRTUAL_METHOD ||
+                          m->scope == PRIVATE_VIRTUAL_METHOD) {
                                print_error(FALSE,
                                            "signals, overrides and virtuals, "
                                            "can't have variable argument "
@@ -1141,7 +1182,9 @@ count_signals(Class *c)
                if(n->type == METHOD_NODE) {
                        Method *m = (Method *)n;
                        if(m->scope == SIGNAL_LAST_METHOD ||
-                          m->scope == SIGNAL_FIRST_METHOD)
+                          m->scope == SIGNAL_FIRST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
+                          m->scope == PRIVATE_SIGNAL_FIRST_METHOD)
                                num++;
                }
        }