revert between 56095 -> 55830 in arch
[AROS.git] / tools / genmodule / writeskel.c
blob3aabaad3af71f5e2c0dcff55f6580420399833a9
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 The code for creating skeleton files for the functions present in the module
6 */
7 #include <string.h>
8 #include <assert.h>
9 #include "functionhead.h"
10 #include "config.h"
12 static void writeskelfunc(struct config *cfg, struct functionhead *funclist)
14 FILE *out;
15 char line[256], *banner;
16 struct functionarg *arglistit;
17 char *type, *name;
18 int first;
20 snprintf(line, 255, "%s/%s.c", cfg->gendir, funclist->internalname);
21 out = fopen(line, "w");
23 if (out == NULL)
25 perror(line);
26 exit(20);
29 fprintf(out,
30 "/*\n"
31 " Copyright \xA9 <year>, The AROS Development Team. All rights reserved.\n"
32 " $I" "d$\n"
33 "*/\n\n"
36 if (funclist->libcall == REGISTERMACRO)
38 fprintf(out,
39 "/*****************************************************************************\n\n"
40 " NAME */\n"
41 " AROS_LH%d(%s, %s,\n\n"
42 "/* SYNOPSIS */\n",
43 funclist->argcount, funclist->type, funclist->internalname
46 for (arglistit = funclist->arguments;
47 arglistit!=NULL;
48 arglistit = arglistit->next
51 type = getargtype(arglistit);
52 name = getargname(arglistit);
53 assert(name != NULL && type != NULL);
55 fprintf(out,
56 " AROS_LHA(%s, %s, %s),\n",
57 type, name, arglistit->reg
59 free(type);
60 free(name);
63 fprintf(out,
64 "\n/* LOCATION */\n"
65 " %s, %s, %u, %s)\n\n"
66 "/* FUNCTION\n\n"
67 " INPUTS\n\n"
68 " RESULT\n\n"
69 " NOTES\n\n"
70 " EXAMPLE\n\n"
71 " BUGS\n\n"
72 " SEE ALSO\n\n"
73 " INTERNALS\n\n"
74 " HISTORY\n\n"
75 "*****************************************************************************/\n"
76 "{\n"
77 " AROS_LIBFUNC_INIT\n\n"
78 " AROS_LIBFUNC_EXIT\n"
79 "}\n\n",
80 cfg->libbasetypeptrextern, cfg->libbase, funclist->lvo, cfg->basename
85 void writeskel(struct config *cfg)
87 struct functionhead *funclistit;
89 for(funclistit = cfg->funclist; funclistit != NULL; funclistit = funclistit->next)
91 writeskelfunc(cfg, funclistit);