Data Structures | Functions | Variables

# dmxprint.c File Reference

`#include "dmxconfig.h"`
`#include "dmxparse.h"`
`#include "dmxprint.h"`
`#include "parser.h"`
`#include <stdio.h>`
`#include <stdarg.h>`
`#include <ctype.h>`

## Data Structures
struct | stack
## Functions
static void | dmxConfigIndent (void)
static void | dmxConfigNewline (void)
static void | dmxConfigPushState (int base, int comment, int step)
static void | dmxConfigPushComment (void)
static void | dmxConfigPushStep (void)
static void | dmxConfigPopState (void)
static void | dmxConfigOutput (int addSpace, int doNewline, const char *comment, const char *format,...)
static void | dmxConfigPrintComment (DMXConfigCommentPtr p)
static void | dmxConfigPrintTokenFlag (DMXConfigTokenPtr p, int flag)
static void | dmxConfigPrintToken (DMXConfigTokenPtr p)
static void | dmxConfigPrintTokenNopop (DMXConfigTokenPtr p)
static int | dmxConfigPrintQuotedString (const char *s)
static void | dmxConfigPrintString (DMXConfigStringPtr p, int quote)
static int | dmxConfigPrintPair (DMXConfigPairPtr p, int addSpace)
static void | dmxConfigPrintDisplay (DMXConfigDisplayPtr p)
static void | dmxConfigPrintWall (DMXConfigWallPtr p)
static void | dmxConfigPrintOption (DMXConfigOptionPtr p)
static void | dmxConfigPrintParam (DMXConfigParamPtr p)
static void | dmxConfigPrintSub (DMXConfigSubPtr p)
static void | dmxConfigPrintVirtual (DMXConfigVirtualPtr p)
void | dmxConfigPrint (FILE *stream, DMXConfigEntryPtr entry)
void | dmxConfigVirtualPrint (FILE *stream, DMXConfigVirtualPtr p)
## Variables
static FILE * | str = NULL
static int | indent = 0
static int | pos = 0
static struct stack * | stack
static struct stack | initialStack

## Detailed Description

This file provides support routines and helper functions to be used to pretty-print DMX configurations.

Because the DMX configuration file parsing should be capable of being used in a stand-alone fashion (i.e., independent from the DMX server source tree), no dependencies on other DMX routines are made.

## Function Documentation

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

References indent, and str.

Referenced by dmxConfigOutput().

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

References pos, and str.

Referenced by dmxConfigOutput(), dmxConfigPopState(), dmxConfigPrint(), dmxConfigPushState(), and dmxConfigVirtualPrint().

static void dmxConfigOutput | ( | int | addSpace,
|  | int | doNewline,
|  | const char * | comment,
|  | const char * | format,
|  |  | ... |
| ) |  |  | `[static]`

References dmxConfigIndent(), dmxConfigNewline(), dmxConfigPushComment(), pos, and str.

Referenced by dmxConfigPrintComment(), dmxConfigPrintPair(), dmxConfigPrintString(), and dmxConfigPrintTokenFlag().

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

References stack::base, dmxConfigFree(), dmxConfigLog(), dmxConfigNewline(), indent, and stack::next.

Referenced by dmxConfigPrintTokenFlag().

void dmxConfigPrint | ( | FILE * | stream,
|  | DMXConfigEntryPtr | entry |
| ) |  |  |

The configuration information in entry will be pretty-printed to the stream. If stream is NULL, then stdout will be used.

References _DMXConfigEntry::comment, dmxConfigComment, dmxConfigLog(), dmxConfigNewline(), dmxConfigPrintComment(), dmxConfigPrintVirtual(), dmxConfigVirtual, _DMXConfigEntry::next, pos, str, _DMXConfigEntry::type, and _DMXConfigEntry::virtual.

Referenced by dmxConfigWriteFile(), and main().

static void dmxConfigPrintComment | ( | DMXConfigCommentPtr | p | ) | `[static]`

