Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xfree86 / parser / xf86Parser.h
CommitLineData
a09e091a
JB
1/*
2 *
3 * Copyright (c) 1997 Metro Link Incorporated
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 * Except as contained in this notice, the name of the Metro Link shall not be
24 * used in advertising or otherwise to promote the sale, use or other dealings
25 * in this Software without prior written authorization from Metro Link.
26 *
27 */
28/*
29 * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
30 *
31 * Permission is hereby granted, free of charge, to any person obtaining a
32 * copy of this software and associated documentation files (the "Software"),
33 * to deal in the Software without restriction, including without limitation
34 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
35 * and/or sell copies of the Software, and to permit persons to whom the
36 * Software is furnished to do so, subject to the following conditions:
37 *
38 * The above copyright notice and this permission notice shall be included in
39 * all copies or substantial portions of the Software.
40 *
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
44 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
45 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
48 *
49 * Except as contained in this notice, the name of the copyright holder(s)
50 * and author(s) shall not be used in advertising or otherwise to promote
51 * the sale, use or other dealings in this Software without prior written
52 * authorization from the copyright holder(s) and author(s).
53 */
54
55/*
56 * This file contains the external interfaces for the XFree86 configuration
57 * file parser.
58 */
59#ifdef HAVE_XORG_CONFIG_H
60#include <xorg-config.h>
61#endif
62
63#ifndef _xf86Parser_h_
64#define _xf86Parser_h_
65
66#include <X11/Xdefs.h>
67#include "xf86Optrec.h"
68#include "list.h"
69
70#define HAVE_PARSER_DECLS
71
72typedef struct {
73 char *file_logfile;
74 char *file_modulepath;
75 char *file_fontpath;
76 char *file_comment;
77 char *file_xkbdir;
78} XF86ConfFilesRec, *XF86ConfFilesPtr;
79
80/* Values for load_type */
81#define XF86_LOAD_MODULE 0
82#define XF86_LOAD_DRIVER 1
83#define XF86_DISABLE_MODULE 2
84
85typedef struct {
86 GenericListRec list;
87 int load_type;
88 char *load_name;
89 XF86OptionPtr load_opt;
90 char *load_comment;
91 int ignore;
92} XF86LoadRec, *XF86LoadPtr;
93
94typedef struct {
95 XF86LoadPtr mod_load_lst;
96 XF86LoadPtr mod_disable_lst;
97 char *mod_comment;
98} XF86ConfModuleRec, *XF86ConfModulePtr;
99
100#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard"
101
102#define CONF_IMPLICIT_POINTER "Implicit Core Pointer"
103
104#define XF86CONF_PHSYNC 0x0001
105#define XF86CONF_NHSYNC 0x0002
106#define XF86CONF_PVSYNC 0x0004
107#define XF86CONF_NVSYNC 0x0008
108#define XF86CONF_INTERLACE 0x0010
109#define XF86CONF_DBLSCAN 0x0020
110#define XF86CONF_CSYNC 0x0040
111#define XF86CONF_PCSYNC 0x0080
112#define XF86CONF_NCSYNC 0x0100
113#define XF86CONF_HSKEW 0x0200 /* hskew provided */
114#define XF86CONF_BCAST 0x0400
115#define XF86CONF_VSCAN 0x1000
116
117typedef struct {
118 GenericListRec list;
119 char *ml_identifier;
120 int ml_clock;
121 int ml_hdisplay;
122 int ml_hsyncstart;
123 int ml_hsyncend;
124 int ml_htotal;
125 int ml_vdisplay;
126 int ml_vsyncstart;
127 int ml_vsyncend;
128 int ml_vtotal;
129 int ml_vscan;
130 int ml_flags;
131 int ml_hskew;
132 char *ml_comment;
133} XF86ConfModeLineRec, *XF86ConfModeLinePtr;
134
135typedef struct {
136 GenericListRec list;
137 char *vp_identifier;
138 XF86OptionPtr vp_option_lst;
139 char *vp_comment;
140} XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
141
142typedef struct {
143 GenericListRec list;
144 char *va_identifier;
145 char *va_vendor;
146 char *va_board;
147 char *va_busid;
148 char *va_driver;
149 XF86OptionPtr va_option_lst;
150 XF86ConfVideoPortPtr va_port_lst;
151 char *va_fwdref;
152 char *va_comment;
153} XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
154
155#define CONF_MAX_HSYNC 8
156#define CONF_MAX_VREFRESH 8
157
158typedef struct {
159 float hi, lo;
160} parser_range;
161
162typedef struct {
163 int red, green, blue;
164} parser_rgb;
165
166typedef struct {
167 GenericListRec list;
168 char *modes_identifier;
169 XF86ConfModeLinePtr mon_modeline_lst;
170 char *modes_comment;
171} XF86ConfModesRec, *XF86ConfModesPtr;
172
173typedef struct {
174 GenericListRec list;
175 char *ml_modes_str;
176 XF86ConfModesPtr ml_modes;
177} XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
178
179typedef struct {
180 GenericListRec list;
181 char *mon_identifier;
182 char *mon_vendor;
183 char *mon_modelname;
184 int mon_width; /* in mm */
185 int mon_height; /* in mm */
186 XF86ConfModeLinePtr mon_modeline_lst;
187 int mon_n_hsync;
188 parser_range mon_hsync[CONF_MAX_HSYNC];
189 int mon_n_vrefresh;
190 parser_range mon_vrefresh[CONF_MAX_VREFRESH];
191 float mon_gamma_red;
192 float mon_gamma_green;
193 float mon_gamma_blue;
194 XF86OptionPtr mon_option_lst;
195 XF86ConfModesLinkPtr mon_modes_sect_lst;
196 char *mon_comment;
197} XF86ConfMonitorRec, *XF86ConfMonitorPtr;
198
199#define CONF_MAXDACSPEEDS 4
200#define CONF_MAXCLOCKS 128
201
202typedef struct {
203 GenericListRec list;
204 char *dev_identifier;
205 char *dev_vendor;
206 char *dev_board;
207 char *dev_chipset;
208 char *dev_busid;
209 char *dev_card;
210 char *dev_driver;
211 char *dev_ramdac;
212 int dev_dacSpeeds[CONF_MAXDACSPEEDS];
213 int dev_videoram;
214 int dev_textclockfreq;
215 unsigned long dev_bios_base;
216 unsigned long dev_mem_base;
217 unsigned long dev_io_base;
218 char *dev_clockchip;
219 int dev_clocks;
220 int dev_clock[CONF_MAXCLOCKS];
221 int dev_chipid;
222 int dev_chiprev;
223 int dev_irq;
224 int dev_screen;
225 XF86OptionPtr dev_option_lst;
226 char *dev_comment;
227} XF86ConfDeviceRec, *XF86ConfDevicePtr;
228
229typedef struct {
230 GenericListRec list;
231 char *mode_name;
232} XF86ModeRec, *XF86ModePtr;
233
234typedef struct {
235 GenericListRec list;
236 int disp_frameX0;
237 int disp_frameY0;
238 int disp_virtualX;
239 int disp_virtualY;
240 int disp_depth;
241 int disp_bpp;
242 char *disp_visual;
243 parser_rgb disp_weight;
244 parser_rgb disp_black;
245 parser_rgb disp_white;
246 XF86ModePtr disp_mode_lst;
247 XF86OptionPtr disp_option_lst;
248 char *disp_comment;
249} XF86ConfDisplayRec, *XF86ConfDisplayPtr;
250
251typedef struct {
252 XF86OptionPtr flg_option_lst;
253 char *flg_comment;
254} XF86ConfFlagsRec, *XF86ConfFlagsPtr;
255
256typedef struct {
257 GenericListRec list;
258 char *al_adaptor_str;
259 XF86ConfVideoAdaptorPtr al_adaptor;
260} XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
261
262typedef struct {
263 GenericListRec list;
264 char *scrn_identifier;
265 char *scrn_obso_driver;
266 int scrn_defaultdepth;
267 int scrn_defaultbpp;
268 int scrn_defaultfbbpp;
269 char *scrn_monitor_str;
270 XF86ConfMonitorPtr scrn_monitor;
271 char *scrn_device_str;
272 XF86ConfDevicePtr scrn_device;
273 XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
274 XF86ConfDisplayPtr scrn_display_lst;
275 XF86OptionPtr scrn_option_lst;
276 char *scrn_comment;
277 int scrn_virtualX, scrn_virtualY;
278} XF86ConfScreenRec, *XF86ConfScreenPtr;
279
280typedef struct {
281 GenericListRec list;
282 char *inp_identifier;
283 char *inp_driver;
284 XF86OptionPtr inp_option_lst;
285 char *inp_comment;
286} XF86ConfInputRec, *XF86ConfInputPtr;
287
288typedef struct {
289 GenericListRec list;
290 XF86ConfInputPtr iref_inputdev;
291 char *iref_inputdev_str;
292 XF86OptionPtr iref_option_lst;
293} XF86ConfInputrefRec, *XF86ConfInputrefPtr;
294
295typedef struct {
296 Bool set;
297 Bool val;
298} xf86TriState;
299
300typedef struct {
301 struct xorg_list entry;
302 char **values;
303} xf86MatchGroup;
304
305typedef struct {
306 GenericListRec list;
307 char *identifier;
308 char *driver;
309 struct xorg_list match_product;
310 struct xorg_list match_vendor;
311 struct xorg_list match_device;
312 struct xorg_list match_os;
313 struct xorg_list match_pnpid;
314 struct xorg_list match_usbid;
315 struct xorg_list match_driver;
316 struct xorg_list match_tag;
317 struct xorg_list match_layout;
318 xf86TriState is_keyboard;
319 xf86TriState is_pointer;
320 xf86TriState is_joystick;
321 xf86TriState is_tablet;
322 xf86TriState is_touchpad;
323 xf86TriState is_touchscreen;
324 XF86OptionPtr option_lst;
325 char *comment;
326} XF86ConfInputClassRec, *XF86ConfInputClassPtr;
327
328/* Values for adj_where */
329#define CONF_ADJ_OBSOLETE -1
330#define CONF_ADJ_ABSOLUTE 0
331#define CONF_ADJ_RIGHTOF 1
332#define CONF_ADJ_LEFTOF 2
333#define CONF_ADJ_ABOVE 3
334#define CONF_ADJ_BELOW 4
335#define CONF_ADJ_RELATIVE 5
336
337typedef struct {
338 GenericListRec list;
339 int adj_scrnum;
340 XF86ConfScreenPtr adj_screen;
341 char *adj_screen_str;
342 XF86ConfScreenPtr adj_top;
343 char *adj_top_str;
344 XF86ConfScreenPtr adj_bottom;
345 char *adj_bottom_str;
346 XF86ConfScreenPtr adj_left;
347 char *adj_left_str;
348 XF86ConfScreenPtr adj_right;
349 char *adj_right_str;
350 int adj_where;
351 int adj_x;
352 int adj_y;
353 char *adj_refscreen;
354} XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
355
356typedef struct {
357 GenericListRec list;
358 char *inactive_device_str;
359 XF86ConfDevicePtr inactive_device;
360} XF86ConfInactiveRec, *XF86ConfInactivePtr;
361
362typedef struct {
363 GenericListRec list;
364 char *lay_identifier;
365 XF86ConfAdjacencyPtr lay_adjacency_lst;
366 XF86ConfInactivePtr lay_inactive_lst;
367 XF86ConfInputrefPtr lay_input_lst;
368 XF86OptionPtr lay_option_lst;
369 char *lay_comment;
370} XF86ConfLayoutRec, *XF86ConfLayoutPtr;
371
372typedef struct {
373 GenericListRec list;
374 char *vs_name;
375 char *vs_identifier;
376 XF86OptionPtr vs_option_lst;
377 char *vs_comment;
378} XF86ConfVendSubRec, *XF86ConfVendSubPtr;
379
380typedef struct {
381 GenericListRec list;
382 char *vnd_identifier;
383 XF86OptionPtr vnd_option_lst;
384 XF86ConfVendSubPtr vnd_sub_lst;
385 char *vnd_comment;
386} XF86ConfVendorRec, *XF86ConfVendorPtr;
387
388typedef struct {
389 char *dri_group_name;
390 int dri_group;
391 int dri_mode;
392 char *dri_comment;
393} XF86ConfDRIRec, *XF86ConfDRIPtr;
394
395typedef struct {
396 XF86OptionPtr ext_option_lst;
397 char *extensions_comment;
398} XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
399
400typedef struct {
401 XF86ConfFilesPtr conf_files;
402 XF86ConfModulePtr conf_modules;
403 XF86ConfFlagsPtr conf_flags;
404 XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
405 XF86ConfModesPtr conf_modes_lst;
406 XF86ConfMonitorPtr conf_monitor_lst;
407 XF86ConfDevicePtr conf_device_lst;
408 XF86ConfScreenPtr conf_screen_lst;
409 XF86ConfInputPtr conf_input_lst;
410 XF86ConfInputClassPtr conf_inputclass_lst;
411 XF86ConfLayoutPtr conf_layout_lst;
412 XF86ConfVendorPtr conf_vendor_lst;
413 XF86ConfDRIPtr conf_dri;
414 XF86ConfExtensionsPtr conf_extensions;
415 char *conf_comment;
416} XF86ConfigRec, *XF86ConfigPtr;
417
418typedef struct {
419 int token; /* id of the token */
420 const char *name; /* pointer to the LOWERCASED name */
421} xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
422
423/*
424 * prototypes for public functions
425 */
426extern void xf86initConfigFiles(void);
427extern char *xf86openConfigFile(const char *path, const char *cmdline,
428 const char *projroot);
429extern char *xf86openConfigDirFiles(const char *path, const char *cmdline,
430 const char *projroot);
431extern void xf86setBuiltinConfig(const char *config[]);
432extern XF86ConfigPtr xf86readConfigFile(void);
433extern void xf86closeConfigFile(void);
434extern void xf86freeConfig(XF86ConfigPtr p);
435extern int xf86writeConfigFile(const char *, XF86ConfigPtr);
436extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident,
437 XF86ConfDevicePtr p);
438extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name,
439 XF86ConfLayoutPtr list);
440extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident,
441 XF86ConfMonitorPtr p);
442extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident,
443 XF86ConfModesPtr p);
444extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident,
445 XF86ConfModeLinePtr p);
446extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident,
447 XF86ConfScreenPtr p);
448extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident,
449 XF86ConfInputPtr p);
450extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver,
451 XF86ConfInputPtr p);
452extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
453 XF86ConfVideoAdaptorPtr
454 p);
455extern int xf86layoutAddInputDevices(XF86ConfigPtr config,
456 XF86ConfLayoutPtr layout);
457
458extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head,
459 GenericListPtr c_new);
460extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1,
461 GenericListPtr list_2);
462
463extern _X_EXPORT int xf86pathIsAbsolute(const char *path);
464extern _X_EXPORT int xf86pathIsSafe(const char *path);
465extern _X_EXPORT char *xf86addComment(char *cur, char *add);
466extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str);
467
468#endif /* _xf86Parser_h_ */