Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
|
Go to the documentation of this file.
40 #include "../library/lib.h"
42 static const void* s_vpMagicNumber = (
void*)
"msglog";
72 memset((
void*) spCtx, 0,
sizeof(
msgs));
74 spCtx->spException = spEx;
75 spCtx->vpVecMsgs =
vpVecCtor(vpMem,
sizeof(
char), 1024);
77 spCtx->vpValidate = s_vpMagicNumber;
96 void* vpMem = spCtx->
vpMem;
97 memset(vpCtx, 0,
sizeof(
msgs));
112 if (spCtx && (spCtx->
vpValidate == s_vpMagicNumber)) {
126 if (spCtx && (spCtx->
vpValidate == s_vpMagicNumber)) {
143 if (spCtx && (spCtx->
vpValidate == s_vpMagicNumber)) {
144 if(!cpMsg || !cpMsg[0]){
165 char *cpReturn = NULL;
167 if (spCtx && (spCtx->
vpValidate == s_vpMagicNumber)) {
186 char *cpReturn = NULL;
188 if (spCtx && (spCtx->
vpValidate == s_vpMagicNumber)) {
216 if (spCtx && (spCtx->
vpValidate == s_vpMagicNumber)) {
void vMsgsLog(void *vpCtx, const char *cpMsg)
Logs a message.
void vMemDtor(void *vpCtx)
Destroys a Memory component. Frees all memory allocated.
aint uiMsgCount
The number of logged messages.
void * vpMem
Pointer to a memory object context for all memory allocations.
aint uiMsgsCount(void *vpCtx)
Get the number of logged messages.
void vExContext()
Handles bad context pointers.
void * vpVecAt(void *vpCtx, aint uiIndex)
Get a the indexed vector element. The vector is not altered.
#define XTHROW(ctx, msg)
Exception throw macro.
uint_fast32_t aint
The APG parser's unsigned integer type.
aint uiNext
The next message in the message iterator.
void * vpMsgsCtor(exception *spEx)
The Message Log constructor.
void vMsgsClear(void *vpCtx)
Clears the object of all messages.
void * vpMemAlloc(void *vpCtx, aint uiBytes)
Allocates memory.
aint uiVecLen(void *vpCtx)
Get the vector length. That is, the number of elements on the vector.
void * vpVecCtor(void *vpMem, aint uiElementSize, aint uiInitialAlloc)
The vector object constructor.
A structure to describe the type and location of a caught exception.
void vMsgsDtor(void *vpCtx)
The object destructor.
const char * cpMsgsFirst(void *vpCtx)
Get a pointer to the first logged message, if any.
const char * cpMsgsNext(void *vpCtx)
Get a pointer to the next logged message, if any.
abool bExValidate(exception *spException)
Test an exception structure for validity.
void * vpVecMsgs
A vector to hold the logged messages.
void * vpVecFirst(void *vpCtx)
Get the first element one the vector. The vector is not altered.
void * vpVecPushn(void *vpCtx, void *vpElement, aint uiCount)
Adds one or more elements to the end of the array.
void * vpMemCtor(exception *spException)
Construct a memory component.
void * vpVecIndexes
A vector to hold the indexes of the logged messages in vpVecMsgs.
exception * spException
Pointer to an exception structure to report fatal errors back to the application's catch block.
uint8_t abool
abool is the APG bool type.
const void * vpValidate
A "magic" number to validate the context.
void * vpVecPush(void *vpCtx, void *vpElement)
Adds one element to the end of the array.
void vVecClear(void *vpCtx)
Clears all used elements in a vector component.
abool bMsgsValidate(void *vpCtx)
Validate a msglog context pointer.
APG Version 7.0 is licensed under the
2-Clause BSD License,
an Open Source Initiative Approved License.