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-2002 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 | /*
|
---|
57 | * These definitions are used through out the configuration file parser, but
|
---|
58 | * they should not be visible outside of the parser.
|
---|
59 | */
|
---|
60 |
|
---|
61 | #ifdef HAVE_XORG_CONFIG_H
|
---|
62 | #include <xorg-config.h>
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | #ifndef _Configint_h_
|
---|
66 | #define _Configint_h_
|
---|
67 |
|
---|
68 | #include <stdio.h>
|
---|
69 | #include <string.h>
|
---|
70 | #include <stdarg.h>
|
---|
71 | #include <stddef.h>
|
---|
72 | #include "xf86Parser.h"
|
---|
73 |
|
---|
74 | typedef struct
|
---|
75 | {
|
---|
76 | int num; /* returned number */
|
---|
77 | char *str; /* private copy of the return-string */
|
---|
78 | double realnum; /* returned number as a real */
|
---|
79 | }
|
---|
80 | LexRec, *LexPtr;
|
---|
81 |
|
---|
82 | #ifndef TRUE
|
---|
83 | #define TRUE 1
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | #ifndef FALSE
|
---|
87 | #define FALSE 0
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #include "configProcs.h"
|
---|
91 | #include <stdlib.h>
|
---|
92 | #define xf86confmalloc malloc
|
---|
93 | #define xf86confrealloc realloc
|
---|
94 | #define xf86confcalloc calloc
|
---|
95 | #define xf86conffree free
|
---|
96 |
|
---|
97 | #define TestFree(a) if (a) { xf86conffree (a); a = NULL; }
|
---|
98 |
|
---|
99 | #define parsePrologue(typeptr,typerec) typeptr ptr; \
|
---|
100 | if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return NULL; } \
|
---|
101 | memset(ptr,0,sizeof(typerec));
|
---|
102 |
|
---|
103 | #define parsePrologueVoid(typeptr,typerec) int token; typeptr ptr; \
|
---|
104 | if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return; } \
|
---|
105 | memset(ptr,0,sizeof(typerec));
|
---|
106 |
|
---|
107 | #define HANDLE_RETURN(f,func)\
|
---|
108 | if ((ptr->f=func) == NULL)\
|
---|
109 | {\
|
---|
110 | CLEANUP (ptr);\
|
---|
111 | return (NULL);\
|
---|
112 | }
|
---|
113 |
|
---|
114 | #define HANDLE_LIST(field,func,type)\
|
---|
115 | {\
|
---|
116 | type p = func ();\
|
---|
117 | if (p == NULL)\
|
---|
118 | {\
|
---|
119 | CLEANUP (ptr);\
|
---|
120 | return (NULL);\
|
---|
121 | }\
|
---|
122 | else\
|
---|
123 | {\
|
---|
124 | ptr->field = (type) xf86addListItem ((glp) ptr->field, (glp) p);\
|
---|
125 | }\
|
---|
126 | }
|
---|
127 |
|
---|
128 | #define Error(a,b) do { \
|
---|
129 | xf86parseError (a, b); CLEANUP (ptr); return NULL; \
|
---|
130 | } while (0)
|
---|
131 |
|
---|
132 | /*
|
---|
133 | * These are defines for error messages to promote consistency.
|
---|
134 | * error messages are preceded by the line number, section and file name,
|
---|
135 | * so these messages should be about the specific keyword and syntax in error.
|
---|
136 | * To help limit namespace polution, end each with _MSG.
|
---|
137 | * limit messages to 70 characters if possible.
|
---|
138 | */
|
---|
139 |
|
---|
140 | #define BAD_OPTION_MSG \
|
---|
141 | "The Option keyword requires 1 or 2 quoted strings to follow it."
|
---|
142 | #define INVALID_KEYWORD_MSG \
|
---|
143 | "\"%s\" is not a valid keyword in this section."
|
---|
144 | #define INVALID_SECTION_MSG \
|
---|
145 | "\"%s\" is not a valid section name."
|
---|
146 | #define UNEXPECTED_EOF_MSG \
|
---|
147 | "Unexpected EOF. Missing EndSection keyword?"
|
---|
148 | #define QUOTE_MSG \
|
---|
149 | "The %s keyword requires a quoted string to follow it."
|
---|
150 | #define NUMBER_MSG \
|
---|
151 | "The %s keyword requires a number to follow it."
|
---|
152 | #define POSITIVE_INT_MSG \
|
---|
153 | "The %s keyword requires a positive integer to follow it."
|
---|
154 | #define ZAXISMAPPING_MSG \
|
---|
155 | "The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it."
|
---|
156 | #define AUTOREPEAT_MSG \
|
---|
157 | "The AutoRepeat keyword requires 2 numbers (delay and rate) to follow it."
|
---|
158 | #define XLEDS_MSG \
|
---|
159 | "The XLeds keyword requries one or more numbers to follow it."
|
---|
160 | #define DACSPEED_MSG \
|
---|
161 | "The DacSpeed keyword must be followed by a list of up to %d numbers."
|
---|
162 | #define DISPLAYSIZE_MSG \
|
---|
163 | "The DisplaySize keyword must be followed by the width and height in mm."
|
---|
164 | #define HORIZSYNC_MSG \
|
---|
165 | "The HorizSync keyword must be followed by a list of numbers or ranges."
|
---|
166 | #define VERTREFRESH_MSG \
|
---|
167 | "The VertRefresh keyword must be followed by a list of numbers or ranges."
|
---|
168 | #define VIEWPORT_MSG \
|
---|
169 | "The Viewport keyword must be followed by an X and Y value."
|
---|
170 | #define VIRTUAL_MSG \
|
---|
171 | "The Virtual keyword must be followed by a width and height value."
|
---|
172 | #define WEIGHT_MSG \
|
---|
173 | "The Weight keyword must be followed by red, green and blue values."
|
---|
174 | #define BLACK_MSG \
|
---|
175 | "The Black keyword must be followed by red, green and blue values."
|
---|
176 | #define WHITE_MSG \
|
---|
177 | "The White keyword must be followed by red, green and blue values."
|
---|
178 | #define SCREEN_MSG \
|
---|
179 | "The Screen keyword must be followed by an optional number, a screen name\n" \
|
---|
180 | "\tin quotes, and optional position/layout information."
|
---|
181 | #define INVALID_SCR_MSG \
|
---|
182 | "Invalid Screen line."
|
---|
183 | #define INPUTDEV_MSG \
|
---|
184 | "The InputDevice keyword must be followed by an input device name in quotes."
|
---|
185 | #define INACTIVE_MSG \
|
---|
186 | "The Inactive keyword must be followed by a Device name in quotes."
|
---|
187 | #define UNDEFINED_SCREEN_MSG \
|
---|
188 | "Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
|
---|
189 | #define UNDEFINED_MONITOR_MSG \
|
---|
190 | "Undefined Monitor \"%s\" referenced by Screen \"%s\"."
|
---|
191 | #define UNDEFINED_MODES_MSG \
|
---|
192 | "Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
|
---|
193 | #define UNDEFINED_DEVICE_MSG \
|
---|
194 | "Undefined Device \"%s\" referenced by Screen \"%s\"."
|
---|
195 | #define UNDEFINED_ADAPTOR_MSG \
|
---|
196 | "Undefined VideoAdaptor \"%s\" referenced by Screen \"%s\"."
|
---|
197 | #define ADAPTOR_REF_TWICE_MSG \
|
---|
198 | "VideoAdaptor \"%s\" already referenced by Screen \"%s\"."
|
---|
199 | #define UNDEFINED_DEVICE_LAY_MSG \
|
---|
200 | "Undefined Device \"%s\" referenced by ServerLayout \"%s\"."
|
---|
201 | #define UNDEFINED_INPUT_MSG \
|
---|
202 | "Undefined InputDevice \"%s\" referenced by ServerLayout \"%s\"."
|
---|
203 | #define NO_IDENT_MSG \
|
---|
204 | "This section must have an Identifier line."
|
---|
205 | #define ONLY_ONE_MSG \
|
---|
206 | "This section must have only one of either %s line."
|
---|
207 | #define UNDEFINED_DRIVER_MSG \
|
---|
208 | "Device section \"%s\" must have a Driver line."
|
---|
209 | #define UNDEFINED_INPUTDRIVER_MSG \
|
---|
210 | "InputDevice section \"%s\" must have a Driver line."
|
---|
211 | #define INVALID_GAMMA_MSG \
|
---|
212 | "gamma correction value(s) expected\n either one value or three r/g/b values."
|
---|
213 | #define GROUP_MSG \
|
---|
214 | "The Group keyword must be followed by either a group name in quotes or\n" \
|
---|
215 | "\ta numerical group id."
|
---|
216 | #define MULTIPLE_MSG \
|
---|
217 | "Multiple \"%s\" lines."
|
---|
218 |
|
---|
219 | /* Warning messages */
|
---|
220 | #define OBSOLETE_MSG \
|
---|
221 | "Ignoring obsolete keyword \"%s\"."
|
---|
222 | #define MOVED_TO_FLAGS_MSG \
|
---|
223 | "Keyword \"%s\" is now an Option flag in the ServerFlags section."
|
---|
224 |
|
---|
225 | #endif /* _Configint_h_ */
|
---|