# dmxconfig.c File Reference

`#include "dmx.h"`
`#include "dmxinput.h"`
`#include "dmxconfig.h"`
`#include "dmxparse.h"`
`#include "dmxlog.h"`
`#include "dmxcb.h"`
`#include "dmxstat.h"`
`#include "parser.h"`

## Data Structures

struct | DMXConfigListStruct
struct | DMXConfigCmdStruct

## Defines

#define | GEN(param, glob, def)

## Typedefs

typedef struct DMXConfigListStruct | DMXConfigList
typedef struct DMXConfigListStruct * | DMXConfigListPtr
typedef struct DMXConfigCmdStruct | DMXConfigCmd
typedef struct DMXConfigCmdStruct * | DMXConfigCmdPtr

## Functions

int | yyparse (void)
void | dmxConfigStoreDisplay (const char *display)
void | dmxConfigStoreInput (const char *input)
void | dmxConfigStoreXInput (const char *input)
void | dmxConfigStoreFile (const char *file)
void | dmxConfigStoreConfig (const char *config)
static int | dmxConfigReadFile (const char *filename, int debug)
static const char * | dmxConfigMatch (const char *target, DMXConfigEntryPtr entry)
static DMXScreenInfo * | dmxConfigAddDisplay (const char *name, int scrnWidth, int scrnHeight, int scrnX, int scrnY, int scrnXSign, int scrnYSign, int rootWidth, int rootHeight, int rootX, int rootY, int rootXSign, int rootYSign)
DMXInputInfo * | dmxConfigAddInput (const char *name, int core)
static void | dmxConfigCopyFromDisplay (DMXConfigDisplayPtr d)
static void | dmxConfigCopyFromWall (DMXConfigWallPtr w)
static void | dmxConfigCopyFromOption (DMXConfigOptionPtr o)
static void | dmxConfigCopyFromParam (DMXConfigParamPtr p)
static void | dmxConfigCopyData (DMXConfigVirtualPtr v)
static void | dmxConfigFromCommandLine (void)
static void | dmxConfigFromConfigFile (void)
static void | dmxConfigConfigInputs (void)
void | dmxConfigConfigure (void)
void | dmxConfigSetMaxScreens (void)

## Variables

FILE * | yyin
static char * | dmxXkbRules
static char * | dmxXkbModel
static char * | dmxXkbLayout
static char * | dmxXkbVariant
static char * | dmxXkbOptions
DMXConfigEntryPtr | dmxConfigEntry
static DMXConfigCmd | dmxConfigCmd
static int | dmxDisplaysFromCommandLine

## Detailed Description

Provides interface for reading DMX configuration files and for combining that information with command-line configuration parameters.

## Define Documentation

#define GEN | ( |  | param,
|  |  | glob,
|  |  | def |
| ) |  |  |

Value:

    void dmxConfigSet##glob(const char *param) {                                 \
         if (dmx##glob) free((void *)dmx##glob);                                  \
         dmx##glob = strdup(param);                                               \
     }                                                                            \
     char *dmxConfigGet##glob(void) {                                             \
         return (char *)(dmx##glob ? dmx##glob : def);                            \
     }

This macro is used to generate the following access methods:

- dmxConfig{Set,Get}rules
- dmxConfig{Set,Get}model
- dmxConfig{Set,Get}layout
- dmxConfig{Set,Get}variant
- dmxConfig{Set,Get}options These methods are used to read and write information about the keyboard.

## Typedef Documentation

typedef struct DMXConfigCmdStruct DMXConfigCmd

This stucture stores the parsed configuration information.

typedef struct DMXConfigCmdStruct * DMXConfigCmdPtr

typedef struct DMXConfigListStruct DMXConfigList

Stores lists of configuration information.

typedef struct DMXConfigListStruct * DMXConfigListPtr

## Function Documentation

static DMXScreenInfo* dmxConfigAddDisplay | ( | const char * | name,
|  | int | scrnWidth,
|  | int | scrnHeight,
|  | int | scrnX,
|  | int | scrnY,
|  | int | scrnXSign,
|  | int | scrnYSign,
|  | int | rootWidth,
|  | int | rootHeight,
|  | int | rootX,
|  | int | rootY,
|  | int | rootXSign,
|  | int | rootYSign |
| ) |  |  | `[static]`

References dmxFatal, dmxLog(), dmxNumScreens, dmxScreens, dmxStatAlloc(), _DMXScreenInfo::index, _DMXScreenInfo::name, _DMXScreenInfo::rootHeight, _DMXScreenInfo::rootWidth, _DMXScreenInfo::rootX, _DMXScreenInfo::rootY, _DMXScreenInfo::scrnHeight, _DMXScreenInfo::scrnWidth, _DMXScreenInfo::scrnX, _DMXScreenInfo::scrnXSign, _DMXScreenInfo::scrnY, _DMXScreenInfo::scrnYSign, and _DMXScreenInfo::stat.

