* Changed genmodule so that now no .ref needs to be generated when the
[AROS.git] / tools / genmodule / writemccinit.c
blob7e2dbf2081a1447e0ac8666f7085631d32673632
1 /*
2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
3 $Id$
5 Function to write modulename_mcc_init.c. Part of genmodule.
6 */
7 #include "genmodule.h"
8 #include "boopsisupport.h"
10 void writemccinit(FILE *out, struct config *cfg, struct functions *functions)
12 struct functionhead *methlistit;
13 struct functionarg *arglistit;
14 struct stringlist *linelistit;
15 unsigned int lvo;
17 fprintf
19 out,
20 "/* Initialisation routines of a MUI class */\n"
21 "/* =======================================*/\n"
22 "\n"
23 "#include <dos/dosextens.h>\n"
24 "#include <aros/debug.h>\n"
25 "\n"
26 "#include <intuition/classes.h>\n"
27 "#include <intuition/classusr.h>\n"
28 "\n"
29 "#include <proto/exec.h>\n"
30 "#include <proto/utility.h>\n"
31 "#include <proto/dos.h>\n"
32 "#include <proto/graphics.h>\n"
33 "#include <proto/intuition.h>\n"
34 "#include <proto/muimaster.h>\n"
35 "\n"
36 "#include <aros/symbolsets.h>\n"
37 "\n",
38 cfg->modulename
41 for(linelistit = cfg->cdeflines; linelistit != NULL; linelistit = linelistit->next)
43 fprintf(out, "%s\n", linelistit->s);
46 fprintf
48 out,
49 "\n"
50 "/*** Instance data structure size ***************************************/\n"
51 "#ifndef NO_CLASS_DATA\n"
52 "# define %s_DATA_SIZE (sizeof(struct %s_DATA))\n"
53 "#else\n"
54 "# define %s_DATA_SIZE (0)\n"
55 "#endif\n",
56 cfg->basename, cfg->basename, cfg->basename
59 fprintf
61 out,
62 "\n"
63 "\n"
64 "/*** Variables **************************************************************/\n"
65 "struct MUI_CustomClass *MCC;\n"
66 "\n"
67 "\n"
68 "/*** Prototypes *************************************************************/\n"
71 for
73 methlistit = functions->methlist;
74 methlistit != NULL;
75 methlistit = methlistit->next)
77 int first = 1;
79 fprintf(out, "%s %s__%s(", methlistit->type, cfg->basename, methlistit->name);
81 for
83 arglistit = methlistit->arguments;
84 arglistit != NULL;
85 arglistit = arglistit->next
88 if (!first)
89 fprintf(out, ", ");
90 else
91 first = 0;
93 fprintf(out, "%s", arglistit->arg);
96 fprintf(out, ");\n");
99 writeboopsidispatcher(out, cfg, functions);
101 fprintf
103 out,
104 "\n"
105 "\n"
106 "/*** Library startup and shutdown *******************************************/\n"
107 "AROS_SET_LIBFUNC(MCC_Startup, LIBBASETYPE, LIBBASE)\n"
108 "{\n"
109 " AROS_SET_LIBFUNC_INIT\n"
110 " \n"
111 " MCC = MUI_CreateCustomClass((struct Library *) LIBBASE, \"%s\", NULL, %s_DATA_SIZE, %s_Dispatcher);\n"
112 " \n"
113 " return MCC != NULL;\n"
114 " \n"
115 " AROS_SET_LIBFUNC_EXIT\n"
116 "}\n"
117 "\n"
118 "AROS_SET_LIBFUNC(MCC_Shutdown, LIBBASETYPE, LIBBASE)\n"
119 "{\n"
120 " AROS_SET_LIBFUNC_INIT\n"
121 " \n"
122 " MUI_DeleteCustomClass(MCC);\n"
123 " return TRUE;\n"
124 " \n"
125 " AROS_SET_LIBFUNC_EXIT\n"
126 "}\n"
127 "\n"
128 "ADD2INITLIB(MCC_Startup, 0);\n"
129 "ADD2EXPUNGELIB(MCC_Shutdown, 0);\n",
130 cfg->superclass, cfg->basename, cfg->basename