added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / tools / genmodule / writeincproto.c
blob3264b0ea92d1df0624144e046fd2c307e66f69b4
1 /*
2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
4 Desc: Function to write proto/modulename.h. Part of genmodule.
5 */
6 #include "genmodule.h"
8 void writeincproto(struct config *cfg)
10 FILE *out;
11 char line[256];
12 struct linelist *linelistit;
14 snprintf(line, 255, "%s/proto/%s.h", cfg->gendir, cfg->modulename);
15 out = fopen(line, "w");
17 if (out == NULL)
19 perror(line);
20 exit(20);
23 fprintf(out,
24 "#ifndef PROTO_%s_H\n"
25 "#define PROTO_%s_H\n"
26 "\n"
27 "%s"
28 "\n"
29 "#include <exec/types.h>\n"
30 "#include <aros/system.h>\n"
31 "\n"
32 "#include <clib/%s_protos.h>\n"
33 "\n"
34 "#if !defined(%s) && !defined(__NOLIBBASE__) && !defined(__%s_NOLIBBASE__)\n"
35 " #ifdef __%s_STDLIBBASE__\n"
36 " extern struct Library *%s;\n"
37 " #else\n"
38 " extern %s%s;\n"
39 " #endif\n"
40 "#endif\n"
41 "\n",
42 cfg->modulenameupper, cfg->modulenameupper, getBanner(cfg),
43 cfg->modulename,
44 cfg->libbase, cfg->modulenameupper,
45 cfg->modulenameupper,
46 cfg->libbase,
47 cfg->libbasetypeptrextern, cfg->libbase
50 fprintf(out,
51 "#if !defined(NOLIBDEFINES) && !defined(%s_NOLIBDEFINES)\n"
52 "# include <defines/%s.h>\n"
53 "#endif\n"
54 "\n"
55 "#endif /* PROTO_%s_H */\n",
56 cfg->modulenameupper, cfg->modulename, cfg->modulenameupper
58 fclose(out);