1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.21 2003/08/24 17:37:07 dawes Exp $ */
|
---|
2 | /*
|
---|
3 | *
|
---|
4 | * Copyright (c) 1997 Metro Link Incorporated
|
---|
5 | *
|
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
7 | * copy of this software and associated documentation files (the "Software"),
|
---|
8 | * to deal in the Software without restriction, including without limitation
|
---|
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
10 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
11 | * Software is furnished to do so, subject to the following conditions:
|
---|
12 | *
|
---|
13 | * The above copyright notice and this permission notice shall be included in
|
---|
14 | * all copies or substantial portions of the Software.
|
---|
15 | *
|
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
19 | * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
---|
21 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
22 | * SOFTWARE.
|
---|
23 | *
|
---|
24 | * Except as contained in this notice, the name of the Metro Link shall not be
|
---|
25 | * used in advertising or otherwise to promote the sale, use or other dealings
|
---|
26 | * in this Software without prior written authorization from Metro Link.
|
---|
27 | *
|
---|
28 | */
|
---|
29 | /*
|
---|
30 | * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
|
---|
31 | *
|
---|
32 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
33 | * copy of this software and associated documentation files (the "Software"),
|
---|
34 | * to deal in the Software without restriction, including without limitation
|
---|
35 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
36 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
37 | * Software is furnished to do so, subject to the following conditions:
|
---|
38 | *
|
---|
39 | * The above copyright notice and this permission notice shall be included in
|
---|
40 | * all copies or substantial portions of the Software.
|
---|
41 | *
|
---|
42 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
43 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
44 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
45 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
46 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
47 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
48 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
49 | *
|
---|
50 | * Except as contained in this notice, the name of the copyright holder(s)
|
---|
51 | * and author(s) shall not be used in advertising or otherwise to promote
|
---|
52 | * the sale, use or other dealings in this Software without prior written
|
---|
53 | * authorization from the copyright holder(s) and author(s).
|
---|
54 | */
|
---|
55 |
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * These definitions are used through out the configuration file parser, but
|
---|
59 | * they should not be visible outside of the parser.
|
---|
60 | */
|
---|
61 |
|
---|
62 | #ifdef HAVE_XORG_CONFIG_H
|
---|
63 | #include <xorg-config.h>
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | #ifndef _Configint_h_
|
---|
67 | #define _Configint_h_
|
---|
68 |
|
---|
69 | #include <stdio.h>
|
---|
70 | #include <string.h>
|
---|
71 | #include <stdarg.h>
|
---|
72 | #include <stddef.h>
|
---|
73 | #include "xf86Parser.h"
|
---|
74 |
|
---|
75 | typedef struct
|
---|
76 | {
|
---|
77 | int num; /* returned number */
|
---|
78 | char *str; /* private copy of the return-string */
|
---|
79 | double realnum; /* returned number as a real */
|
---|
80 | }
|
---|
81 | LexRec, *LexPtr;
|
---|
82 |
|
---|
83 | #ifndef TRUE
|
---|
84 | #define TRUE 1
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #ifndef FALSE
|
---|
88 | #define FALSE 0
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #include "configProcs.h"
|
---|
92 | #include <stdlib.h>
|
---|
93 | #define xf86confmalloc malloc
|
---|
94 | #define xf86confrealloc realloc
|
---|
95 | #define xf86confcalloc calloc
|
---|
96 | #define xf86conffree free
|
---|
97 |
|
---|
98 | #define TestFree(a) if (a) { xf86conffree (a); a = NULL; }
|
---|
99 |
|
---|
100 | #define parsePrologue(typeptr,typerec) typeptr ptr; \
|
---|
101 | if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return NULL; } \
|
---|
102 | memset(ptr,0,sizeof(typerec));
|
---|
103 |
|
---|
104 | #define parsePrologueVoid(typeptr,typerec) int token; typeptr ptr; \
|
---|
105 | if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return; } \
|
---|
106 | memset(ptr,0,sizeof(typerec));
|
---|
107 |
|
---|
108 | #define HANDLE_RETURN(f,func)\
|
---|
109 | if ((ptr->f=func) == NULL)\
|
---|
110 | {\
|
---|
111 | CLEANUP (ptr);\
|
---|
112 | return (NULL);\
|
---|
113 | }
|
---|
114 |
|
---|
115 | #define HANDLE_LIST(field,func,type)\
|
---|
116 | {\
|
---|
117 | type p = func ();\
|
---|
118 | if (p == NULL)\
|
---|
119 | {\
|
---|
120 | CLEANUP (ptr);\
|
---|
121 | return (NULL);\
|
---|
122 | }\
|
---|
123 | else\
|
---|
124 | {\
|
---|
125 | ptr->field = (type) xf86addListItem ((glp) ptr->field, (glp) p);\
|
---|
126 | }\
|
---|
127 | }
|
---|
128 |
|
---|
129 | #define Error(a,b) do { \
|
---|
130 | xf86parseError (a, b); CLEANUP (ptr); return NULL; \
|
---|
131 | } while (0)
|
---|
132 |
|
---|
133 | /*
|
---|
134 | * These are defines for error messages to promote consistency.
|
---|
135 | * error messages are preceded by the line number, section and file name,
|
---|
136 | * so these messages should be about the specific keyword and syntax in error.
|
---|
137 | * To help limit namespace polution, end each with _MSG.
|
---|
138 | * limit messages to 70 characters if possible.
|
---|
139 | */
|
---|
140 |
|
---|
141 | #define BAD_OPTION_MSG \
|
---|
142 | "The Option keyword requires 1 or 2 quoted strings to follow it."
|
---|
143 | #define INVALID_KEYWORD_MSG \
|
---|
144 | "\"%s\" is not a valid keyword in this section."
|
---|
145 | #define INVALID_SECTION_MSG \
|
---|
146 | "\"%s\" is not a valid section name."
|
---|
147 | #define UNEXPECTED_EOF_MSG \
|
---|
148 | "Unexpected EOF. Missing EndSection keyword?"
|
---|
149 | #define QUOTE_MSG \
|
---|
150 | "The %s keyword requires a quoted string to follow it."
|
---|
151 | #define NUMBER_MSG \
|
---|
152 | "The %s keyword requires a number to follow it."
|
---|
153 | #define POSITIVE_INT_MSG \
|
---|
154 | "The %s keyword requires a positive integer to follow it."
|
---|
155 | #define ZAXISMAPPING_MSG \
|
---|
156 | "The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it."
|
---|
157 | #define AUTOREPEAT_MSG \
|
---|
158 | "The AutoRepeat keyword requires 2 numbers (delay and rate) to follow it."
|
---|
159 | #define XLEDS_MSG \
|
---|
160 | "The XLeds keyword requries one or more numbers to follow it."
|
---|
161 | #define DACSPEED_MSG \
|
---|
162 | "The DacSpeed keyword must be followed by a list of up to %d numbers."
|
---|
163 | #define DISPLAYSIZE_MSG \
|
---|
164 | "The DisplaySize keyword must be followed by the width and height in mm."
|
---|
165 | #define HORIZSYNC_MSG \
|
---|
166 | "The HorizSync keyword must be followed by a list of numbers or ranges."
|
---|
167 | #define VERTREFRESH_MSG \
|
---|
168 | "The VertRefresh keyword must be followed by a list of numbers or ranges."
|
---|
169 | #define VIEWPORT_MSG \
|
---|
170 | "The Viewport keyword must be followed by an X and Y value."
|
---|
171 | #define VIRTUAL_MSG \
|
---|
172 | "The Virtual keyword must be followed by a width and height value."
|
---|
173 | #define WEIGHT_MSG \
|
---|
174 | "The Weight keyword must be followed by red, green and blue values."
|
---|
175 | #define BLACK_MSG \
|
---|
176 | "The Black keyword must be followed by red, green and blue values."
|
---|
177 | #define WHITE_MSG \
|
---|
178 | "The White keyword must be followed by red, green and blue values."
|
---|
179 | #define SCREEN_MSG \
|
---|
180 | "The Screen keyword must be followed by an optional number, a screen name\n" \
|
---|
181 | "\tin quotes, and optional position/layout information."
|
---|
182 | #define INVALID_SCR_MSG \
|
---|
183 | "Invalid Screen line."
|
---|
184 | #define INPUTDEV_MSG \
|
---|
185 | "The InputDevice keyword must be followed by an input device name in quotes."
|
---|
186 | #define INACTIVE_MSG \
|
---|
187 | "The Inactive keyword must be followed by a Device name in quotes."
|
---|
188 | #define UNDEFINED_SCREEN_MSG \
|
---|
189 | "Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
|
---|
190 | #define UNDEFINED_MONITOR_MSG \
|
---|
191 | "Undefined Monitor \"%s\" referenced by Screen \"%s\"."
|
---|
192 | #define UNDEFINED_MODES_MSG \
|
---|
193 | "Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
|
---|
194 | #define UNDEFINED_DEVICE_MSG \
|
---|
195 | "Undefined Device \"%s\" referenced by Screen \"%s\"."
|
---|
196 | #define UNDEFINED_ADAPTOR_MSG \
|
---|
197 | "Undefined VideoAdaptor \"%s\" referenced by Screen \"%s\"."
|
---|
198 | #define ADAPTOR_REF_TWICE_MSG \
|
---|
199 | "VideoAdaptor \"%s\" already referenced by Screen \"%s\"."
|
---|
200 | #define UNDEFINED_DEVICE_LAY_MSG \
|
---|
201 | "Undefined Device \"%s\" referenced by ServerLayout \"%s\"."
|
---|
202 | #define UNDEFINED_INPUT_MSG \
|
---|
203 | "Undefined InputDevice \"%s\" referenced by ServerLayout \"%s\"."
|
---|
204 | #define NO_IDENT_MSG \
|
---|
205 | "This section must have an Identifier line."
|
---|
206 | #define ONLY_ONE_MSG \
|
---|
207 | "This section must have only one of either %s line."
|
---|
208 | #define UNDEFINED_DRIVER_MSG \
|
---|
209 | "Device section \"%s\" must have a Driver line."
|
---|
210 | #define UNDEFINED_INPUTDRIVER_MSG \
|
---|
211 | "InputDevice section \"%s\" must have a Driver line."
|
---|
212 | #define INVALID_GAMMA_MSG \
|
---|
213 | "gamma correction value(s) expected\n either one value or three r/g/b values."
|
---|
214 | #define GROUP_MSG \
|
---|
215 | "The Group keyword must be followed by either a group name in quotes or\n" \
|
---|
216 | "\ta numerical group id."
|
---|
217 | #define MULTIPLE_MSG \
|
---|
218 | "Multiple \"%s\" lines."
|
---|
219 |
|
---|
220 | /* Warning messages */
|
---|
221 | #define OBSOLETE_MSG \
|
---|
222 | "Ignoring obsolete keyword \"%s\"."
|
---|
223 | #define MOVED_TO_FLAGS_MSG \
|
---|
224 | "Keyword \"%s\" is now an Option flag in the ServerFlags section."
|
---|
225 |
|
---|
226 | #endif /* _Configint_h_ */
|
---|