dmxparse.h revision f0ab104f070bc7f569404826fea1828ed985638c
/*
* Copyright 2002 Red Hat Inc., Durham, North Carolina.
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation on the rights to use, copy, modify, merge,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
* Authors:
* Rickard E. (Rik) Faith <faith@redhat.com>
*
*/
/** \file
* Interface to DMX configuration file parser. \see dmxparse.c */
#ifndef _DMXPARSE_H_
#define _DMXPARSE_H_
#include <stdio.h> /* For FILE */
/** Stores tokens not stored in other structures (e.g., keywords and ;) */
typedef struct _DMXConfigToken {
int token;
int line;
const char *comment;
/** Stores parsed strings. */
typedef struct _DMXConfigString {
int token;
int line;
const char *comment;
const char *string;
struct _DMXConfigString *next;
/** Stores parsed numbers. */
typedef struct _DMXConfigNumber {
int token;
int line;
const char *comment;
int number;
/** Stores parsed pairs (e.g., x y) */
typedef struct _DMXConfigPair {
int token;
int line;
const char *comment;
int x;
int y;
int xsign;
int ysign;
/** Stores parsed comments not stored with a token. */
typedef struct _DMXConfigComment {
int token;
int line;
const char *comment;
typedef enum {
/** Stores a geometry specification. */
typedef struct _DMXConfigPartDim {
/** Stores a pair of geometry specifications. */
typedef struct _DMXConfigFullDim {
/** Stores parsed display information. */
typedef struct _DMXConfigDisplay {
/* Summary information */
const char *name;
/* Screen Window Geometry */
int scrnWidth, scrnHeight;
/* Root Window Geometry */
int rootWidth, rootHeight;
/* Origin in global space */
int rootXOrigin, rootYOrigin;
/* Raw configuration information */
/** Stores parsed wall information. */
typedef struct _DMXConfigWall {
/* Summary information */
/* Raw configuration informaiton */
/** Stores parsed option information. */
typedef struct _DMXConfigOption {
/* Summary information */
char *string;
/* Raw configuration informaiton */
/** Stores parsed param information. */
typedef struct _DMXConfigParam {
int argc;
const char **argv;
struct _DMXConfigParam *next;
/** Stores options under an entry (subentry). */
typedef struct _DMXConfigSub {
struct _DMXConfigSub *next;
/** Stores parsed virtual information. */
typedef struct _DMXConfigVirtual {
/* Summary information */
const char *name;
/* Raw configuration information */
/** Heads entry storage. */
typedef struct _DMXConfigEntry {
struct _DMXConfigEntry *next;
extern DMXConfigEntryPtr dmxConfigEntry;
extern int yylex(void);
extern int yydebug;
extern void dmxConfigLog(const char *format, ...);
extern void *dmxConfigAlloc(unsigned long bytes);
extern void *dmxConfigRealloc(void *orig,
unsigned long orig_bytes,
unsigned long bytes);
extern const char *dmxConfigCopyString(const char *string,
int length);
extern void dmxConfigFree(void *area);
const char *comment);
extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
const char *comment,
const char *string);
extern void dmxConfigFreeString(DMXConfigStringPtr p);
const char *comment,
int number);
extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
const char *comment,
int x, int y,
extern void dmxConfigFreePair(DMXConfigPairPtr p);
const char *comment);
extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
extern void dmxConfigFreeWall(DMXConfigWallPtr p);
extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
extern void dmxConfigFreeParam(DMXConfigParamPtr p);
extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
const char *key,
int *argc);
#endif