Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
Macros
trace.h File Reference

Public header file for the trace functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TRACE_ASCII   0
 Identifier for plain ASCII trace record format. More...
 
#define TRACE_HTML   1
 Identifier for HTML trace record format. More...
 

Functions

Public Tracing Functions

These functions are used by the application to construct and configure the trace object.

void * vpTraceCtor (void *vpParserCtx)
 The trace object constructor. More...
 
void vTraceDtor (void *vpCtx)
 Trace destructor. More...
 
void vTraceOutputType (void *vpCtx, aint uiType)
 Set the trace record display type. More...
 
void vTraceSetOutput (void *vpCtx, const char *cpFileName)
 
void vTraceConfig (void *vpCtx, const char *cpFileName)
 Read a configuration file and set the trace configuration accordingly. More...
 
void vTraceConfigDisplay (void *vpCtx, const char *cpFileName)
 Display the trace object's current configuration. More...
 
void vTraceConfigGen (void *vpCtx, const char *cpFileName)
 Generate a configuration file for the current parser. More...
 
aint uiTraceGetRecordCount (void *vpCtx)
 Get the number of traced records, displayed or not. More...
 

Detailed Description

Public header file for the trace functions.

Definition in file trace.h.

Macro Definition Documentation

◆ TRACE_ASCII

#define TRACE_ASCII   0

Identifier for plain ASCII trace record format.

Definition at line 41 of file trace.h.

◆ TRACE_HTML

#define TRACE_HTML   1

Identifier for HTML trace record format.

Definition at line 45 of file trace.h.

Function Documentation

◆ uiTraceGetRecordCount()

aint uiTraceGetRecordCount ( void *  vpCtx)

Get the number of traced records, displayed or not.

The trace object may be configured to simply count the number of records that it would have displayed, but not to actually display them. With this function the application can retrieve the record count whether or not they were actually displayed.

Parameters
vpCtxPointer to a valid trace object context returned from vpTraceCtor(). If not valid the application will silently exit with a BAD_CONTEXT exit code.

Definition at line 308 of file trace.c.

◆ vpTraceCtor()

void* vpTraceCtor ( void *  vpCtx)

The trace object constructor.

Parameters
vpCtxPointer to a valid parser context previously returned from vpParserCtor(). If invalid, application will silently exit with a BAD_CONTEXT exit code.
Returns
Pointer to the trace object context.

Definition at line 92 of file trace.c.

◆ vTraceConfig()

void vTraceConfig ( void *  vpCtx,
const char *  cpFileName 
)

Read a configuration file and set the trace configuration accordingly.

Parameters
vpCtxPointer to a valid trace object context returned from vpTraceCtor(). If not valid the application will silently exit with a BAD_CONTEXT exit code.
cpFileNameName of the configuration file. Must refer to an existing file.

Definition at line 143 of file trace-config.c.

◆ vTraceConfigDisplay()

void vTraceConfigDisplay ( void *  vpCtx,
const char *  cpFileName 
)

Display the trace object's current configuration.

Parameters
vpCtxPointer to a valid trace object context returned from vpTraceCtor(). If not valid the application will silently exit with a BAD_CONTEXT exit code.
cpFileNameName of the file to write the configuration information to. If NULL, displays to stdout.

Definition at line 387 of file trace-config.c.

◆ vTraceConfigGen()

void vTraceConfigGen ( void *  vpCtx,
const char *  cpFileName 
)

Generate a configuration file for the current parser.

The configuration requires specific knowledge of the rule and UDT names in the SABNF grammar used to define the parser. The generated file will have commented lines for all possible configuration settings. This will serve as a starting point with all options presented for the user's choices.

Parameters
vpCtxPointer to a valid trace object context returned from vpTraceCtor(). If not valid the application will silently exit with a BAD_CONTEXT exit code.
cpFileNameName of the file to write the generated configuration to. If NULL, displays to stdout.

Definition at line 452 of file trace-config.c.

◆ vTraceDtor()

void vTraceDtor ( void *  vpCtx)

Trace destructor.

Note: Distruction of the trace object is optional. The parent parser's destructor, vParserDtor(), will call this function via the macro TRACE_DTOR().

Parameters
vpCtxPointer to a trace context, returned from a previous call to vpTraceCtor(), NULL will be silently ignored. However, non-NULL values must be valid or the application will exit with a BAD_CONTEXT exit code.

Definition at line 152 of file trace.c.

◆ vTraceOutputType()

void vTraceOutputType ( void *  vpCtx,
aint  uiType 
)

Set the trace record display type.

Choose between ASCII and HTML output mode.

Parameters
vpCtxPointer to a valid trace object context returned from vpTraceCtor(). If not valid the application will silently exit with a BAD_CONTEXT exit code.
uiTypeOne of TRACE_ASCII or TRACE_HTML.

Definition at line 90 of file trace-config.c.

◆ vTraceSetOutput()

void vTraceSetOutput ( void *  vpCtx,
const char *  cpFileName 
)

Definition at line 172 of file trace.c.

APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.