Referenced by dmxConfigCopyFromDisplay(), dmxConfigCopyFromWall(), and dmxConfigFromCommandLine().

DMXInputInfo* dmxConfigAddInput | ( | const char * | name,
|  | int | core |
| ) |  |  |

References _DMXInputInfo::core, dmxFatal, dmxInputs, dmxLog(), dmxNumInputs, _DMXInputInfo::inputIdx, _DMXInputInfo::name, and _DMXInputInfo::scrnIdx.

Referenced by dmxConfigConfigInputs(), dmxInputAttachBackend(), and dmxInputAttachConsole().

static void dmxConfigConfigInputs | ( | void |  | ) | `[static]`

References dmxConfigAddInput(), dmxNumInputs, dmxNumScreens, dmxScreens, DMXConfigCmdStruct::inputs, DMXConfigListStruct::name, DMXConfigListStruct::next, and DMXConfigCmdStruct::xinputs.

Referenced by dmxConfigConfigure().

void dmxConfigConfigure | ( | void |  | ) |

Set up the appropriate global variables so that the DMX server will be initialized using the configuration specified in the config file and on the command line.

References DMXConfigCmdStruct::config, DMXConfigCmdStruct::displays, dmxConfigConfigInputs(), dmxConfigFreeEntry(), dmxConfigFromCommandLine(), dmxConfigFromConfigFile(), dmxConfigReadFile(), dmxLog(), dmxWarning, and DMXConfigCmdStruct::filename.

Referenced by dmxConfigSetMaxScreens(), and InitOutput().

static void dmxConfigCopyData | ( | DMXConfigVirtualPtr | v | ) | `[static]`

References _DMXConfigVirtual::dim, _DMXConfigSub::display, dmxConfigCopyFromDisplay(), dmxConfigCopyFromOption(), dmxConfigCopyFromParam(), dmxConfigCopyFromWall(), dmxConfigDisplay, dmxConfigOption, dmxConfigParam, dmxConfigWall, dmxFatal, dmxLog(), dmxSetWidthHeight(), _DMXConfigSub::next, _DMXConfigSub::option, _DMXConfigSub::param, _DMXConfigVirtual::subentry, _DMXConfigSub::type, _DMXConfigSub::wall, _DMXConfigPair::x, and _DMXConfigPair::y.

Referenced by dmxConfigFromConfigFile().

static void dmxConfigCopyFromDisplay | ( | DMXConfigDisplayPtr | d | ) | `[static]`

References dmxConfigAddDisplay(), _DMXConfigDisplay::name, _DMXConfigDisplay::rootHeight, _DMXConfigDisplay::rootWidth, _DMXConfigDisplay::rootX, _DMXConfigDisplay::rootXOrigin, _DMXConfigDisplay::rootXSign, _DMXConfigDisplay::rootY, _DMXConfigDisplay::rootYOrigin, _DMXConfigDisplay::scrnHeight, _DMXConfigDisplay::scrnWidth, _DMXConfigDisplay::scrnX, _DMXConfigDisplay::scrnXSign, _DMXConfigDisplay::scrnY, _DMXConfigDisplay::scrnYSign, _DMXScreenInfo::where, _DMXScreenInfo::whereX, and _DMXScreenInfo::whereY.

Referenced by dmxConfigCopyData().

static void dmxConfigCopyFromOption | ( | DMXConfigOptionPtr | o | ) | `[static]`

References _DMXConfigString::next, _DMXConfigOption::option, _DMXConfigString::string, and _DMXConfigOption::string.

Referenced by dmxConfigCopyData().

static void dmxConfigCopyFromParam | ( | DMXConfigParamPtr | p | ) | `[static]`

References dmxConfigLookupParam(), dmxConfigSetXkbLayout(), dmxConfigSetXkbModel(), dmxConfigSetXkbOptions(), dmxConfigSetXkbRules(), and dmxConfigSetXkbVariant().

Referenced by dmxConfigCopyData().

static void dmxConfigCopyFromWall | ( | DMXConfigWallPtr | w | ) | `[static]`

References dmxConfigAddDisplay(), dmxInfo, dmxLog(), dmxNumScreens, dmxScreens, _DMXConfigWall::height, _DMXScreenInfo::name, _DMXConfigWall::nameList, _DMXConfigString::next, PosAbsolute, PosBelow, _DMXConfigString::string, _DMXScreenInfo::where, _DMXScreenInfo::whereRefScreen, _DMXScreenInfo::whereX, _DMXScreenInfo::whereY, _DMXConfigWall::width, _DMXConfigWall::xwall, and _DMXConfigWall::ywall.

