refactored some code. compiles now without suppresing any warning with gcc-6.3.0.
[AROS.git] / tools / genmodule / config.h
blobcfa05b8e675f5ff5adab1d57a12de04399a5890c
1 /*
2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
4 Desc: Define the C structure for storing the command line options and the
5 module config data
6 */
8 #ifndef _CONFIG_H
9 #define _CONFIG_H
11 #include <assert.h>
13 #include "functionhead.h"
14 #include "stringlist.h"
16 enum command { CMD_UNSPECIFIED, FILES, LIBDEFS, INCLUDES, MAKEFILE, WRITEFUNCLIST, WRITEFD, WRITESKEL, WRITETHUNK };
17 enum modtype { UNSPECIFIED, LIBRARY, MCC, MUI, MCP, DEVICE, RESOURCE, IMAGE, GADGET,
18 DATATYPE, CLASS, HIDD, USBCLASS, HANDLER
21 enum optionbit { BIT_NOAUTOLIB, BIT_NOEXPUNGE, BIT_NORESIDENT,
22 BIT_DUPBASE, BIT_PERTASKBASE, BIT_INCLUDES, BIT_NOINCLUDES,
23 BIT_STUBS, BIT_NOSTUBS, BIT_AUTOINIT, BIT_NOAUTOINIT,
24 BIT_RESAUTOINIT, BIT_NOOPENCLOSE, BIT_SELFINIT,
25 BIT_STACKCALL, BIT_RELLINKLIB
27 enum optionflags
29 OPTION_NOAUTOLIB = 1<<BIT_NOAUTOLIB,
30 OPTION_NOEXPUNGE = 1<<BIT_NOEXPUNGE,
31 OPTION_NORESIDENT = 1<<BIT_NORESIDENT,
32 OPTION_DUPBASE = 1<<BIT_DUPBASE,
33 OPTION_PERTASKBASE = 1<<BIT_PERTASKBASE,
34 OPTION_INCLUDES = 1<<BIT_INCLUDES,
35 OPTION_NOINCLUDES = 1<<BIT_NOINCLUDES,
36 OPTION_STUBS = 1<<BIT_STUBS,
37 OPTION_NOSTUBS = 1<<BIT_NOSTUBS,
38 OPTION_AUTOINIT = 1<<BIT_AUTOINIT,
39 OPTION_NOAUTOINIT = 1<<BIT_NOAUTOINIT,
40 OPTION_RESAUTOINIT = 1<<BIT_RESAUTOINIT,
41 OPTION_NOOPENCLOSE = 1<<BIT_NOOPENCLOSE,
42 OPTION_SELFINIT = 1<<BIT_SELFINIT,
43 OPTION_STACKCALL = 1<<BIT_STACKCALL,
44 OPTION_RELLINKLIB = 1<<BIT_RELLINKLIB,
47 enum coptionbit { CBIT_PRIVATE };
48 enum coptionflags { COPTION_PRIVATE = 1<<CBIT_PRIVATE };
50 enum intcfgbit { BIT_GENASTUBS, BIT_NOREADFUNCS };
51 enum intcfgflags
53 CFG_GENASTUBS = 1<<BIT_GENASTUBS,
54 CFG_NOREADFUNCS = 1<<BIT_NOREADFUNCS /* all needed functions are available */
57 /* Classinfo is used to store the information of a BOOPSI class */
58 struct classinfo
60 struct classinfo *next;
62 /* Type and name of the class */
63 enum modtype classtype;
64 char *basename;
66 /* Priority with which the class will be initialized */
67 int initpri;
69 /* Additional options for the class */
70 enum coptionflags options;
72 const char **boopsimprefix;
73 char *classid, *superclass, *superclass_field, *classptr_field, *classptr_var;
74 char *dispatcher; /* == NULL when the generated dispatcher is used,
75 * otherwise it is the function name of the dispatcher */;
76 char *classdatatype; /* The type of the data for every object */
78 struct functionhead *methlist;
80 /* Interfaces used in this class (only for HIDD classes) */
81 struct stringlist *interfaces;
85 /* interfaceinfo is used to store the information of a BOOPSI class */
86 struct interfaceinfo
88 struct interfaceinfo *next;
90 /* id and base name of the interface */
91 char *interfaceid;
92 char *interfacename;
93 char *methodstub;
94 char *methodbase;
95 char *attributebase;
97 struct functionhead *methodlist;
98 struct functionhead *attributelist;
102 /* DOS handlers */
103 struct handlerinfo {
104 struct handlerinfo *next;
106 enum {
107 HANDLER_DOSTYPE, /* FileSysResource registered */
108 HANDLER_DOSNODE, /* Non-bootable DOS device */
109 HANDLER_RESIDENT, /* AddSegment() registered */
110 } type;
111 unsigned int id;
112 char *name;
113 int autodetect; /* Autodetect priority (0 for not autodetectable) */
114 /* DeviceNode overrides */
115 int bootpri; /* Boot priority */
116 int priority; /* Task priority */
117 int stacksize; /* Stacksize information */
118 int startup; /* Startup id */
121 struct config
123 /* members that store filename and paths derived from argv */
124 char *conffile, *gendir, *libgendir, *genincdir;
126 /* The name and type of the module */
127 char *modulename, *modulenameupper;
128 enum modtype modtype;
129 char *modtypestr;
130 char *suffix;
131 char *includename, *includenameupper;
133 /* Extra string to include in version */
134 char *versionextra;
136 /* firstlvo is the LVO number of the first user definable function
137 * in the module
139 unsigned int firstlvo;
141 /* What to do ? */
142 enum command command;
144 /* Name for variables and types */
145 char *basename, *libbase, *libbasetype, *libbasetypeptrextern;
148 /* The default path to put the module relative to SYS: */
149 char *moddir;
151 /* The names of the fields in the custom library base for storing internal
152 * information
154 char *sysbase_field, *seglist_field, *rootbase_field, *oopbase_field;
156 /* Some additional options, see optionsflags enum above */
157 enum optionflags options;
159 /* Internal configuration flags */
160 enum intcfgflags intcfg;
162 /* Further configuration data for the generated Resident struct */
163 char *datestring, *copyright;
164 int residentpri;
165 unsigned int majorversion, minorversion;
166 char *addromtag;
168 /* In forcelist a list of basenames is present that need to be present in the
169 * static link library so that certain libraries are opened by a program
171 struct stringlist *forcelist;
173 /* Code to add to the generated files */
174 struct stringlist *cdeflines, *cdefprivatelines, *stubprivatelines, *startuplines;
176 /* device specific data */
177 char *beginiofunc, *abortiofunc;
179 /* The functions of this module */
180 struct functionhead *funclist;
182 /* The classes defined in this module */
183 struct classinfo *classlist;
185 /* The interface defined in this module */
186 struct interfaceinfo *interfacelist;
188 /* The DOS IDs and handlers for this module */
189 char *handlerfunc;
190 struct handlerinfo *handlerlist;
192 /* Relative libraries used by this library
194 struct stringlist *rellibs;
197 /* Function prototypes */
199 struct config *initconfig(int, char **);
201 char* getBanner(struct config*);
202 void freeBanner(char*);
204 #endif //_CONFIG_H