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

The public trace object functions. More...

#include "./apg.h"
#include "../utilities/utilities.h"
#include "./parserp.h"
#include "./tracep.h"
Include dependency graph for trace.c:

Go to the source code of this file.

Functions

void * vpTraceCtor (void *vpCtx)
 The trace object constructor. More...
 
void vTraceDtor (void *vpCtx)
 Trace destructor. More...
 
void vTraceSetOutput (void *vpCtx, const char *cpFileName)
 
void vTraceApgexHeader (void *vpCtx)
 Only called by apgex. More...
 
void vTraceApgexFooter (void *vpCtx)
 Only called by apgex. More...
 
void vTraceApgexSeparator (void *vpCtx, aint uiLastIndex)
 Only called by apgex. More...
 
void vTraceBegin (void *vpCtx)
 Called by the parser to start the trace. More...
 
void vTraceEnd (void *vpCtx)
 Called by the parser to end the trace. More...
 
void vTraceDown (void *vpCtx, const opcode *spOp, aint uiOffset)
 Called by the parser prior to downward traversal of a parse tree node. More...
 
void vTraceUp (void *vpCtx, const opcode *spOp, aint uiState, aint uiOffset, aint uiPhraseLength)
 Called by the parser following upward traversal of a parse tree node. More...
 
aint uiTraceGetRecordCount (void *vpCtx)
 Get the number of traced records, displayed or not. More...
 

Detailed Description

The public trace object functions.

Definition in file trace.c.

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.

◆ vTraceApgexFooter()

void vTraceApgexFooter ( void *  vpCtx)

Only called by apgex.

Displays a special form of footer for apgex applications.

Definition at line 211 of file trace.c.

◆ vTraceApgexHeader()

void vTraceApgexHeader ( void *  vpCtx)

Only called by apgex.

Displays a special form of header for apgex applications.

Definition at line 199 of file trace.c.

◆ vTraceApgexSeparator()

void vTraceApgexSeparator ( void *  vpCtx,
aint  uiLastIndex 
)

Only called by apgex.

apgex may parse repeatedly on different sub-strings until it finds a match or fails completely. This is a special separator that is used to distinguish the individual traces for each attempt.

Definition at line 225 of file trace.c.

◆ vTraceBegin()

void vTraceBegin ( void *  vpCtx)

Called by the parser to start the trace.

Called via the macro TRACE_BEGIN only trace is implemented.

Definition at line 237 of file trace.c.

◆ vTraceDown()

void vTraceDown ( void *  vpCtx,
const opcode *  spOp,
aint  uiOffset 
)

Called by the parser prior to downward traversal of a parse tree node.

Called via the macro TRACE_DOWN only trace is implemented.

Definition at line 266 of file trace.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.

◆ vTraceEnd()

void vTraceEnd ( void *  vpCtx)

Called by the parser to end the trace.

Called via the macro TRACE_END only trace is implemented.

Definition at line 251 of file trace.c.

◆ vTraceSetOutput()

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

Definition at line 172 of file trace.c.

◆ vTraceUp()

void vTraceUp ( void *  vpCtx,
const opcode *  spOp,
aint  uiState,
aint  uiOffset,
aint  uiPhraseLength 
)

Called by the parser following upward traversal of a parse tree node.

Called via the macro TRACE_UP only trace is implemented.

Definition at line 285 of file trace.c.

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