2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
5 Function to write module_autoinit.c. Part of genmodule.
9 void writeautoinit(struct config
*cfg
)
12 char line
[256], *banner
;
13 struct stringlist
*linelistit
;
15 snprintf(line
, 255, "%s/%s_autoinit.c", cfg
->gendir
, cfg
->modulename
);
16 out
= fopen(line
, "w");
24 banner
= getBanner(cfg
);
28 "#include <proto/%s.h>\n"
29 "#include <aros/symbolsets.h>\n"
31 "ADD2LIBS((CONST_STRPTR)\"%s.library\",%u, %s, %s);\n",
32 banner
, cfg
->modulename
,
33 cfg
->modulename
, cfg
->majorversion
, cfg
->libbasetypeptrextern
, cfg
->libbase
37 /* Write the code to be added to startup provided in the config file */
38 for (linelistit
= cfg
->startuplines
; linelistit
!= NULL
; linelistit
= linelistit
->next
)
40 fprintf(out
, "%s\n", linelistit
->s
);
43 if (cfg
->forcelist
!=NULL
)
45 struct stringlist
* forcelistit
;
48 for (forcelistit
= cfg
->forcelist
;
50 forcelistit
= forcelistit
->next
53 fprintf(out
, "extern struct Library *%s;\n", forcelistit
->s
);
55 fprintf(out
, "\nvoid __%s_forcelibs(void)\n{\n", cfg
->modulename
);
56 for (forcelistit
= cfg
->forcelist
;
58 forcelistit
= forcelistit
->next
61 fprintf(out
, " %s = NULL;\n", forcelistit
->s
);