/* * Emit the C-routine for the given definition */ void emit(definition * def) { if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) { return; } print_header(def); switch (def->def_kind) { case DEF_UNION: emit_union(def); break; case DEF_ENUM: emit_enum(def); break; case DEF_STRUCT: emit_struct(def); break; case DEF_TYPEDEF: emit_typedef(def); break; default: break; } print_trailer(); }
/* * Emit the C-routine for the given definition */ void emit(definition *def) { if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) { return; } print_header(def); switch (def->def_kind) { case DEF_UNION: fprintf(stderr, "*** Error: Union not supported\n"); exit(1); emit_union(def); break; case DEF_ENUM: emit_enum(def); break; case DEF_STRUCT: emit_struct(def); break; case DEF_TYPEDEF: emit_typedef(def); break; default: printf("emit default\n"); break; } print_trailer(); }
/* * Emit the C-routine for the given definition */ void emit(definition *def) { if (def->def_kind == DEF_CONST) { return; } if (def->def_kind == DEF_PROGRAM) { emit_program(def); return; } if (def->def_kind == DEF_TYPEDEF) { /* * now we need to handle declarations like * struct typedef foo foo; * since we dont want this to be expanded into 2 calls to xdr_foo */ if (strcmp(def->def.ty.old_type, def->def_name) == 0) return; } print_header(def); switch (def->def_kind) { case DEF_UNION: emit_union(def); break; case DEF_ENUM: emit_enum(def); break; case DEF_STRUCT: emit_struct(def); break; case DEF_TYPEDEF: emit_typedef(def); break; /* DEF_CONST and DEF_PROGRAM have already been handled */ default: break; } print_trailer(); }