2 * Copyright (C) 1999 the Free Software Foundation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
38 char *filename = NULL;
47 extern GList *include_files;
50 static char *funcbase;
51 static char *pfuncbase;
52 static char *macrobase;
54 static char *macrotype;
55 static char *typebase;
56 static char *ptypebase;
58 static int signals = 0; /* number of signals */
59 static int arguments = 0; /* number of named arguments */
60 static int overrides = 0; /* number of override functions */
61 static int privates = 0; /* number of private data members */
63 static gboolean made_aliases = FALSE; /* if we made any shorthand aliases
64 and need the REALLY UGLY HACK to
71 gboolean no_touch_headers = FALSE;
72 gboolean for_cpp = FALSE;
73 gboolean exit_on_warn = FALSE;
74 gboolean exit_on_error = TRUE;
75 gboolean got_error = FALSE;
76 gboolean always_private_header = FALSE;
77 gboolean no_private_header = FALSE;
80 print_error(int is_warn, char *error,int line)
90 fprintf(stderr,"%s:%d: %s %s\n",filename,line,w,error);
92 fprintf(stderr,"%s: %s %s\n",filename,w,error);
93 if((!is_warn || exit_on_warn) && exit_on_error)
98 remove_sep(char *base)
101 char *s = g_strdup(base);
102 while((p=strchr(s,':')))
108 replace_sep(char *base, char r)
111 char *s = g_strdup(base);
112 while((p=strchr(s,':')))
122 /*separate the namespace part and then replace rest of
125 separns_replace_sep(char *base, char **ns, char **name, char r)
128 char *s = g_strdup(base);
130 if((p=strchr(s,':')) && p!=s) {
137 while((p=strchr(s,':')))
140 *name = g_strdup(s+1);
146 /* make a macro with some prefix before the name but after
149 make_pre_macro(char *base, char *pre)
154 separns_replace_sep(base,&s1,&s2,'_');
156 s = g_strconcat(s1,"_",pre,"_",s2,NULL);
158 s = g_strconcat(pre,"_",s2,NULL);
171 filebase = replace_sep(((Class *)class)->otype,'-');
174 funcbase = replace_sep(((Class *)class)->otype,'_');
177 pfuncbase = replace_sep(((Class *)class)->ptype,'_');
178 g_strdown(pfuncbase);
180 macrobase = replace_sep(((Class *)class)->otype,'_');
183 macrois = make_pre_macro(((Class *)class)->otype,"IS");
184 macrotype = make_pre_macro(((Class *)class)->otype,"TYPE");
186 typebase = remove_sep(((Class *)class)->otype);
188 ptypebase = remove_sep(((Class *)class)->ptype);
192 print_type(FILE *fp, Type *t, gboolean postfix_to_stars)
198 s = remove_sep(t->name);
199 out_printf(fp,"%s ",s);
203 if(postfix_to_stars) {
205 /*XXX: this is ugly perhaps we can do this whole postfix thing
206 in a nicer way, we just count the number of '[' s and from that
207 we deduce the number of dimensions */
208 for(p=t->postfix; p && *p; p++)
209 if(*p == '[') extra++;
212 for(i=0;i<(t->stars+extra);i++)
217 print_method(FILE *fp, char *typeprefix, char *nameprefix,
218 char *namepostfix,char *postfix, Method *m,
219 gboolean no_funcbase)
223 out_printf(fp,"%s",typeprefix);
224 print_type(fp,m->mtype,TRUE);
226 out_printf(fp,"%s%s%s(",
227 nameprefix,m->id,namepostfix);
229 out_printf(fp,"%s%s_%s%s(",
230 nameprefix,funcbase,m->id,namepostfix);
233 for(li=m->args;li;li=g_list_next(li)) {
234 FuncArg *arg = li->data;
235 print_type(fp,arg->atype,FALSE);
237 out_printf(fp,"%s%s, ",arg->name,
239 arg->atype->postfix:"");
241 out_printf(fp,"%s%s",arg->name,
243 arg->atype->postfix:"");
246 out_printf(fp,", ...");
248 out_printf(fp,"void");
250 out_printf(fp,")%s",postfix);
255 make_method_pointers(Class *c)
259 out_printf(out,"\n");
260 for(li=c->nodes;li;li=g_list_next(li)) {
261 Node *node = li->data;
262 if(node->type == METHOD_NODE) {
263 Method *m = (Method *)node;
265 if(m->scope == INIT_METHOD ||
266 m->scope == CLASS_INIT_METHOD ||
267 m->scope == OVERRIDE_METHOD)
270 /* in C++ mode don't alias new */
271 if(for_cpp && strcmp(m->id,"new")==0)
274 print_method(out,"static ","(* ",") ","",m,TRUE);
275 out_printf(out," = %s_%s;\n",funcbase,m->id);
280 out_printf(out,"\n");
284 add_bad_hack_to_avoid_unused_warnings(Class *c)
288 /* if we haven't had any methods, just return */
292 out_printf(out,"\n\n/*REALLY BAD HACK\n"
293 " This is to avoid unused warnings if you don't call\n"
294 " some method, it pollutes the namespace but the call\n"
295 " is weird enough. I need to find a better way to do\n"
297 out_printf(out,"void __%s_really_bad_hack_to_avoid_warnings(void);\n",
299 out_printf(out,"void\n__%s_really_bad_hack_to_avoid_warnings(void)\n"
301 for(li=c->nodes;li;li=g_list_next(li)) {
302 Node *node = li->data;
303 if(node->type == METHOD_NODE) {
304 Method *m = (Method *)node;
306 if(m->scope == INIT_METHOD ||
307 m->scope == CLASS_INIT_METHOD ||
308 m->scope == OVERRIDE_METHOD)
311 /* in C++ mode we don't alias new */
312 if(for_cpp && strcmp(m->id,"new")==0)
315 out_printf(out,"\t((void (*)(void))%s)();\n",m->id);
318 out_printf(out,"}\n\n");
322 put_variable(Variable *v, FILE *fp)
325 print_type(fp,v->vtype,FALSE);
326 out_printf(fp,"%s%s;\n",v->id,
328 v->vtype->postfix:"");
332 put_vs_method(Method *m)
334 if(m->scope != SIGNAL_LAST_METHOD &&
335 m->scope != SIGNAL_FIRST_METHOD &&
336 m->scope != PRIVATE_SIGNAL_LAST_METHOD &&
337 m->scope != PRIVATE_SIGNAL_FIRST_METHOD &&
338 m->scope != VIRTUAL_METHOD &&
339 m->scope != PRIVATE_VIRTUAL_METHOD)
342 print_method(outh,"\t","(* ",") ",";\n",m,TRUE);
346 put_pub_method(Method *m)
348 if(m->scope == PRIVATE_SCOPE ||
349 m->scope == OVERRIDE_METHOD ||
350 m->scope == INIT_METHOD ||
351 m->scope == CLASS_INIT_METHOD ||
352 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
353 m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
354 m->scope == PRIVATE_VIRTUAL_METHOD)
357 print_method(outh,"","\t","\t",";\n",m,FALSE);
361 put_priv_method_prot(Method *m)
363 if(m->scope == PUBLIC_SCOPE)
366 if(m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
367 m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
368 m->scope == PRIVATE_VIRTUAL_METHOD) {
369 if(m->cbuf && *m->cbuf->str)
370 print_method(out,"static ","_real_"," ",";\n",m,FALSE);
371 print_method(out,"static ",""," ",";\n",m,FALSE);
372 } else if(m->scope == SIGNAL_LAST_METHOD ||
373 m->scope == SIGNAL_FIRST_METHOD ||
374 m->scope == VIRTUAL_METHOD) {
375 if(!m->cbuf || !*m->cbuf->str)
377 print_method(out,"static ","_real_"," ",";\n",m,FALSE);
379 print_method(out,"static ",""," ",";\n",m,FALSE);
384 make_func_arg(char *typename, int is_class, char *name)
391 tn = g_strconcat(typename,":Class",NULL);
393 tn = g_strdup(typename);
395 type = new_type(1,tn,NULL);
396 node = new_funcarg((Type *)type,name,NULL);
397 return g_list_prepend(NULL, node);
401 make_inits(Class *cl)
403 int got_class_init = FALSE;
404 int got_init = FALSE;
407 for(li=cl->nodes;li;li=g_list_next(li)) {
409 if(n->type == METHOD_NODE) {
410 Method *m = (Method *)n;
411 if(m->scope == INIT_METHOD) {
413 print_error(FALSE,"init defined more then once",m->line_no);
415 } else if(m->scope == CLASS_INIT_METHOD) {
417 print_error(FALSE,"class_init defined more then once",m->line_no);
418 got_class_init = TRUE;
422 if(!got_class_init) {
423 node = new_method(CLASS_INIT_METHOD,
424 (Type *)new_type(0,g_strdup("void"),NULL),
425 NULL,NULL,g_strdup("class_init"),
426 make_func_arg(cl->otype,TRUE,g_strdup("c")),
427 NULL, NULL,0,0,FALSE);
428 cl->nodes = g_list_prepend(cl->nodes,node);
431 node = new_method(INIT_METHOD,
432 (Type *)new_type(0,g_strdup("void"),NULL),
433 NULL,NULL,g_strdup("init"),
434 make_func_arg(cl->otype,FALSE,g_strdup("o")),
435 NULL, NULL,0,0,FALSE);
436 cl->nodes = g_list_prepend(cl->nodes,node);
441 make_destroy(Class *cl)
443 int got_destroy = FALSE;
446 for(li=cl->nodes;li;li=g_list_next(li)) {
448 if(n->type == METHOD_NODE) {
449 Method *m = (Method *)n;
450 if(m->scope == OVERRIDE_METHOD &&
451 strcmp(m->id,"destroy")==0) {
452 if(strcmp(m->otype,"Gtk:Object")==0) {
456 print_error(FALSE,"destroy method override "
457 "of class other then Gtk:Object",
465 node = new_method(OVERRIDE_METHOD,
466 (Type *)new_type(0,g_strdup("void"),NULL),
467 g_strdup("Gtk:Object"),
468 NULL,g_strdup("destroy"),
469 make_func_arg("Gtk:Object",FALSE,g_strdup("o")),
471 g_string_new("PARENT_HANDLER (o);\n"),
473 cl->nodes = g_list_append(cl->nodes,node);
478 static GHashTable *marsh = NULL;
481 add_signal_prots(Method *m)
487 if(m->scope != SIGNAL_LAST_METHOD &&
488 m->scope != SIGNAL_FIRST_METHOD &&
489 m->scope != PRIVATE_SIGNAL_LAST_METHOD &&
490 m->scope != PRIVATE_SIGNAL_FIRST_METHOD)
494 marsh = g_hash_table_new(NULL,NULL);
496 if(strcmp(m->gtktypes->data,"NONE")==0 &&
497 strcmp(m->gtktypes->next->data,"NONE")==0)
500 s = g_strdup_printf("__Sig%d",sig++);
502 g_hash_table_insert(marsh,m,s);
504 out_printf(out,"\ntypedef ");
505 print_type(out,m->mtype,TRUE);
507 out_printf(out,"(*%s) (",s);
509 for(li=m->args;li;li=g_list_next(li)) {
510 FuncArg *arg = li->data;
511 print_type(out,arg->atype,TRUE);
512 out_printf(out,", ");
514 out_printf(out,"gpointer);\n");
516 out_printf(out,"\nstatic void\n"
517 "marshal_%s (GtkObject * object,\n"
518 "\tGtkSignalFunc func,\n"
519 "\tgpointer func_data,\n"
523 if(strcmp(m->gtktypes->data,"NONE")==0) {
525 out_printf(out, "\t%s rfunc;\n\n"
526 "\trfunc = (%s)func;\n\n"
527 "\t(*rfunc)((%s *)object",s,s,typebase);
528 if(strcmp(m->gtktypes->next->data,"NONE")!=0) {
529 GList *ali = m->args->next;
530 for(i=0,li=m->gtktypes->next;li;
531 i++,li=g_list_next(li)) {
533 out_printf(out, ",\n\t\tGTK_VALUE_%s(args[%d])",
536 FuncArg *fa = ali->data;
537 out_printf(out, ",\n\t\t(");
538 print_type(out,fa->atype,TRUE);
539 out_printf(out, ")GTK_VALUE_%s(args[%d])",
543 if(ali) ali = ali->next;
546 out_printf(out, ",\n\t\tfunc_data);\n}\n\n");
549 out_printf(out, "\t%s rfunc;\n\t",s);
550 print_type(out,m->mtype,TRUE);
551 out_printf(out, " *retval;\n\n"
552 "\trfunc = (%s)func;\n\n"
553 "\tretval = GTK_RETLOC_%s(args[%d]);\n\n"
554 "\t*retval = (*rfunc)((%s *)object",
555 s,(char *)m->gtktypes->data,
556 g_list_length(m->gtktypes)-1,typebase);
557 if(strcmp(m->gtktypes->next->data,"NONE")!=0) {
558 GList *ali = m->args->next;
559 for(i=0,li=m->gtktypes->next;li;
560 i++,li=g_list_next(li)) {
562 out_printf(out, ",\n\t\tGTK_VALUE_%s(args[%d])",
565 FuncArg *fa = ali->data;
566 out_printf(out, ",\n\t\t(");
567 print_type(out,fa->atype,TRUE);
568 out_printf(out, ")GTK_VALUE_%s(args[%d])",
572 if(ali) ali = ali->next;
575 out_printf(out, ",\n\t\tfunc_data);\n}\n\n");
584 out_printf(out,"\n");
586 out_printf(out,"enum {\n");
587 for(li=c->nodes;li;li=g_list_next(li)) {
589 if(n->type == METHOD_NODE) {
590 Method *m = (Method *)n;
591 if(m->scope == SIGNAL_LAST_METHOD ||
592 m->scope == SIGNAL_FIRST_METHOD ||
593 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
594 m->scope == PRIVATE_SIGNAL_FIRST_METHOD) {
595 char *s = g_strdup(m->id);
597 out_printf(out,"\t%s_SIGNAL,\n",s);
602 out_printf(out,"\tLAST_SIGNAL\n};\n\n");
605 out_printf(out,"enum {\n\tARG_0,\n");
606 for(li=c->nodes;li;li=g_list_next(li)) {
608 if(n->type == ARGUMENT_NODE) {
609 Argument *a = (Argument *)n;
610 char *s = g_strdup(a->name);
612 out_printf(out,"\tARG_%s,\n",s);
616 out_printf(out, "};\n\n");
621 "static guint object_signals[LAST_SIGNAL] = {0};\n\n");
623 out_printf(out, "static %sClass *parent_class = NULL;\n\n",ptypebase);
629 out_printf(out, "guint\n"
630 "%s_get_type (void)\n"
632 "\tstatic guint type = 0;\n\n"
634 "\t\tstatic const GtkTypeInfo info = {\n"
636 "\t\t\tsizeof (%s),\n"
637 "\t\t\tsizeof (%sClass),\n"
638 "\t\t\t(GtkClassInitFunc) %s_class_init,\n"
639 "\t\t\t(GtkObjectInitFunc) %s_init,\n"
640 "\t\t\t/* reserved_1 */ NULL,\n"
641 "\t\t\t/* reserved_2 */ NULL,\n"
642 "\t\t\t(GtkClassInitFunc) NULL,\n"
644 "\t\ttype = gtk_type_unique (%s_get_type(), &info);\n"
648 funcbase,typebase,typebase,typebase,
649 funcbase,funcbase,pfuncbase);
653 add_overrides(Class *c, char *oname, gboolean did_gtk_obj)
659 done = g_hash_table_new(g_str_hash,g_str_equal);
661 s = g_strdup("GtkObject"); /* This was already done */
662 g_hash_table_insert(done,s,s);
664 for(li=c->nodes;li;li=g_list_next(li)) {
668 if(n->type != METHOD_NODE ||
669 ((Method *)n)->scope != OVERRIDE_METHOD)
673 s = remove_sep(m->otype);
675 if(g_hash_table_lookup(done,s)) {
679 g_hash_table_insert(done,s,s);
681 f = replace_sep(m->otype,'_');
684 out_printf(out,"\t%sClass *%s_class = (%sClass *)%s;\n",
689 g_hash_table_foreach(done,(GHFunc)g_free,NULL);
690 g_hash_table_destroy(done);
694 add_signals(Class *c)
698 out_printf(out,"\n");
699 for(li=c->nodes;li;li=g_list_next(li)) {
706 if(n->type != METHOD_NODE ||
707 (((Method *)n)->scope != SIGNAL_FIRST_METHOD &&
708 ((Method *)n)->scope != SIGNAL_LAST_METHOD &&
709 ((Method *)n)->scope != PRIVATE_SIGNAL_FIRST_METHOD &&
710 ((Method *)n)->scope != PRIVATE_SIGNAL_LAST_METHOD))
715 if(m->scope == SIGNAL_FIRST_METHOD ||
716 m->scope == PRIVATE_SIGNAL_FIRST_METHOD)
721 if(g_hash_table_lookup(marsh,m))
722 mar = g_strconcat("marshal_",
723 (char *)g_hash_table_lookup(marsh,m),
726 mar = g_strdup("gtk_signal_default_marshaller");
728 is_none = (strcmp(m->gtktypes->next->data,"NONE")==0);
730 sig = g_strdup(m->id);
732 out_printf(out,"\tobject_signals[%s_SIGNAL] =\n"
733 "\t\tgtk_signal_new (\"%s\",\n"
734 "\t\t\tGTK_RUN_%s,\n"
735 "\t\t\tgtk_object_class->type,\n"
736 "\t\t\tGTK_SIGNAL_OFFSET (%sClass, %s),\n"
738 "\t\t\tGTK_TYPE_%s, %d",
741 typebase,m->id,mar,(char *)m->gtktypes->data,
742 is_none?0:g_list_length(m->gtktypes->next));
748 for(l=m->gtktypes->next;l;l=g_list_next(l))
749 out_printf(out,",\n\t\t\tGTK_TYPE_%s",
753 out_printf(out,");\n");
755 out_printf(out,"\tgtk_object_class_add_signals (gtk_object_class,\n"
756 "\t\tobject_signals, LAST_SIGNAL);\n\n");
760 set_def_handlers(Class *c, char *oname)
764 out_printf(out,"\n");
765 for(li=c->nodes;li;li=g_list_next(li)) {
768 if(n->type != METHOD_NODE ||
769 (((Method *)n)->scope != SIGNAL_FIRST_METHOD &&
770 ((Method *)n)->scope != SIGNAL_LAST_METHOD &&
771 ((Method *)n)->scope != PRIVATE_SIGNAL_FIRST_METHOD &&
772 ((Method *)n)->scope != PRIVATE_SIGNAL_LAST_METHOD &&
773 ((Method *)n)->scope != VIRTUAL_METHOD &&
774 ((Method *)n)->scope != PRIVATE_VIRTUAL_METHOD &&
775 ((Method *)n)->scope != OVERRIDE_METHOD))
780 if(m->scope == OVERRIDE_METHOD) {
782 s = replace_sep(m->otype,'_');
784 out_printf(out,"\t%s_class->%s = %s_%s;\n",
785 s,m->id,funcbase,m->id);
787 if(m->cbuf && *m->cbuf->str)
788 out_printf(out,"\t%s->%s = _real_%s_%s;\n",
789 oname,m->id,funcbase,m->id);
791 out_printf(out,"\t%s->%s = NULL;\n",
798 make_arguments(Class *c)
802 out_printf(out,"\n");
803 for(li=c->nodes;li;li=g_list_next(li)) {
809 if(n->type != ARGUMENT_NODE)
815 flags = g_string_new("GTK_ARG_READWRITE");
817 flags = g_string_new("GTK_ARG_READABLE");
819 flags = g_string_new("GTK_ARG_WRITABLE");
821 for(l=a->flags;l;l=g_list_next(l))
822 g_string_sprintfa(flags," | GTK_ARG_%s",(char *)l->data);
824 s = g_strdup(a->name);
826 out_printf(out,"\tgtk_object_add_arg_type(\"%s::%s\",\n"
830 typebase,a->name,a->gtktype,flags->str,s);
832 g_string_free(flags,TRUE);
836 "\n\tgtk_object_class->set_arg = __object_set_arg;\n"
837 "\tgtk_object_class->get_arg = __object_get_arg;\n");
844 for(li=c->nodes;li;li=g_list_next(li)) {
847 if(n->type != METHOD_NODE)
850 if(m->scope == INIT_METHOD) {
852 out_addline_infile(out,m->line_no);
853 print_method(out,"static ","\n"," ","\n",m,FALSE);
855 out_addline_outfile(out);
856 out_printf(out,"{\n");
858 out_printf(out,"\t%s->_priv = "
859 "g_new0 (%sPrivate,1);\n",
860 ((FuncArg *)m->args->data)->name,
863 } else if(m->scope == CLASS_INIT_METHOD) {
865 out_addline_infile(out,m->line_no);
866 print_method(out,"static ","\n"," ","\n",m,FALSE);
868 out_addline_outfile(out);
869 out_printf(out,"{\n");
874 "gtk_object_class = "
875 "(GtkObjectClass*) %s;\n",
876 ((FuncArg *)m->args->data)->name);
880 ((FuncArg *)m->args->data)->name,
881 (signals>0 || arguments>0));
883 out_printf(out,"\n\tparent_class = ");
885 out_printf(out,"(%sClass *)",ptypebase);
886 out_printf(out,"gtk_type_class (%s_get_type ());\n",
892 set_def_handlers(c, ((FuncArg *)m->args->data)->name);
900 if(m->cbuf && *m->cbuf->str) {
901 out_printf(out," {\n");
902 out_addline_infile(out,m->ccode_line);
903 out_printf(out,"%s\n",m->cbuf->str);
904 out_addline_outfile(out);
905 out_printf(out," }\n",m->cbuf->str);
907 out_printf(out,"return;\n");
909 out_printf(out,"}\n");
914 add_getset_arg(Class *c, int is_set)
917 out_printf(out,"\nstatic void\n"
918 "__object_%s_arg (GtkObject *object,\n"
923 "\tself = %s (object);\n\n"
924 "\tswitch (arg_id) {\n",
925 is_set?"set":"get",typebase,macrobase);
927 for(li=c->nodes;li;li=g_list_next(li)) {
933 if(n->type != ARGUMENT_NODE)
938 line_no = a->set_line;
941 line_no = a->get_line;
945 s = g_strdup(a->name);
947 out_printf(out,"\tcase ARG_%s:\n"
948 "#define ARG (GTK_VALUE_%s(*arg))\n"
952 out_addline_infile(out,line_no);
953 out_printf(out,"%s\n",cbuf->str);
954 out_addline_outfile(out);
955 out_printf(out,"\t\t}\n\t\tbreak;\n"
958 out_printf(out,"\tdefault:\n\t\tbreak;\n\t}\n}\n");
962 print_checks(Method *m, FuncArg *fa)
966 is_void = (strcmp(m->mtype->name,"void")==0 &&
967 m->mtype->stars == 0);
969 for(li=fa->checks;li;li=g_list_next(li)) {
970 Check *ch = li->data;
973 out_printf(out,"\tg_return_if_fail (");
975 out_printf(out,"\tg_return_val_if_fail (");
978 out_printf(out,"%s != NULL",fa->name);
981 s = make_pre_macro(fa->atype->name,"IS");
982 out_printf(out,"%s (%s)",s,fa->name);
986 out_printf(out,"%s < %s",fa->name,ch->number);
989 out_printf(out,"%s > %s",fa->name,ch->number);
992 out_printf(out,"%s <= %s",fa->name,ch->number);
995 out_printf(out,"%s >= %s",fa->name,ch->number);
998 out_printf(out,"%s == %s",fa->name,ch->number);
1001 out_printf(out,"%s != %s",fa->name,ch->number);
1005 out_printf(out,");\n");
1007 out_printf(out,", (");
1008 print_type(out,m->mtype,TRUE);
1009 out_printf(out,")%s);\n",
1010 m->onerror?m->onerror:"0");
1016 print_preconditions(Method *m)
1020 for(li=m->args;li;li=g_list_next(li)) {
1021 FuncArg *fa = li->data;
1027 /* put in code if it's needed */
1029 put_in_gen_code(Method *m)
1031 /* now we only have the freeing of the private structure */
1033 m->scope == OVERRIDE_METHOD &&
1034 strcmp(m->id,"destroy")==0) {
1035 out_printf(out,"\tg_free (%s (%s)->_priv);\n"
1036 "\t%s (%s)->_priv = NULL;\n",
1038 ((FuncArg *)m->args->data)->name,
1040 ((FuncArg *)m->args->data)->name);
1046 print_method_body(Method *m, int pre)
1048 out_printf(out,"{\n");
1050 print_preconditions(m);
1053 out_printf(out,"\t{\n");
1055 out_addline_infile(out,m->ccode_line);
1056 out_printf(out,"\t\t%s\n",m->cbuf->str);
1057 out_addline_outfile(out);
1059 out_printf(out,"\t}\n");
1060 out_printf(out,"}\n");
1064 put_method(Method *m)
1067 int private = FALSE;
1069 is_void = (strcmp(m->mtype->name,"void")==0 &&
1070 m->mtype->stars == 0);
1071 out_printf(out,"\n");
1074 out_addline_infile(out,m->line_no);
1075 print_method(out,"","\n"," ","\n",m,FALSE);
1076 print_method_body(m,TRUE);
1079 out_addline_infile(out,m->line_no);
1080 print_method(out,"static ","\n"," ","\n",m,FALSE);
1081 print_method_body(m,TRUE);
1083 case PRIVATE_SIGNAL_FIRST_METHOD:
1084 case PRIVATE_SIGNAL_LAST_METHOD:
1086 case SIGNAL_FIRST_METHOD:
1087 case SIGNAL_LAST_METHOD:
1088 out_addline_infile(out,m->line_no);
1089 print_method(out,private?"static ":"","\n"," ","\n",m,FALSE);
1090 out_addline_outfile(out);
1091 out_printf(out,"{\n");
1092 s = g_strdup(m->id);
1094 if(strcmp(m->mtype->name,"void")==0 &&
1095 m->mtype->stars==0) {
1097 print_preconditions(m);
1098 if(((FuncArg *)m->args->data)->name)
1099 out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n"
1100 "\t\tobject_signals[%s_SIGNAL]",
1101 ((FuncArg *)m->args->data)->name,s);
1102 for(li=m->args->next;li;li=g_list_next(li)) {
1103 FuncArg *fa = li->data;
1104 out_printf(out,",\n\t\t%s",fa->name);
1106 out_printf(out,");\n}\n");
1109 out_printf(out,"\t");
1110 print_type(out,m->mtype,TRUE);
1111 out_printf(out,"return_val;\n");
1112 print_preconditions(m);
1113 out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n"
1114 "\t\tobject_signals[%s_SIGNAL]",
1115 ((FuncArg *)m->args->data)->name,s);
1116 for(li=m->args->next;li;li=g_list_next(li)) {
1117 FuncArg *fa = li->data;
1118 out_printf(out,",\n\t\t%s",fa->name);
1120 out_printf(out,",\n\t\t&return_val);\n"
1121 "\treturn return_val;\n}\n");
1124 if(!m->cbuf || !*m->cbuf->str)
1126 out_addline_infile(out,m->line_no);
1127 print_method(out,"static ","\n_real_"," ","\n",m,FALSE);
1128 print_method_body(m,FALSE);
1130 case PRIVATE_VIRTUAL_METHOD:
1132 case VIRTUAL_METHOD:
1133 out_addline_infile(out,m->line_no);
1134 print_method(out,private?"static ":"","\n"," ","\n",m,FALSE);
1135 out_addline_outfile(out);
1136 out_printf(out,"{\n"
1137 "\t%sClass *klass;\n",typebase);
1138 print_preconditions(m);
1139 out_printf(out,"\tklass = %s_CLASS(GTK_OBJECT(%s)->klass);\n\n"
1140 "\tif(klass->%s)\n",
1141 macrobase, ((FuncArg *)m->args->data)->name, m->id);
1142 if(strcmp(m->mtype->name,"void")==0 &&
1143 m->mtype->stars==0) {
1145 out_printf(out,"\t\t(*klass->%s)(%s",m->id,
1146 ((FuncArg *)m->args->data)->name);
1147 for(li=m->args->next;li;li=g_list_next(li)) {
1148 FuncArg *fa = li->data;
1149 out_printf(out,",%s",fa->name);
1151 out_printf(out,");\n}\n");
1154 out_printf(out,"\t\treturn (*klass->%s)(%s",m->id,
1155 ((FuncArg *)m->args->data)->name);
1156 for(li=m->args->next;li;li=g_list_next(li)) {
1157 FuncArg *fa = li->data;
1158 out_printf(out,",%s",fa->name);
1160 out_printf(out,");\n"
1163 print_type(out,m->mtype,TRUE);
1164 out_printf(out,")(%s);\n}\n",
1165 m->onerror?m->onerror:"0");
1168 if(!m->cbuf || !*m->cbuf->str)
1170 out_addline_infile(out,m->line_no);
1171 print_method(out,"static ","\n_real_"," ","\n",m,FALSE);
1172 print_method_body(m,FALSE);
1174 case OVERRIDE_METHOD:
1175 out_addline_infile(out,m->line_no);
1176 print_method(out,"static ","\n"," ","\n",m,FALSE);
1177 s = replace_sep(m->otype,'_');
1180 out_printf(out,"#define PARENT_HANDLER(args...) \\\n"
1181 "\t{ if(%s_CLASS(parent_class)->%s) \\\n"
1182 "\t\t(* %s_CLASS(parent_class)->%s)(##args); }\n",
1185 out_printf(out,"#define PARENT_HANDLER(args...) \\\n"
1186 "\t((%s_CLASS(parent_class)->%s)? \\\n"
1187 "\t\t(* %s_CLASS(parent_class)->%s)(##args): \\\n"
1190 out_printf(out,"(");
1191 print_type(out,m->mtype,TRUE);
1192 out_printf(out,")%s))\n",
1193 m->onerror?m->onerror:"0");
1196 print_method_body(m,TRUE);
1197 out_printf(out,"#undef PARENT_HANDLER\n");
1205 check_duplicate(Class *c,Node *node,char *id, int line_no)
1208 for(l=c->nodes;l;l=g_list_next(l)) {
1213 if(n->type == METHOD_NODE) {
1214 Method *m = (Method *)n;
1216 nline_no = m->line_no;
1217 } else if(n->type == VARIABLE_NODE) {
1218 Variable *v = (Variable *)n;
1220 nline_no = v->line_no;
1224 line_no>=nline_no ||
1225 strcmp(nid,id)!=0 ||
1226 n->type != node->type)
1228 s = g_strdup_printf("symbol '%s' redefined, "
1229 "first defined on line %d",
1231 print_error(FALSE,s,nline_no);
1236 check_duplicate_symbols(Class *c)
1239 for(l=c->nodes;l;l=g_list_next(l)) {
1241 if(n->type == METHOD_NODE) {
1242 Method *m = (Method *)n;
1243 check_duplicate(c,n,m->id,m->line_no);
1244 } else if(n->type == VARIABLE_NODE) {
1245 Variable *v = (Variable *)n;
1246 check_duplicate(c,n,v->id,v->line_no);
1252 check_bad_symbols(Class *c)
1255 for(l=c->nodes;l;l=g_list_next(l)) {
1257 if(n->type == METHOD_NODE) {
1258 Method *m = (Method *)n;
1259 if((m->scope == SIGNAL_LAST_METHOD ||
1260 m->scope == SIGNAL_FIRST_METHOD ||
1261 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
1262 m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
1263 m->scope == VIRTUAL_METHOD ||
1264 m->scope == PRIVATE_VIRTUAL_METHOD) &&
1265 strcmp(m->id,"__parent__")==0) {
1267 s = g_strdup_printf("'%s' not allowed as an "
1268 "identifier of signal "
1269 "or virtual methods",
1271 print_error(FALSE,s,m->line_no);
1274 } else if(n->type == VARIABLE_NODE) {
1275 Variable *v = (Variable *)n;
1276 if(strcmp(v->id,"_priv")==0 ||
1277 strcmp(v->id,"__parent__")==0) {
1279 s = g_strdup_printf("'%s' not allowed as a data "
1280 "member name",v->id);
1281 print_error(FALSE,s,v->line_no);
1290 check_duplicate_named(Class *c,Node *node,char *id, int line_no)
1293 for(l=c->nodes;l;l=g_list_next(l)) {
1298 if(n->type == METHOD_NODE) {
1299 Method *m = (Method *)n;
1300 if(m->scope == SIGNAL_LAST_METHOD ||
1301 m->scope == SIGNAL_FIRST_METHOD ||
1302 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
1303 m->scope == PRIVATE_SIGNAL_FIRST_METHOD) {
1305 nline_no = m->line_no;
1308 } else if(n->type == ARGUMENT_NODE) {
1309 Argument *a = (Argument *)n;
1311 nline_no = a->line_no;
1315 line_no>=nline_no ||
1318 s = g_strdup_printf("named symbol (argument or signal) '%s' "
1319 "redefined, first defined on line %d",
1321 print_error(FALSE,s,nline_no);
1326 check_duplicate_signals_args(Class *c)
1329 for(l=c->nodes;l;l=g_list_next(l)) {
1331 if(n->type == METHOD_NODE) {
1332 Method *m = (Method *)n;
1333 if(m->scope == SIGNAL_LAST_METHOD ||
1334 m->scope == SIGNAL_FIRST_METHOD ||
1335 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
1336 m->scope == PRIVATE_SIGNAL_FIRST_METHOD)
1337 check_duplicate_named(c,n,m->id,m->line_no);
1338 } else if(n->type == ARGUMENT_NODE) {
1339 Argument *a = (Argument *)n;
1340 check_duplicate_named(c,n,a->name,a->line_no);
1346 check_public_new(Class *c)
1349 for(l=c->nodes;l;l=g_list_next(l)) {
1351 if(n->type == METHOD_NODE) {
1352 Method *m = (Method *)n;
1353 if(m->scope!=PUBLIC_SCOPE &&
1354 strcmp(m->id,"new")==0)
1356 "'new' should be a public method",
1363 check_vararg(Class *c)
1366 for(l=c->nodes;l;l=g_list_next(l)) {
1368 if(n->type == METHOD_NODE) {
1369 Method *m = (Method *)n;
1372 if(m->scope == OVERRIDE_METHOD ||
1373 m->scope == SIGNAL_LAST_METHOD ||
1374 m->scope == SIGNAL_FIRST_METHOD ||
1375 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
1376 m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
1377 m->scope == VIRTUAL_METHOD ||
1378 m->scope == PRIVATE_VIRTUAL_METHOD) {
1380 "signals, overrides and virtuals, "
1381 "can't have variable argument "
1390 check_firstarg(Class *c)
1393 for(l=c->nodes;l;l=g_list_next(l)) {
1395 if(n->type == METHOD_NODE) {
1396 Method *m = (Method *)n;
1399 if(m->scope == OVERRIDE_METHOD ||
1400 m->scope == SIGNAL_LAST_METHOD ||
1401 m->scope == SIGNAL_FIRST_METHOD ||
1402 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
1403 m->scope == PRIVATE_SIGNAL_FIRST_METHOD ||
1404 m->scope == VIRTUAL_METHOD ||
1405 m->scope == PRIVATE_VIRTUAL_METHOD) {
1407 "signals, overrides and virtuals, "
1408 "can't have no arguments",
1416 count_signals(Class *c)
1420 for(l=c->nodes;l;l=g_list_next(l)) {
1422 if(n->type == METHOD_NODE) {
1423 Method *m = (Method *)n;
1424 if(m->scope == SIGNAL_LAST_METHOD ||
1425 m->scope == SIGNAL_FIRST_METHOD ||
1426 m->scope == PRIVATE_SIGNAL_LAST_METHOD ||
1427 m->scope == PRIVATE_SIGNAL_FIRST_METHOD)
1435 count_arguments(Class *c)
1440 for(li=c->nodes;li;li=g_list_next(li)) {
1442 if(n->type == ARGUMENT_NODE)
1449 count_overrides(Class *c)
1453 for(l=c->nodes;l;l=g_list_next(l)) {
1455 if(n->type == METHOD_NODE) {
1456 Method *m = (Method *)n;
1457 if(m->scope == OVERRIDE_METHOD)
1465 count_privates(Class *c)
1469 for(l=c->nodes;l;l=g_list_next(l)) {
1471 if(n->type == VARIABLE_NODE) {
1472 Variable *v = (Variable *)n;
1473 if(v->scope == PRIVATE_SCOPE)
1484 char *outfile,*outfileh,*outfileph;
1487 outfile = g_strconcat(filebase,".c",NULL);
1489 outfile = g_strconcat(filebase,".cc",NULL);
1490 if(no_touch_headers)
1491 outfileh = g_strconcat("#gob#",filebase,".h#gob#",NULL);
1493 outfileh = g_strconcat(filebase,".h",NULL);
1495 if((privates>0 || always_private_header) &&
1497 outfileph = g_strconcat(filebase,"-private.h",NULL);
1502 out = fopen(outfile,"w");
1504 g_error("Cannot open outfile: %s",outfile);
1506 outh = fopen(outfileh,"w");
1508 g_error("Cannot open outfile: %s",outfileh);
1511 outph = fopen(outfileph,"w");
1513 g_error("Cannot open outfile: %s",outfileh);
1519 generate_outfiles(void)
1524 gboolean found_header;
1527 out_printf(outh,"/* Generated by GOB (v%s)"
1528 " (do not edit directly) */\n\n",VERSION);
1530 out_printf(outph,"/* Generated by GOB (v%s)"
1531 " (do not edit directly) */\n\n",VERSION);
1532 out_printf(out,"/* Generated by GOB (v%s) on %s"
1533 " (do not edit directly) */\n\n",VERSION,ctime(&curtime));
1535 p = replace_sep(((Class *)class)->otype,'_');
1537 out_printf(outh,"#ifndef __%s_H__\n#define __%s_H__\n\n"
1538 "#include <gtk/gtk.h>\n\n",p,p);
1540 out_printf(outph,"#ifndef __%s_PRIVATE_H__\n"
1541 "#define __%s_PRIVATE_H__\n\n"
1542 "#include \"%s.h\"\n\n",p,p,filebase);
1546 out_printf(outh,"#ifdef __cplusplus\n"
1548 "#endif /* __cplusplus */\n\n");
1550 out_printf(outph,"#ifdef __cplusplus\n"
1552 "#endif /* __cplusplus */\n\n");
1555 p = g_strconcat(filebase,".h",NULL);
1556 found_header = TRUE;
1557 if(!g_list_find_custom(include_files,p,(GCompareFunc)strcmp)) {
1558 out_printf(out,"#include \"%s.h\"\n\n",filebase);
1559 found_header = FALSE;
1563 /* if we are creating a private header see if it was included */
1565 p = g_strconcat(filebase,"-private.h",NULL);
1566 if(!g_list_find_custom(include_files,p,(GCompareFunc)strcmp)) {
1567 out_printf(out,"#include \"%s-private.h\"\n\n",
1571 "Implicit private header include "
1573 "\tsource file, while public "
1574 "header is at a custom location, "
1576 "\texplicitly include "
1577 "the private header below the "
1583 for(li=nodes;li;li=g_list_next(li)) {
1584 Node *node = li->data;
1585 if(node->type == CCODE_NODE) {
1586 CCode *cc = (CCode *)node;
1590 out_printf(fp,"\n");
1593 out_printf(fp,"\n");
1594 out_addline_infile(fp,cc->line_no);
1596 out_printf(fp,"%s\n",cc->cbuf->str);
1598 out_addline_outfile(fp);
1599 } else if(node->type == CLASS_NODE) {
1600 Class *c = (Class *)class;
1603 out_printf(outh,"\n#define %s\t"
1604 "(%s_get_type())\n",
1605 macrotype,funcbase);
1606 out_printf(outh,"#define %s(obj)\t"
1607 "GTK_CHECK_CAST((obj),%s_get_type(),%s)\n",
1608 macrobase,funcbase,typebase);
1609 out_printf(outh,"#define %s_CLASS(klass)\t"
1610 "GTK_CHECK_CLASS_CAST((klass),%s_get_type(),%sClass)\n",
1611 macrobase,funcbase,typebase);
1612 out_printf(outh,"#define %s(obj)\t"
1613 "GTK_CHECK_TYPE((obj), %s_get_type ())\n\n",
1617 out_printf(outh,"\ntypedef struct _%sPrivate %sPrivate;\n",typebase,typebase);
1619 out_printf(outh,"\ntypedef struct _%s %s;\n",typebase,typebase);
1620 out_printf(outh,"struct _%s {\n\t%s __parent__;\n",
1621 typebase,ptypebase);
1622 for(l=c->nodes;l;l=g_list_next(l)) {
1624 Variable *v = (Variable *)n;
1625 if(n->type == VARIABLE_NODE &&
1626 v->scope == PUBLIC_SCOPE)
1627 put_variable((Variable *)n,outh);
1630 out_printf(outh,"\t%sPrivate *_priv;\n",typebase);
1631 out_printf(outh,"};\n");
1636 /* if we are to stick this into the private
1637 header, otherwise stick it directly into the
1644 out_printf(outfp,"struct _%sPrivate {\n",
1646 for(l=c->nodes;l;l=l->next) {
1648 Variable *v = (Variable *)n;
1649 if(n->type == VARIABLE_NODE &&
1650 v->scope == PRIVATE_SCOPE) {
1651 out_addline_infile(outfp,v->line_no);
1652 put_variable(v,outfp);
1655 out_addline_outfile(outfp);
1656 out_printf(outfp,"};\n");
1659 out_printf(outh,"\ntypedef struct _%sClass %sClass;\n",
1662 "struct _%sClass {\n\t%sClass __parent__;\n",
1663 typebase,ptypebase);
1664 for(l=c->nodes;l;l=g_list_next(l)) {
1666 if(n->type == METHOD_NODE)
1667 put_vs_method((Method *)n);
1669 out_printf(outh,"};\n\n");
1671 out_printf(outh,"guint\t%s_get_type\t(void);\n",funcbase);
1674 out_printf(out,"static void __object_set_arg "
1675 "(GtkObject *object, GtkArg *arg, "
1677 "static void __object_get_arg "
1678 "(GtkObject *object, GtkArg *arg, "
1679 "guint arg_id);\n");
1682 for(l=c->nodes;l;l=g_list_next(l)) {
1684 if(n->type == METHOD_NODE) {
1685 put_pub_method((Method *)n);
1686 put_priv_method_prot((Method *)n);
1691 for(l=c->nodes;l;l=g_list_next(l)) {
1693 if(n->type == METHOD_NODE) {
1694 add_signal_prots((Method *)n);
1703 make_method_pointers(c);
1705 out_printf(out,"#define GET_NEW (gtk_type_new(%s_get_type()))\n",
1711 add_getset_arg(c, TRUE);
1712 add_getset_arg(c, FALSE);
1715 for(l=c->nodes;l;l=g_list_next(l)) {
1717 if(n->type == METHOD_NODE) {
1718 put_method((Method *)n);
1722 out_printf(out,"#undef GET_NEW\n");
1724 add_bad_hack_to_avoid_unused_warnings(c);
1726 g_assert_not_reached();
1730 out_printf(outh,"\n#ifdef __cplusplus\n"
1732 "#endif /* __cplusplus */\n");
1733 out_printf(outh,"\n#endif");
1736 out_printf(outph,"\n#ifdef __cplusplus\n"
1738 "#endif /* __cplusplus */\n");
1739 out_printf(outph,"\n#endif");
1745 usage(poptContext optCon, int exitcode, char *error, char *addl)
1747 poptPrintUsage(optCon, stderr, 0);
1748 if (error) fprintf(stderr, "%s: %s", error, addl);
1756 fprintf(stderr,"Gob version %s\n\n",VERSION);
1757 fprintf(stderr,"Options:\n"
1758 "\t--help,-h,-? Display this help\n"
1759 "\t--exit-on-warn,-w Exit with an error on warnings\n"
1760 "\t--no-exit-on-warn Don't exit on warnings [default]\n"
1761 "\t--for-cpp Create C++ files\n"
1762 "\t--no-touch-headers Don't touch headers unless they "
1764 "\t--always-private-header Always create a private header "
1765 "file, even if it would be empty\n"
1766 "\t--no-private-header Don't create a private header, "
1767 "put private structure inside c "
1772 parse_options(int argc, char *argv[])
1775 int got_file = FALSE;
1776 int no_opts = FALSE;
1780 for(i=1;i<argc;i++) {
1781 if(no_opts || argv[i][0]!='-') {
1784 fprintf(stderr,"Specify only one file!\n");
1790 } else if(strcmp(argv[i],"--help")==0) {
1793 } else if(strcmp(argv[i],"--exit-on-warn")==0) {
1794 exit_on_warn = TRUE;
1795 } else if(strcmp(argv[i],"--no-exit-on-warn")==0) {
1796 exit_on_warn = FALSE;
1797 } else if(strcmp(argv[i],"--for-cpp")==0) {
1799 } else if(strcmp(argv[i],"--no-touch-headers")==0) {
1800 no_touch_headers = TRUE;
1801 } else if(strcmp(argv[i],"--always-private-header")==0) {
1802 no_private_header = FALSE;
1803 always_private_header = TRUE;
1804 } else if(strcmp(argv[i],"--no-private-header")==0) {
1805 always_private_header = FALSE;
1806 no_private_header = TRUE;
1807 } else if(strcmp(argv[i],"--")==0) {
1808 /*further arguments are files*/
1810 } else if(strncmp(argv[i],"--",2)==0) {
1811 /*unknown long option*/
1812 fprintf(stderr,"Unknown option '%s'!\n",argv[i]);
1816 /*by now we know we have a string starting with
1817 - which is a short option string*/
1818 char *p = argv[i]+1;
1819 for(p=argv[i]+1;*p;p++) {
1830 "Unknown option '%c'!\n",*p);
1840 compare_and_move_header(void)
1842 char *hfnew = g_strconcat("#gob#",filebase,".h#gob#",NULL);
1843 char *hf = g_strconcat(filebase,".h",NULL);
1845 if(stat(hf,&s)==0) {
1847 s = g_strdup_printf("cmp '%s' '%s' > /dev/null",hf,hfnew);
1849 if(unlink(hfnew)!=0)
1850 print_error(FALSE,"Can't remove new header file",0);
1858 print_error(FALSE,"Can't remove old header file",0);
1860 if(rename(hfnew,hf)!=0)
1861 print_error(FALSE,"Can't rename new header file",0);
1867 main(int argc, char *argv[])
1873 struct poptOption optionsTable[] = {
1874 { "exit-on-warn", 'w', 0, &exit_on_warn, 0,
1875 "exit on warnings" },
1877 { NULL, 0, 0, NULL, 0 }
1880 optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
1881 poptSetOtherOptionHelp(optCon, "[OPTIONS]* [filename]");
1883 while ((c = poptGetNextOpt(optCon)) >= 0)
1886 filename = poptGetArg(optCon);
1887 if(!(poptPeekArg(optCon) == NULL))
1888 usage(optCon, 1, "Specify only one file",
1889 ".e.g., filename.gob");
1892 /* an error occurred during option processing */
1893 fprintf(stderr, "%s: %s\n",
1894 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
1900 parse_options(argc,argv);
1903 yyin = fopen(filename,"r");
1905 fprintf(stderr,"Error: can't open file '%s'\n",
1914 g_error("Parsing errors, quitting");
1916 print_error(FALSE," no class defined",0);
1919 exit_on_error = FALSE;
1921 signals = count_signals((Class *)class);
1922 arguments = count_arguments((Class *)class);
1923 overrides = count_overrides((Class *)class);
1924 privates = count_privates((Class *)class);
1927 make_inits((Class *)class);
1929 make_destroy((Class *)class);
1930 check_bad_symbols((Class *)class);
1931 check_duplicate_symbols((Class *)class);
1932 check_duplicate_signals_args((Class *)class);
1933 check_public_new((Class *)class);
1934 check_vararg((Class *)class);
1935 check_firstarg((Class *)class);
1937 exit_on_error = TRUE;
1944 generate_outfiles();
1949 if(no_touch_headers)
1950 compare_and_move_header();
1953 poptFreeContext(optCon);