Referenced by dmxConfigCopyData().

static void dmxConfigFromCommandLine | ( | void |  | ) | `[static]`

References DMXConfigCmdStruct::displays, dmxConfigAddDisplay(), dmxInfo, dmxLog(), dmxNumScreens, dmxScreens, _DMXScreenInfo::name, DMXConfigListStruct::name, DMXConfigListStruct::next, PosBelow, _DMXScreenInfo::where, _DMXScreenInfo::whereRefScreen, _DMXScreenInfo::whereX, and _DMXScreenInfo::whereY.

Referenced by dmxConfigConfigure().

static void dmxConfigFromConfigFile | ( | void |  | ) | `[static]`

References DMXConfigCmdStruct::config, dmxConfigCopyData(), dmxConfigMatch(), dmxConfigVirtual, dmxFatal, dmxInfo, dmxLog(), DMXConfigCmdStruct::filename, _DMXConfigEntry::next, _DMXConfigEntry::type, and _DMXConfigEntry::virtual.

Referenced by dmxConfigConfigure().

static const char* dmxConfigMatch | ( | const char * | target,
|  | DMXConfigEntryPtr | entry |
| ) |  |  | `[static]`

References DMXConfigCmdStruct::config, _DMXConfigVirtual::name, and _DMXConfigEntry::virtual.

Referenced by dmxConfigFromConfigFile().

static int dmxConfigReadFile | ( | const char * | filename,
|  | int | debug |
| ) |  |  | `[static]`

References dmxInfo, dmxLog(), str, yydebug, yyin, and yyparse().

Referenced by dmxConfigConfigure().

void dmxConfigSetMaxScreens | ( | void |  | ) |

This function determines the number of displays we WILL have and sets MAXSCREENS to that value. This is difficult since the number depends on the command line (which is easy to count) or on the config file, which has to be parsed.

References dmxConfigConfigure(), dmxDisplaysFromCommandLine, dmxNumScreens, and DMXConfigCmdStruct::filename.

Referenced by ddxProcessArgument().

void dmxConfigStoreConfig | ( | const char * | config | ) |

Make a note that config should be used as the configuration for current instantiation of the DMX server.

References DMXConfigCmdStruct::config, dmxFatal, and dmxLog().

Referenced by ddxProcessArgument().

void dmxConfigStoreDisplay | ( | const char * | display | ) |

Make a note that display is the name of an X11 display that should be initialized as a backend (output) display. Called from ddxProcessArgument.

References DMXConfigCmdStruct::displays, dmxDisplaysFromCommandLine, dmxFatal, dmxLog(), DMXConfigListStruct::name, and DMXConfigListStruct::next.

Referenced by ddxProcessArgument().

void dmxConfigStoreFile | ( | const char * | file | ) |

Make a note that file is the configuration file.

References dmxFatal, dmxLog(), and DMXConfigCmdStruct::filename.

Referenced by ddxProcessArgument().

void dmxConfigStoreInput | ( | const char * | input | ) |

Make a note that input is the name of an X11 display that should be used for input (either a backend or a console input device).

References dmxFatal, dmxLog(), DMXConfigCmdStruct::inputs, DMXConfigListStruct::name, and DMXConfigListStruct::next.

Referenced by ddxProcessArgument().

void dmxConfigStoreXInput | ( | const char * | input | ) |

Make a note that input is the name of an X11 display that should be used for input from XInput extension devices.

References dmxFatal, dmxLog(), DMXConfigListStruct::name, DMXConfigListStruct::next, and DMXConfigCmdStruct::xinputs.

Referenced by ddxProcessArgument().

int yyparse | ( | void |  | ) |

Referenced by dmxConfigReadFile(), and main().

## Variable Documentation

DMXConfigCmd dmxConfigCmd`[static]`

DMXConfigEntryPtr dmxConfigEntry

Referenced by main().

int dmxDisplaysFromCommandLine`[static]`

Referenced by dmxConfigSetMaxScreens(), and dmxConfigStoreDisplay().

char* dmxXkbLayout`[static]`

char* dmxXkbModel`[static]`

char* dmxXkbOptions`[static]`

char* dmxXkbRules`[static]`

char* dmxXkbVariant`[static]`

FILE* yyin

Referenced by dmxConfigReadFile().

Generated June 29, 2004 for Distributed Multihead X by doxygen 1.3.4. </addres>