Reapplied r44288:
[AROS.git] / tools / genmodule / config.h
blob15923ea5dde0c029a75d70041fd23e5a1ea53e9e
1 /*
2 Copyright © 1995-2011, 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 };
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
26 enum optionflags
28 OPTION_NOAUTOLIB = 1<<BIT_NOAUTOLIB,
29 OPTION_NOEXPUNGE = 1<<BIT_NOEXPUNGE,
30 OPTION_NORESIDENT = 1<<BIT_NORESIDENT,
31 OPTION_DUPBASE = 1<<BIT_DUPBASE,
32 OPTION_PERTASKBASE = 1<<BIT_PERTASKBASE,
33 OPTION_INCLUDES = 1<<BIT_INCLUDES,
34 OPTION_NOINCLUDES = 1<<BIT_NOINCLUDES,
35 OPTION_STUBS = 1<<BIT_STUBS,
36 OPTION_NOSTUBS = 1<<BIT_NOSTUBS,
37 OPTION_AUTOINIT = 1<<BIT_AUTOINIT,
38 OPTION_NOAUTOINIT = 1<<BIT_NOAUTOINIT,
39 OPTION_RESAUTOINIT = 1<<BIT_RESAUTOINIT,
40 OPTION_NOOPENCLOSE = 1<<BIT_NOOPENCLOSE,
41 OPTION_SELFINIT = 1<<BIT_SELFINIT
44 enum coptionbit { CBIT_PRIVATE };
45 enum coptionflags { COPTION_PRIVATE = 1<<CBIT_PRIVATE };
47 enum intcfgbit { BIT_GENASTUBS, BIT_NOREADFUNCS };
48 enum intcfgflags
50 CFG_GENASTUBS = 1<<BIT_GENASTUBS,
51 CFG_NOREADFUNCS = 1<<BIT_NOREADFUNCS /* all needed functions are available */
54 /* Classinfo is used to store the information of a BOOPSI class */
55 struct classinfo
57 struct classinfo *next;
59 /* Type and name of the class */
60 enum modtype classtype;
61 char *basename;
63 /* Priority with which the class will be initialized */
64 int initpri;
66 /* Additional options for the class */
67 enum coptionflags options;
69 const char **boopsimprefix;
70 char *classid, *superclass, *superclass_field, *classptr_field, *classptr_var;
71 char *dispatcher; /* == NULL when the generated dispatcher is used,
72 * otherwise it is the function name of the dispatcher */;
73 char *classdatatype; /* The type of the data for every object */
75 struct functionhead *methlist;
77 /* Interfaces used in this class (only for HIDD classes) */
78 struct stringlist *interfaces;
81 /* DOS handlers */
82 struct handlerinfo {
83 struct handlerinfo *next;
85 enum {
86 HANDLER_DOSTYPE, /* FileSysResource registered */
87 HANDLER_DOSNODE, /* Non-bootable DOS device */
88 HANDLER_RESIDENT, /* AddSegment() registered */
89 } type;
90 unsigned int id;
91 char *name;
92 int autodetect; /* Autodetect priority (0 for not autodetectable) */
93 /* DeviceNode overrides */
94 int priority; /* Task priority */
95 int stacksize; /* Stacksize information */
97 char *handler; /* Name of the handler */
100 struct config
102 /* members that store filename and paths derived from argv */
103 char *conffile, *gendir, *genincdir;
105 /* The name and type of the module */
106 char *modulename, *modulenameupper;
107 enum modtype modtype;
108 char *suffix;
110 /* Extra string to include in version */
111 char *versionextra;
113 /* firstlvo is the LVO number of the first user definable function
114 * in the module
116 unsigned int firstlvo;
118 /* What to do ? */
119 enum command command;
121 /* Name for variables and types */
122 char *basename, *libbase, *libbasetype, *libbasetypeptrextern;
125 /* The default path to put the module relative to SYS: */
126 char *moddir;
128 /* The names of the fields in the custom library base for storing internal
129 * information
131 char *sysbase_field, *seglist_field, *rootbase_field, *oopbase_field;
133 /* Some additional options, see optionsflags enum above */
134 enum optionflags options;
136 /* Internal configuration flags */
137 enum intcfgflags intcfg;
139 /* Further configuration data for the generated Resident struct */
140 char *datestring, *copyright;
141 int residentpri;
142 unsigned int majorversion, minorversion;
143 char *addromtag;
145 /* In forcelist a list of basenames is present that need to be present in the
146 * static link library so that certain libraries are opened by a program
148 struct stringlist *forcelist;
150 /* Code to add to the generated files */
151 struct stringlist *cdeflines, *cdefprivatelines, *startuplines;
153 /* device specific data */
154 char *beginiofunc, *abortiofunc;
156 /* The functions of this module */
157 struct functionhead *funclist;
159 /* The classes defined in this module */
160 struct classinfo *classlist;
162 /* The DOS IDs and handlers for this module */
163 struct handlerinfo *handlerlist;
166 /* Function prototypes */
168 struct config *initconfig(int, char **);
170 char* getBanner(struct config*);
171 void freeBanner(char*);
173 #endif //_CONFIG_H