VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.10.0/dmxparse.h@ 103415

最後變更 在這個檔案從103415是 36308,由 vboxsync 提交於 14 年 前

fix OSE

  • 屬性 svn:eol-style 設為 native
檔案大小: 13.2 KB
 
1/*
2 * Copyright 2002 Red Hat Inc., Durham, North Carolina.
3 *
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation on the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28/*
29 * Authors:
30 * Rickard E. (Rik) Faith <[email protected]>
31 *
32 */
33
34/** \file
35 * Interface to DMX configuration file parser. \see dmxparse.c */
36
37#ifndef _DMXPARSE_H_
38#define _DMXPARSE_H_
39
40#include <stdio.h> /* For FILE */
41
42/** Stores tokens not stored in other structures (e.g., keywords and ;) */
43typedef struct _DMXConfigToken {
44 int token;
45 int line;
46 const char *comment;
47} DMXConfigToken, *DMXConfigTokenPtr;
48
49/** Stores parsed strings. */
50typedef struct _DMXConfigString {
51 int token;
52 int line;
53 const char *comment;
54 const char *string;
55 struct _DMXConfigString *next;
56} DMXConfigString, *DMXConfigStringPtr;
57
58/** Stores parsed numbers. */
59typedef struct _DMXConfigNumber {
60 int token;
61 int line;
62 const char *comment;
63 int number;
64} DMXConfigNumber, *DMXConfigNumberPtr;
65
66/** Stores parsed pairs (e.g., x y) */
67typedef struct _DMXConfigPair {
68 int token;
69 int line;
70 const char *comment;
71 int x;
72 int y;
73 int xsign;
74 int ysign;
75} DMXConfigPair, *DMXConfigPairPtr;
76
77/** Stores parsed comments not stored with a token. */
78typedef struct _DMXConfigComment {
79 int token;
80 int line;
81 const char *comment;
82} DMXConfigComment, *DMXConfigCommentPtr;
83
84typedef enum {
85 dmxConfigComment,
86 dmxConfigVirtual,
87 dmxConfigDisplay,
88 dmxConfigWall,
89 dmxConfigOption,
90 dmxConfigParam
91} DMXConfigType;
92
93/** Stores a geometry specification. */
94typedef struct _DMXConfigPartDim {
95 DMXConfigPairPtr dim;
96 DMXConfigPairPtr offset;
97} DMXConfigPartDim, *DMXConfigPartDimPtr;
98
99/** Stores a pair of geometry specifications. */
100typedef struct _DMXConfigFullDim {
101 DMXConfigPartDimPtr scrn;
102 DMXConfigPartDimPtr root;
103} DMXConfigFullDim, *DMXConfigFullDimPtr;
104
105/** Stores parsed display information. */
106typedef struct _DMXConfigDisplay {
107 /* Summary information */
108 const char *name;
109 /* Screen Window Geometry */
110 int scrnWidth, scrnHeight;
111 int scrnX, scrnY;
112 int scrnXSign, scrnYSign;
113 /* Root Window Geometry */
114 int rootWidth, rootHeight;
115 int rootX, rootY;
116 int rootXSign, rootYSign;
117 /* Origin in global space */
118 int rootXOrigin, rootYOrigin;
119
120 /* Raw configuration information */
121 DMXConfigTokenPtr start;
122 DMXConfigStringPtr dname;
123 DMXConfigFullDimPtr dim;
124 DMXConfigPairPtr origin;
125 DMXConfigTokenPtr end;
126} DMXConfigDisplay, *DMXConfigDisplayPtr;
127
128/** Stores parsed wall information. */
129typedef struct _DMXConfigWall {
130 /* Summary information */
131 int width, height; /* dimensions of displays */
132 int xwall, ywall; /* dimensions of wall, in tiles */
133
134
135 /* Raw configuration informaiton */
136 DMXConfigTokenPtr start;
137 DMXConfigPairPtr wallDim;
138 DMXConfigPairPtr displayDim;
139 DMXConfigStringPtr nameList;
140 DMXConfigTokenPtr end;
141} DMXConfigWall, *DMXConfigWallPtr;
142
143/** Stores parsed option information. */
144typedef struct _DMXConfigOption {
145 /* Summary information */
146 char *string;
147
148 /* Raw configuration informaiton */
149 DMXConfigTokenPtr start;
150 DMXConfigStringPtr option;
151 DMXConfigTokenPtr end;
152} DMXConfigOption, *DMXConfigOptionPtr;
153
154/** Stores parsed param information. */
155typedef struct _DMXConfigParam {
156 int argc;
157 const char **argv;
158
159 DMXConfigTokenPtr start;
160 DMXConfigTokenPtr open;
161 DMXConfigStringPtr param;
162 DMXConfigTokenPtr close;
163 DMXConfigTokenPtr end; /* Either open/close OR end */
164 struct _DMXConfigParam *next;
165} DMXConfigParam, *DMXConfigParamPtr;
166
167/** Stores options under an entry (subentry). */
168typedef struct _DMXConfigSub {
169 DMXConfigType type;
170 DMXConfigCommentPtr comment;
171 DMXConfigDisplayPtr display;
172 DMXConfigWallPtr wall;
173 DMXConfigOptionPtr option;
174 DMXConfigParamPtr param;
175 struct _DMXConfigSub *next;
176} DMXConfigSub, *DMXConfigSubPtr;
177
178/** Stores parsed virtual information. */
179typedef struct _DMXConfigVirtual {
180 /* Summary information */
181 const char *name;
182 int width, height;
183
184 /* Raw configuration information */
185 DMXConfigTokenPtr start;
186 DMXConfigStringPtr vname;
187 DMXConfigPairPtr dim;
188 DMXConfigTokenPtr open;
189 DMXConfigSubPtr subentry;
190 DMXConfigTokenPtr close;
191} DMXConfigVirtual, *DMXConfigVirtualPtr;
192
193/** Heads entry storage. */
194typedef struct _DMXConfigEntry {
195 DMXConfigType type;
196 DMXConfigCommentPtr comment;
197 DMXConfigVirtualPtr virtual;
198 struct _DMXConfigEntry *next;
199} DMXConfigEntry, *DMXConfigEntryPtr;
200
201extern DMXConfigEntryPtr dmxConfigEntry;
202
203extern int yylex(void);
204extern int yydebug;
205extern void yyerror(const char *message);
206
207extern void dmxConfigLog(const char *format, ...);
208extern void *dmxConfigAlloc(unsigned long bytes);
209extern void *dmxConfigRealloc(void *orig,
210 unsigned long orig_bytes,
211 unsigned long bytes);
212extern const char *dmxConfigCopyString(const char *string,
213 int length);
214extern void dmxConfigFree(void *area);
215extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
216 const char *comment);
217extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
218extern DMXConfigStringPtr dmxConfigCreateString(int token, int line,
219 const char *comment,
220 const char *string);
221extern void dmxConfigFreeString(DMXConfigStringPtr p);
222extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
223 const char *comment,
224 int number);
225extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
226extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
227 const char *comment,
228 int x, int y,
229 int xsign, int ysign);
230extern void dmxConfigFreePair(DMXConfigPairPtr p);
231extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
232 const char *comment);
233extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
234extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
235 DMXConfigPairPtr pOffset);
236extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
237extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
238 DMXConfigPartDimPtr pRoot);
239extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
240extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
241 DMXConfigStringPtr pName,
242 DMXConfigFullDimPtr pDim,
243 DMXConfigPairPtr pOrigin,
244 DMXConfigTokenPtr pEnd);
245extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
246extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
247 DMXConfigPairPtr pWallDim,
248 DMXConfigPairPtr pDisplayDim,
249 DMXConfigStringPtr pNameList,
250 DMXConfigTokenPtr pEnd);
251extern void dmxConfigFreeWall(DMXConfigWallPtr p);
252extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
253 DMXConfigStringPtr pOption,
254 DMXConfigTokenPtr pEnd);
255extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
256extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
257 DMXConfigTokenPtr pOpen,
258 DMXConfigStringPtr pParam,
259 DMXConfigTokenPtr pClose,
260 DMXConfigTokenPtr pEnd);
261extern void dmxConfigFreeParam(DMXConfigParamPtr p);
262extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
263 const char *key,
264 int *argc);
265extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
266 DMXConfigCommentPtr comment,
267 DMXConfigDisplayPtr display,
268 DMXConfigWallPtr wall,
269 DMXConfigOptionPtr option,
270 DMXConfigParamPtr param);
271extern void dmxConfigFreeSub(DMXConfigSubPtr sub);
272extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment);
273extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display);
274extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall);
275extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option);
276extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param);
277extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
278 DMXConfigSubPtr sub);
279extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
280 DMXConfigStringPtr pName,
281 DMXConfigPairPtr pDim,
282 DMXConfigTokenPtr pOpen,
283 DMXConfigSubPtr pSubentry,
284 DMXConfigTokenPtr pClose);
285extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
286extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
287 DMXConfigCommentPtr comment,
288 DMXConfigVirtualPtr virtual);
289extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry);
290extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
291 DMXConfigType type,
292 DMXConfigCommentPtr comment,
293 DMXConfigVirtualPtr virtual);
294extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment);
295extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
296
297#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette