- Main Page
- Data Structures
- Files

- File List
- Globals

# dmxparse.h

Go to the documentation of this file.

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