References _DMXConfigComment::comment, and dmxConfigOutput().

Referenced by dmxConfigPrint(), and dmxConfigPrintSub().

static void dmxConfigPrintDisplay | ( | DMXConfigDisplayPtr | p | ) | `[static]`

References _DMXConfigPartDim::dim, _DMXConfigDisplay::dim, dmxConfigPrintPair(), dmxConfigPrintString(), dmxConfigPrintToken(), _DMXConfigDisplay::dname, _DMXConfigDisplay::end, _DMXConfigDisplay::name, _DMXConfigPartDim::offset, _DMXConfigDisplay::origin, _DMXConfigFullDim::root, _DMXConfigDisplay::rootHeight, _DMXConfigDisplay::rootWidth, _DMXConfigDisplay::rootX, _DMXConfigDisplay::rootXOrigin, _DMXConfigDisplay::rootXSign, _DMXConfigDisplay::rootY, _DMXConfigDisplay::rootYOrigin, _DMXConfigDisplay::rootYSign, _DMXConfigFullDim::scrn, _DMXConfigDisplay::scrnHeight, _DMXConfigDisplay::scrnWidth, _DMXConfigDisplay::scrnX, _DMXConfigDisplay::scrnY, _DMXConfigDisplay::start, _DMXConfigString::string, _DMXConfigPair::x, _DMXConfigPair::xsign, _DMXConfigPair::y, and _DMXConfigPair::ysign.

Referenced by dmxConfigPrintSub().

static void dmxConfigPrintOption | ( | DMXConfigOptionPtr | p | ) | `[static]`

References dmxConfigPrintString(), dmxConfigPrintToken(), _DMXConfigOption::end, _DMXConfigOption::start, _DMXConfigOption::string, and _DMXConfigString::string.

Referenced by dmxConfigPrintSub().

static int dmxConfigPrintPair | ( | DMXConfigPairPtr | p,
|  | int | addSpace |
| ) |  |  | `[static]`

References _DMXConfigPair::comment, dmxConfigOutput(), _DMXConfigPair::token, _DMXConfigPair::x, _DMXConfigPair::xsign, _DMXConfigPair::y, and _DMXConfigPair::ysign.

Referenced by dmxConfigPrintDisplay(), dmxConfigPrintVirtual(), and dmxConfigPrintWall().

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

References _DMXConfigParam::close, dmxConfigLog(), dmxConfigPrintString(), dmxConfigPrintToken(), dmxConfigPrintTokenNopop(), _DMXConfigParam::end, _DMXConfigParam::next, _DMXConfigParam::open, _DMXConfigParam::param, and _DMXConfigParam::start.

Referenced by dmxConfigPrintSub().

static int dmxConfigPrintQuotedString | ( | const char * | s | ) | `[static]`

Referenced by dmxConfigPrintString().

static void dmxConfigPrintString | ( | DMXConfigStringPtr | p,
|  | int | quote |
| ) |  |  | `[static]`

References _DMXConfigString::comment, dmxConfigOutput(), dmxConfigPrintQuotedString(), _DMXConfigString::next, and _DMXConfigString::string.

Referenced by dmxConfigPrintDisplay(), dmxConfigPrintOption(), dmxConfigPrintParam(), dmxConfigPrintVirtual(), and dmxConfigPrintWall().

static void dmxConfigPrintSub | ( | DMXConfigSubPtr | p | ) | `[static]`

References _DMXConfigSub::comment, _DMXConfigSub::display, dmxConfigComment, dmxConfigDisplay, dmxConfigLog(), dmxConfigOption, dmxConfigParam, dmxConfigPrintComment(), dmxConfigPrintDisplay(), dmxConfigPrintOption(), dmxConfigPrintParam(), dmxConfigPrintWall(), dmxConfigWall, _DMXConfigSub::next, _DMXConfigSub::option, _DMXConfigSub::param, _DMXConfigSub::type, and _DMXConfigSub::wall.

