- FILE *fp;
- if(cc->header) {
- fp = outh;
- out_printf(fp,"\n");
- } else {
- fp = out;
- out_printf(fp,"\n");
- out_addline_infile(fp,cc->line_no);
- }
- out_printf(fp,"%s\n",cc->cbuf);
- if(!cc->header)
- out_addline_outfile(fp);
- } else if(node->type == CLASS_NODE) {
- Class *c = (Class *)class;
- GList *l;
-
- out_printf(out,"/* utility types we may need */\n");
- out_printf(out,"typedef struct { "
- "gpointer a; gpointer b; "
- "} __twopointertype;\n");
- out_printf(out,"typedef struct { "
- "gpointer a; gpointer b; "
- "gpointer c; "
- "} __threepointertype;\n");
-
- 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"
- "GTK_CHECK_CLASS_CAST((klass),%s_get_type(),%sClass)\n",
- macrobase,funcbase,typebase);
- out_printf(outh,"#define %s(obj)\t"
- "GTK_CHECK_TYPE((obj), %s_get_type ())\n\n",
- macrois,funcbase);
-
- if(privates>0)
- out_printf(outh,"\ntypedef struct _%sPrivate %sPrivate;\n",typebase,typebase);
-
- out_printf(outh,"\ntypedef struct _%s %s;\n",typebase,typebase);
- out_printf(outh,"struct _%s {\n\t%s __parent__;\n",
- typebase,ptypebase);
- for(l=c->nodes;l;l=g_list_next(l)) {
- Node *n = l->data;
- Variable *v = (Variable *)n;
- if(n->type == VARIABLE_NODE &&
- v->scope == PUBLIC_SCOPE)
- put_variable((Variable *)n,outh);
- }
- /* put protecteds always AFTER publics */
- for(l=c->nodes;l;l=g_list_next(l)) {
- Node *n = l->data;
- Variable *v = (Variable *)n;
- if(n->type == VARIABLE_NODE &&
- v->scope == PROTECTED_SCOPE)
- put_variable((Variable *)n,outh);
- }
- if(privates>0)
- out_printf(outh,"\t%sPrivate *_priv;\n",typebase);
- out_printf(outh,"};\n");
-
- if(privates>0) {
- FILE *outfp;
-
- /* if we are to stick this into the private
- header, if not stick it directly into the
- C file */
- if(outph)
- outfp = outph;
- else
- outfp = out;
-
- out_printf(outfp,"struct _%sPrivate {\n",
- typebase);
- for(l=c->nodes;l;l=l->next) {
- Node *n = l->data;
- Variable *v = (Variable *)n;
- if(n->type == VARIABLE_NODE &&
- v->scope == PRIVATE_SCOPE) {
- out_addline_infile(outfp,v->line_no);
- put_variable(v,outfp);
- }
- }
- out_addline_outfile(outfp);
- out_printf(outfp,"};\n");
- }