3 * header simplification -
4 * output only stack args forced to basic types
8 * This work is licensed under the terms of 3-clause BSD license.
9 * See COPYING file in the top-level directory.
16 #include "my_assert.h"
20 #include "protoparse.h"
22 static const char *output_type(const struct parsed_type *type)
26 else if (type->is_64bit)
28 else if (IS(type->name, "void"))
34 int main(int argc, char *argv[])
36 const struct parsed_proto *pp;
41 printf("usage:\n%s <hdr_out.h> <hdr_in.h>\n", argv[0]);
46 fhdr = fopen(hdrfn, "r");
47 my_assert_not(fhdr, NULL);
48 fout = fopen(argv[1], "w");
49 my_assert_not(fout, NULL);
53 for (i = 0; i < pp_cache_size; i++) {
55 if (!pp->is_func || pp->is_fptr || pp->is_osinc)
58 if (pp->argc_reg != 0)
59 fprintf(fout, "// %d reg args\n", pp->argc_reg);
60 fprintf(fout, "%-4s ", output_type(&pp->ret_type));
61 if (!pp->is_stdcall || pp->argc_stack == 0)
62 fprintf(fout, "__cdecl ");
64 fprintf(fout, "__stdcall ");
65 fprintf(fout, "%s(", pp->name);
67 for (a = a_out = 0; a < pp->argc; a++) {
68 if (pp->arg[a].reg != NULL || pp->arg[a].type.is_retreg)
72 fprintf(fout, "%s", output_type(&pp->arg[a].type));
73 if (pp->arg[a].type.is_64bit)
81 fprintf(fout, ");\n");
91 // vim:ts=2:shiftwidth=2:expandtab