Added a test for MUIA_Listview_SelectChange.
[AROS.git] / tools / genmodule / writegetlibbase.c
blob695c1162dd4817a3906c704e138e0e63920cfd18
1 /*
2 Copyright © 2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Function to write module_getlibbase.c. Part of genmodule.
6 */
8 #include "genmodule.h"
10 void writegetlibbase(struct config *cfg, int is_rel)
12 FILE *out;
13 char line[256], *banner;
15 snprintf(line, 255, "%s/%s_%sgetlibbase.c",
16 cfg->libgendir, cfg->modulename, is_rel ? "rel" : ""
18 out = fopen(line, "w");
20 if (out==NULL)
22 perror(line);
23 exit(20);
26 banner = getBanner(cfg);
27 fprintf(out, "%s\n", banner);
28 freeBanner(banner);
30 if (!is_rel)
32 fprintf(out,
33 "extern %s%s;\n"
34 "\n"
35 "%s__aros_getbase_%s(void);\n"
36 "\n"
37 "%s__aros_getbase_%s(void)\n"
38 "{\n"
39 " return %s;\n"
40 "}\n",
41 cfg->libbasetypeptrextern, cfg->libbase,
42 cfg->libbasetypeptrextern, cfg->libbase,
43 cfg->libbasetypeptrextern, cfg->libbase,
44 cfg->libbase
47 else /* is_rel */
49 fprintf(out,
50 "#include <exec/types.h>\n"
51 "char *__aros_getoffsettable(void);\n"
52 "extern IPTR __aros_rellib_offset_%s;\n"
53 "\n"
54 "%s__aros_getbase_%s(void);\n"
55 "\n"
56 "%s__aros_getbase_%s(void)\n"
57 "{\n"
58 " return *((%s*)(__aros_getoffsettable()+__aros_rellib_offset_%s));\n"
59 "}\n",
60 cfg->libbase,
61 cfg->libbasetypeptrextern, cfg->libbase,
62 cfg->libbasetypeptrextern, cfg->libbase,
63 cfg->libbasetypeptrextern, cfg->libbase
66 fclose(out);