Home

GEONius.com
29-Feb-2016
E-mail

edb_util - EPOCH Events Database Utilities

The EDB_UTIL functions are used to load and access an EPOCH events database. The events database is defined in an ASCII flat file:

    ...
    [events]
    eventName eventNumber "text" priority
    ...
    eventName eventNumber "text" priority

The database is loaded from the file into memory as follows:

    #include  <stdio.h>				-- Standard I/O definitions.
    #include  "edb_util.h"			-- EPOCH events database.
    EventsDB  database ;
    ...
    edbCreate ("fileName", &database) ;

Once the database is loaded, an event message can be formatted using the database-defined template for the event:

    int  number ;				-- Event number.
    NVarSet  data ;				-- Dynamic data.
    ...
    printf ("(%s) %s\n",
            edbName (database, number),
            edbFormat (database, number, data)) ;

Dynamic data fields in the template ("$name" or "$(name)") are replaced by the corresponding value retrieved from the set of named variables passed into edbFormat().

Event numbers can converted to their textual names and vice-versa:

    number = edbNumber (database, "name") ;
    printf ("Event #%d = \"%s\"\n",
            number, edbName (database, number)) ;

Public Procedures

edbCreate() - creates a memory-resident, EPOCH events database.
edbDestroy() - deletes a database.
edbFile() - returns the database's name.
edbFormat() - formats an event message.
edbLoad() - loads an EPOCH events database.
edbName() - converts an event number to its name.
edbNumber() - converts an event name to its number.
edbText() - returns an event's text template.

Source Files

edb_util.c
edb_util.h

Alex Measday  /  E-mail