Debian Codegraph @

pconf/pconf.h

raw symbols SCIP
1 /*
2 * cconf header file, all #included resources and prototypes used
3 * by pconf must be specified here.
4 *
5 * None of pconf's sources #include anything or assume anything
6 * defined that is not in here.
7 *
8 * See README and AUTHORS file for details of purpose and
9 * maintainers.
10 */
11 #ifndef PCONF_H
12 #define PCONF_H
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <ctype.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19
20 #ifndef ISCR
21 # define ISCR(c) (((c) == '\n') || ((c) == '\r'))
22 #endif
23
24 #ifndef ISBLANK
25 # define ISBLANK(c) (((c) == ' ') || ((c) == '\t'))
26 #endif
27
28 #ifndef DIR_DELIMINATOR
29 # define DIR_DELIMINATOR '/'
30 #endif
31
32
33 /* pconf specific definations, adjust as needed. */
34
35 #define PROG_NAME "Compiler Configurator"
36 #define PROG_VERSION "0.0.1"
37 #define PROG_VERSION_MAJOR 0
38 #define PROG_VERSION_MINOR 0
39 #define PROG_VERSION_RELEASE 1
40
41
42 /* Configuration file comment character. */
43 #define PCONF_CFG_COMMENT_CHAR '#'
44
45 /* Configuration file parameter and value deliminator character. */
46 #define PCONF_CFG_DELIM_CHAR '='
47
48
49 /* ANSI color codes. */
50 #define PCONF_COLOR_DEFAULT 0
51 #define PCONF_COLOR_HEADING -1
52 #define PCONF_COLOR_SELECTABLE -3
53 #define PCONF_COLOR_SUCCESS 32
54 #define PCONF_COLOR_FAILURE 31
55 #define PCONF_COLOR_WARNING 33
56
57 /* Must exist codes. */
58 #define PCONF_MUST_EXIST_NO 0 /* Disable. */
59 #define PCONF_MUST_EXIST_PREFERRED 1 /* Enable if exists. */
60 #define PCONF_MUST_EXIST_YES 2 /* Must exist or fail. */
61
62
63 /* Dependancy structure. */
64 typedef struct {
65
66 /* Dependent entity type, one of PCONF_DEP_TYPE_*.
67 * This determines which search paths on the platform structure
68 * to use for finding paths specified in this structure.
69 */
70 #define PCONF_DEP_TYPE_OTHER 0
71 #define PCONF_DEP_TYPE_DATA 1
72 #define PCONF_DEP_TYPE_CONFIG 2
73 #define PCONF_DEP_TYPE_LIBRARY 3
74 #define PCONF_DEP_TYPE_HEADER 4
75 #define PCONF_DEP_TYPE_PROGRAM 5
76
77 #define PCONF_DEP_TYPE_OS 10 /* Operating system type. */
78 #define PCONF_DEP_TYPE_MACHINE 11 /* Machine type. */
79
80 int type;
81
82 /* Name of this dependent entity (can be arbitary). */
83 char *name;
84
85 /* Verbose description of this dependent entity. */
86 char *description;
87
88 /* This dependent entity must exist, one of PCONF_MUST_EXIST_*
89 * (but not PCONF_MUST_EXIST_PREFERRED).
90 */
91 int must_exist;
92
93 /* Entity file names to search for (the same file name may
94 * need to be specified multiple times, see func_name member).
95 */
96 char **path;
97 int total_paths;
98
99 /* Strings to search for corresponding index of files. Each
100 * (non-empty) string is searched for in the specified paths
101 * in the path member (if it is not a directory).
102 */
103 char **grep_string;
104 int total_grep_strings;
105
106
107 /* Operating system name, used only if type is
108 * PCONF_DEP_TYPE_OS (preferably value fetched from uname).
109 */
110 char *os_name;
111
112 /* Machine name, used only if type is
113 * PCONF_DEP_TYPE_MACHINE (preferably value fetched from uname).
114 */
115 char *machine_name;
116
117 } depend_struct;
118
119 /* Feature structure, optional requirements for any given platform. */
120 typedef struct {
121
122 /* Name of this feature (can be arbitary). */
123 char *name;
124
125 /* Verbose description of this feature. */
126 char *description;
127
128 /* URL of home page. */
129 char *url_homepage;
130 /* URL of download location. */
131 char *url_download;
132
133 /* This feature must exist, one of PCONF_MUST_EXIST_*. */
134 int must_exist;
135
136 /* List of dependant entities. */
137 depend_struct **depend;
138 int total_depends;
139
140 /* Extra info to append. */
141 char *cflags;
142 char *inc_dirs;
143 char *libs;
144 char *lib_dirs;
145
146 } feature_struct;
147
148 /* Platform structure. */
149 typedef struct {
150
151 /* Name of this platform, this value is used to match value
152 * of platform from command line.
153 */
154 char *name;
155
156 /* Verbose description of this platform. */
157 char *description;
158
159 /* List of features. */
160 feature_struct **feature;
161 int total_features;
162
163 /* Search paths for header files. */
164 char **path_header;
165 int total_path_headers;
166
167 /* Search paths for library files. */
168 char **path_library;
169 int total_path_libraries;
170
171 /* Search paths for configuration files. */
172 char **path_config;
173 int total_path_configs;
174
175 /* Search paths for program files. */
176 char **path_program;
177 int total_path_programs;
178
179 /* Search paths for data and other files, these paths
180 * are used when a search path needs to be specified for
181 * an object that dosen't really fall into the above
182 * categories.
183 */
184 char **path_data;
185 int total_path_datas;
186
187
188 /* Global options for this platform. */
189 char *prefix;
190 char *cflags;
191 char *inc_dirs;
192 char *libs;
193 char *lib_dirs;
194 char *cc; /* C compiler. */
195 char *cpp; /* C++ compiler. */
196
197 } platform_struct;
198
199 /* PConf core structure. */
200 typedef struct {
201
202 int verbose; /* Print extra verbose messages. */
203 int warnings; /* Print warnings (if any). */
204 int colors; /* Enable ansi colors. */
205 int interactive;
206 int force; /* Keep going even if errors encountered. */
207 int ignore_environments; /* Ignore environment variables. */
208
209 int screen_width; /* 0 for undefined. */
210
211 /* Loaded list of supported platforms. */
212 platform_struct **platform;
213 int total_platforms;
214
215 /* Pointer to selected platform. */
216 platform_struct *selected_platform;
217
218 /* Output Makefile path. */
219 char *makefile_output;
220
221 /* Input Makefile paths. */
222 char *makefile_input_prepend;
223 char *makefile_input_append;
224
225 /* Messages. */
226 char *message_configure_startup;
227 char *message_platform_unsupported;
228 char *message_depend_failed;
229 char *message_success;
230
231 /* Values fetched from the thisplatform.ini. */
232 char *os_name;
233 char *machine_name;
234
235 } pconf_core_struct;
236
237
238 /* In fio.c */
239 extern void PConfFreePlatform(platform_struct *platform_ptr);
240 extern void PConfFreePlatforms(
241 platform_struct ***list, int *total
242 );
243 extern int PConfLoadPlatformsFromFile(
244 pconf_core_struct *core_ptr, const char *filename
245 );
246 extern int PConfLoadThisPlatformFromFile(
247 pconf_core_struct *core_ptr, const char *filename
248 );
249 extern void PConfGenerateOutputMakefile(
250 pconf_core_struct *core_ptr, platform_struct *platform_ptr
251 );
252
253 /* In main.c */
254 extern void PConfSetColor(
255 pconf_core_struct *core_ptr, FILE *stream, int color_code
256 );
257 extern void PConfPrintHR(pconf_core_struct *core_ptr);
258 extern feature_struct *PConfMatchFeatureByName(
259 platform_struct *platform_ptr,
260 const char *name, int *n
261 );
262
263
264 /* In proc.c */
265 extern void PConfApplyArgsToPlatform(
266 pconf_core_struct *core_ptr, platform_struct *platform_ptr,
267 int argc, char *argv[]
268 );
269 extern int PConfCheckDepends(
270 pconf_core_struct *core_ptr, platform_struct *platform_ptr
271 );
272
273 /* In utils.c */
274 extern void FREE(void *p);
275 extern int STRLEN(const char *s);
276 extern int STRISYES(const char *s);
277 extern char *STRDUP(const char *s);
278 extern const char *STRCHR(const char *s, int c);
279 extern void STRSTRIP(char *s);
280 extern int STRCASECMP(const char *s1, const char *s2);
281 extern int STRPFX(const char *str, const char *pfx);
282 extern int STRCASEPFX(const char *str, const char *pfx);
283 extern char *STRLISTAPPEND(char ***list, int *total, const char *s);
284 extern void STRFREEARRAY(char **list, int total);
285
286 extern char *GETENV(const char *parameter);
287
288 extern FILE *FOPEN(const char *path, const char *mode);
289 extern void FCLOSE(FILE *fp);
290 extern int FGETC(FILE *fp);
291 extern int FPUTC(int c, FILE *fp);
292 extern void FSEEKNEXTLINE(FILE *fp);
293 extern void FSEEKPASTSPACES(FILE *fp);
294 extern char *FGETLINE(FILE *fp);
295 extern char *FSEEKNEXTPARAMETER(
296 FILE *fp, char *buf, char comment, char delim
297 );
298
299 #endif /* PCONF_H */