Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

# dmxparse.h

Go to the documentation of this file.

    00001 /* $XFree86$ */
    00002 /*
    00003  * Copyright 2002 Red Hat Inc., Durham, North Carolina.
    00004  *
    00005  * All Rights Reserved.
    00006  *
    00007  * Permission is hereby granted, free of charge, to any person obtaining
    00008  * a copy of this software and associated documentation files (the
    00009  * "Software"), to deal in the Software without restriction, including
    00010  * without limitation on the rights to use, copy, modify, merge,
    00011  * publish, distribute, sublicense, and/or sell copies of the Software,
    00012  * and to permit persons to whom the Software is furnished to do so,
    00013  * subject to the following conditions:
    00014  *
    00015  * The above copyright notice and this permission notice (including the
    00016  * next paragraph) shall be included in all copies or substantial
    00017  * portions of the Software.
    00018  *
    00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00020  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00021  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    00022  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
    00023  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    00024  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00025  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    00026  * SOFTWARE.
    00027  */
    00028
    00029 /*
    00030  * Authors:
    00031  *   Rickard E. (Rik) Faith <faith@redhat.com>
    00032  *
    00033  */
    00034
    00038 #ifndef _DMXPARSE_H_
    00039 #define _DMXPARSE_H_
    00040
    00041 #include <stdio.h>              /* For FILE */
    00042
    00044 typedef struct _DMXConfigToken {
    00045     int                      token;
    00046     int                      line;
    00047     const char               *comment;
    00048 } DMXConfigToken, *DMXConfigTokenPtr;
    00049
    00051 typedef struct _DMXConfigString {
    00052     int                      token;
    00053     int                      line;
    00054     const char               *comment;
    00055     const char               *string;
    00056     struct _DMXConfigString  *next;
    00057 } DMXConfigString, *DMXConfigStringPtr;
    00058
    00060 typedef struct _DMXConfigNumber {
    00061     int                      token;
    00062     int                      line;
    00063     const char               *comment;
    00064     int                      number;
    00065 } DMXConfigNumber, *DMXConfigNumberPtr;
    00066
    00068 typedef struct _DMXConfigPair {
    00069     int                      token;
    00070     int                      line;
    00071     const char               *comment;
    00072     int                      x;
    00073     int                      y;
    00074     int                      xsign;
    00075     int                      ysign;
    00076 } DMXConfigPair, *DMXConfigPairPtr;
    00077
    00079 typedef struct _DMXConfigComment {
    00080     int                      token;
    00081     int                      line;
    00082     const char               *comment;
    00083 } DMXConfigComment, *DMXConfigCommentPtr;
    00084
    00085 typedef enum {
    00086     dmxConfigComment,
    00087     dmxConfigVirtual,
    00088     dmxConfigDisplay,
    00089     dmxConfigWall,
    00090     dmxConfigOption,
    00091     dmxConfigParam
    00092 } DMXConfigType;
    00093
    00095 typedef struct _DMXConfigPartDim {
    00096     DMXConfigPairPtr         dim;
    00097     DMXConfigPairPtr         offset;
    00098 } DMXConfigPartDim, *DMXConfigPartDimPtr;
    00099
    00101 typedef struct _DMXConfigFullDim {
    00102     DMXConfigPartDimPtr      scrn;
    00103     DMXConfigPartDimPtr      root;
    00104 } DMXConfigFullDim, *DMXConfigFullDimPtr;
    00105
    00107 typedef struct _DMXConfigDisplay {
    00108                                 /* Summary information */
    00109     const char               *name;
    00110                                 /* Screen Window Geometry */
    00111     int                      scrnWidth, scrnHeight;
    00112     int                      scrnX, scrnY;
    00113     int                      scrnXSign, scrnYSign;
    00114                                 /* Root Window Geometry */
    00115     int                      rootWidth, rootHeight;
    00116     int                      rootX, rootY;
    00117     int                      rootXSign, rootYSign;
    00118                                 /* Origin in global space */
    00119     int                      rootXOrigin, rootYOrigin;
    00120
    00121                                 /* Raw configuration information */
    00122     DMXConfigTokenPtr        start;
    00123     DMXConfigStringPtr       dname;
    00124     DMXConfigFullDimPtr      dim;
    00125     DMXConfigPairPtr         origin;
    00126     DMXConfigTokenPtr        end;
    00127 } DMXConfigDisplay, *DMXConfigDisplayPtr;
    00128
    00130 typedef struct _DMXConfigWall {
    00131                                 /* Summary information */
    00132     int                      width, height; /* dimensions of displays */
    00133     int                      xwall, ywall; /* dimensions of wall, in tiles */
    00134
    00135
    00136                                 /* Raw configuration informaiton */
    00137     DMXConfigTokenPtr        start;
    00138     DMXConfigPairPtr         wallDim;
    00139     DMXConfigPairPtr         displayDim;
    00140     DMXConfigStringPtr       nameList;
    00141     DMXConfigTokenPtr        end;
    00142 } DMXConfigWall, *DMXConfigWallPtr;
    00143
    00145 typedef struct _DMXConfigOption {
    00146                                 /* Summary information */
    00147     char                     *string;
    00148
    00149                                 /* Raw configuration informaiton */
    00150     DMXConfigTokenPtr        start;
    00151     DMXConfigStringPtr       option;
    00152     DMXConfigTokenPtr        end;
    00153 } DMXConfigOption, *DMXConfigOptionPtr;
    00154
    00156 typedef struct _DMXConfigParam {
    00157     int                      argc;
    00158     const char               **argv;
    00159
    00160     DMXConfigTokenPtr        start;
    00161     DMXConfigTokenPtr        open;
    00162     DMXConfigStringPtr       param;
    00163     DMXConfigTokenPtr        close;
    00164     DMXConfigTokenPtr        end; /* Either open/close OR end */
    00165     struct _DMXConfigParam   *next;
    00166 } DMXConfigParam, *DMXConfigParamPtr;
    00167
    00169 typedef struct _DMXConfigSub {
    00170     DMXConfigType             type;
    00171     DMXConfigCommentPtr       comment;
    00172     DMXConfigDisplayPtr       display;
    00173     DMXConfigWallPtr          wall;
    00174     DMXConfigOptionPtr        option;
    00175     DMXConfigParamPtr         param;
    00176     struct _DMXConfigSub      *next;
    00177 } DMXConfigSub, *DMXConfigSubPtr;
    00178
    00180 typedef struct _DMXConfigVirtual {
    00181                                 /* Summary information */
    00182     const char                *name;
    00183     int                       width, height;
    00184
    00185                                 /* Raw configuration information */
    00186     DMXConfigTokenPtr         start;
    00187     DMXConfigStringPtr        vname;
    00188     DMXConfigPairPtr          dim;
    00189     DMXConfigTokenPtr         open;
    00190     DMXConfigSubPtr           subentry;
    00191     DMXConfigTokenPtr         close;
    00192 } DMXConfigVirtual, *DMXConfigVirtualPtr;
    00193
    00195 typedef struct _DMXConfigEntry {
    00196     DMXConfigType            type;
    00197     DMXConfigCommentPtr      comment;
    00198     DMXConfigVirtualPtr      virtual;
    00199     struct _DMXConfigEntry   *next;
    00200 } DMXConfigEntry, *DMXConfigEntryPtr;
    00201
    00202 extern DMXConfigEntryPtr   dmxConfigEntry;
    00203
    00204 extern int                 yylex(void);
    00205 extern int                 yydebug;
    00206 extern void                yyerror(const char *message);
    00207
    00208 extern void                dmxConfigLog(const char *format, ...);
    00209 extern void                *dmxConfigAlloc(unsigned long bytes);
    00210 extern void                *dmxConfigRealloc(void *orig,
    00211                                              unsigned long orig_bytes,
    00212                                              unsigned long bytes);
    00213 extern const char          *dmxConfigCopyString(const char *string,
    00214                                                 int length);
    00215 extern void                dmxConfigFree(void *area);
    00216 extern DMXConfigTokenPtr   dmxConfigCreateToken(int token, int line,
    00217                                                 const char *comment);
    00218 extern void                dmxConfigFreeToken(DMXConfigTokenPtr p);
    00219 extern DMXConfigStringPtr  dmxConfigCreateString(int token, int line,
    00220                                                  const char *comment,
    00221                                                  const char *string);
    00222 extern void                dmxConfigFreeString(DMXConfigStringPtr p);
    00223 extern DMXConfigNumberPtr  dmxConfigCreateNumber(int token, int line,
    00224                                                  const char *comment,
    00225                                                  int number);
    00226 extern void                dmxConfigFreeNumber(DMXConfigNumberPtr p);
    00227 extern DMXConfigPairPtr    dmxConfigCreatePair(int token, int line,
    00228                                                const char *comment,
    00229                                                int x, int y,
    00230                                                int xsign, int ysign);
    00231 extern void                dmxConfigFreePair(DMXConfigPairPtr p);
    00232 extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
    00233                                                   const char *comment);
    00234 extern void                dmxConfigFreeComment(DMXConfigCommentPtr p);
    00235 extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
    00236                                                   DMXConfigPairPtr pOffset);
    00237 extern void                dmxConfigFreePartDim(DMXConfigPartDimPtr p);
    00238 extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
    00239                                                   DMXConfigPartDimPtr pRoot);
    00240 extern void                dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
    00241 extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
    00242                                                   DMXConfigStringPtr pName,
    00243                                                   DMXConfigFullDimPtr pDim,
    00244                                                   DMXConfigPairPtr pOrigin,
    00245                                                   DMXConfigTokenPtr pEnd);
    00246 extern void                dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
    00247 extern DMXConfigWallPtr    dmxConfigCreateWall(DMXConfigTokenPtr pStart,
    00248                                                DMXConfigPairPtr pWallDim,
    00249                                                DMXConfigPairPtr pDisplayDim,
    00250                                                DMXConfigStringPtr pNameList,
    00251                                                DMXConfigTokenPtr pEnd);
    00252 extern void                dmxConfigFreeWall(DMXConfigWallPtr p);
    00253 extern DMXConfigOptionPtr  dmxConfigCreateOption(DMXConfigTokenPtr pStart,
    00254                                                  DMXConfigStringPtr pOption,
    00255                                                  DMXConfigTokenPtr pEnd);
    00256 extern void                dmxConfigFreeOption(DMXConfigOptionPtr p);
    00257 extern DMXConfigParamPtr   dmxConfigCreateParam(DMXConfigTokenPtr pStart,
    00258                                                 DMXConfigTokenPtr pOpen,
    00259                                                 DMXConfigStringPtr pParam,
    00260                                                 DMXConfigTokenPtr pClose,
    00261                                                 DMXConfigTokenPtr pEnd);
    00262 extern void                dmxConfigFreeParam(DMXConfigParamPtr p);
    00263 extern const char          **dmxConfigLookupParam(DMXConfigParamPtr p,
    00264                                                   const char *key,
    00265                                                   int *argc);
    00266 extern DMXConfigSubPtr     dmxConfigCreateSub(DMXConfigType type,
    00267                                               DMXConfigCommentPtr comment,
    00268                                               DMXConfigDisplayPtr display,
    00269                                               DMXConfigWallPtr wall,
    00270                                               DMXConfigOptionPtr option,
    00271                                               DMXConfigParamPtr param);
    00272 extern void                dmxConfigFreeSub(DMXConfigSubPtr sub);
    00273 extern DMXConfigSubPtr     dmxConfigSubComment(DMXConfigCommentPtr comment);
    00274 extern DMXConfigSubPtr     dmxConfigSubDisplay(DMXConfigDisplayPtr display);
    00275 extern DMXConfigSubPtr     dmxConfigSubWall(DMXConfigWallPtr wall);
    00276 extern DMXConfigSubPtr     dmxConfigSubOption(DMXConfigOptionPtr option);
    00277 extern DMXConfigSubPtr     dmxConfigSubParam(DMXConfigParamPtr param);
    00278 extern DMXConfigSubPtr     dmxConfigAddSub(DMXConfigSubPtr head,
    00279                                            DMXConfigSubPtr sub);
    00280 extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
    00281                                                   DMXConfigStringPtr pName,
    00282                                                   DMXConfigPairPtr pDim,
    00283                                                   DMXConfigTokenPtr pOpen,
    00284                                                   DMXConfigSubPtr pSubentry,
    00285                                                   DMXConfigTokenPtr pClose);
    00286 extern void                dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
    00287 extern DMXConfigEntryPtr   dmxConfigCreateEntry(DMXConfigType type,
    00288                                                 DMXConfigCommentPtr comment,
    00289                                                 DMXConfigVirtualPtr virtual);
    00290 extern void                dmxConfigFreeEntry(DMXConfigEntryPtr entry);
    00291 extern DMXConfigEntryPtr   dmxConfigAddEntry(DMXConfigEntryPtr head,
    00292                                              DMXConfigType type,
    00293                                              DMXConfigCommentPtr comment,
    00294                                              DMXConfigVirtualPtr virtual);
    00295 extern DMXConfigEntryPtr   dmxConfigEntryComment(DMXConfigCommentPtr comment);
    00296 extern DMXConfigEntryPtr   dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
    00297
    00298 #endif