Referenced by dmxConfigPrintVirtual().

static void dmxConfigPrintToken | ( | DMXConfigTokenPtr | p | ) | `[static]`

References dmxConfigPrintTokenFlag().

Referenced by dmxConfigPrintDisplay(), dmxConfigPrintOption(), dmxConfigPrintParam(), dmxConfigPrintVirtual(), and dmxConfigPrintWall().

static void dmxConfigPrintTokenFlag | ( | DMXConfigTokenPtr | p,
|  | int | flag |
| ) |  |  | `[static]`

References _DMXConfigToken::comment, dmxConfigLog(), dmxConfigOutput(), dmxConfigPopState(), dmxConfigPushState(), dmxConfigPushStep(), _DMXConfigToken::line, and _DMXConfigToken::token.

Referenced by dmxConfigPrintToken(), and dmxConfigPrintTokenNopop().

static void dmxConfigPrintTokenNopop | ( | DMXConfigTokenPtr | p | ) | `[static]`

References dmxConfigPrintTokenFlag().

Referenced by dmxConfigPrintParam().

static void dmxConfigPrintVirtual | ( | DMXConfigVirtualPtr | p | ) | `[static]`

References _DMXConfigVirtual::close, _DMXConfigVirtual::dim, dmxConfigPrintPair(), dmxConfigPrintString(), dmxConfigPrintSub(), dmxConfigPrintToken(), _DMXConfigVirtual::height, _DMXConfigVirtual::name, _DMXConfigVirtual::open, _DMXConfigVirtual::start, _DMXConfigString::string, _DMXConfigVirtual::subentry, _DMXConfigVirtual::vname, _DMXConfigVirtual::width, _DMXConfigPair::x, and _DMXConfigPair::y.

Referenced by dmxConfigPrint(), and dmxConfigVirtualPrint().

static void dmxConfigPrintWall | ( | DMXConfigWallPtr | p | ) | `[static]`

References _DMXConfigWall::displayDim, dmxConfigPrintPair(), dmxConfigPrintString(), dmxConfigPrintToken(), _DMXConfigWall::end, _DMXConfigWall::nameList, _DMXConfigWall::start, and _DMXConfigWall::wallDim.

Referenced by dmxConfigPrintSub().

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

References indent.

Referenced by dmxConfigOutput().

static void dmxConfigPushState | ( | int | base,
|  | int | comment,
|  | int | step |
| ) |  |  | `[static]`

References dmxConfigAlloc(), dmxConfigNewline(), and indent.

Referenced by dmxConfigPrintTokenFlag().

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

References indent.

Referenced by dmxConfigPrintTokenFlag().

void dmxConfigVirtualPrint | ( | FILE * | stream,
|  | DMXConfigVirtualPtr | p |
| ) |  |  |

The configuration information in p will be pretty-printed to the stream. If stream is NULL, then stdout will be used.

References dmxConfigNewline(), dmxConfigPrintVirtual(), pos, and str.

Referenced by dmxConfigReadFile(), and dmxConfigSelectCallback().

## Variable Documentation

int indent = 0`[static]`

Referenced by dmxConfigIndent(), dmxConfigPopState(), dmxConfigPushComment(), dmxConfigPushState(), and dmxConfigPushStep().

struct stack initialStack`[static]`

int pos = 0`[static]`

Referenced by dmxBERestoreRenderGlyph(), dmxConfigNewline(), dmxConfigOutput(), dmxConfigPrint(), and dmxConfigVirtualPrint().

struct stack * stack`[static]`

Stack of indentation information used for pretty-printing configuration information.

FILE* str = NULL`[static]`

Referenced by dmxConfigIndent(), dmxConfigNewline(), dmxConfigOutput(), dmxConfigPrint(), dmxConfigReadFile(), dmxConfigVirtualPrint(), dmxConfigWriteFile(), dmxVDLRead(), and main().