Logo Search packages:      
Sourcecode: tablix2 version File versions  Download package

xmlsup.c File Reference


Detailed Description

XML configuration parser.

Definition in file xmlsup.c.

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include "assert.h"
#include "main.h"
#include "data.h"
#include "chromo.h"
#include "xmlsup.h"
#include "modsup.h"
#include "error.h"
#include "gettext.h"

Go to the source code of this file.

Defines

#define FAIL(msg, node)   fatal(_(msg))
 Convenience macro for XML parser. Same as fatal(). It automatically appends line number of the XML node with error.
#define INVPROP(prop, node)   fatal(_("Invalid value of property '%s' in tag <%s>"), prop, node->name)
 Convenience macro for XML parser. Use when a property has an invalid value (e.g. property is not an integer when it should be).
#define NOPROP(prop, node)   fatal(_("Tag <%s> without required property '%s'"), node->name, prop)
 Convenience macro for XML parser. Use when a required XML node property is not defined.

Functions

void parser_addtable (table *tab)
 Saves definitions of variable resources for all events in the table struct to the XML tree.
static void parser_clean (xmlNodePtr cur)
 Removes definitions of variable resources for an event in the XML tree.
void parser_dump (FILE *f)
 Dumps XML tree into a file.
static void parser_event (xmlNodePtr start, tupleinfo *tuple)
 Parse a single event.
static void parser_event_add_res (xmlNodePtr cur, resource *res)
 Add a resource definition for an event to the XML tree.
static resourceparser_event_get_res (xmlNodePtr cur, resourcetype *restype)
 Get a resource definition for an event from the XML tree.
static void parser_event_restrictions (xmlNodePtr cur, int tupleid, int repeats)
 Parse restrictions for a single event and call proper restriction handlers.
static void parser_events (xmlNodePtr cur)
 Parse all events.
static void parser_events_restrictions (xmlNodePtr cur)
 Parse all event restrictions.
void parser_exit ()
 Free all memory allocated by the parser.
static void parser_fatal (const char *fmt, int no,...)
 Replacement for the fatal() function that adds line number to the message.
static int parser_getprop_int (xmlNodePtr cur, char *prop)
 Get an integer property from a XML node.
static char * parser_getprop_str (xmlNodePtr cur, char *prop)
 Get a string property from a XML node.
void parser_gettable (table *tab)
 Loads definitions of variable resources for all events in the XML tree to a table struct.
void parser_handler (void *ctx, const char *msg,...)
 Custom error handler for libxml.
static void parser_info (xmlNodePtr cur)
 Parse miscellaneous information.
static void parser_libxml_init (char *filename)
 Parser initialization.
int parser_main (char *filename)
 Parses an XML configuration file.
static void parser_modules (xmlNodePtr cur)
 Parse modules.
static void parser_newprop_int (xmlNodePtr cur, char *prop, int value)
 Add an integer property to a XML node.
static moduleoptionparser_options (xmlNodePtr cur, moduleoption *opt)
 Parse module options.
static void parser_remove_repeats (xmlNodePtr cur)
 Replaces event tags with repeats > 1 with multiple tags with repeats = 1.
static void parser_resource (xmlNodePtr cur, resourcetype *restype)
 Parse all resources in a resource type.
static void parser_resource_restrictions (xmlNodePtr cur, resourcetype *restype)
 Parse all resource restrictions for a single resource type.
static void parser_resource_restrictions_one (xmlNodePtr cur, resource *res)
 Parse restrictions for a single resource and call proper handlers.
static void parser_resources (xmlNodePtr start)
 Parse all resource types.
static void parser_resources_restrictions (xmlNodePtr cur)
 Parse all resource restrictions.
static void parser_restype (xmlNodePtr cur, int var)
 Define a new resource type.
static void parser_version_check (xmlNodePtr root)
 Check version of the configuration file.

Variables

static xmlDocPtr config
 XML Configuration file.


Generated by  Doxygen 1.6.0   Back to index