Version 6.3
Copyright © 2005 - 2012 Lowell D. Thomas
APG
… ABNF Parser Generator
|
Go to the documentation of this file.
150 #if defined(__cplusplus)
160 #if defined _APG_CFG_UINT && _APG_CFG_UINT == 1
162 #elif defined _APG_CFG_UINT && _APG_CFG_UINT == 2
163 typedef unsigned short int apg_uint;
164 #elif defined _APG_CFG_UINT && _APG_CFG_UINT == 4
166 #elif defined _APG_CFG_UINT && _APG_CFG_UINT == 8
174 #if defined _APG_CFG_ACHAR && _APG_CFG_ACHAR == 1
176 #elif defined _APG_CFG_ACHAR && _APG_CFG_ACHAR == 2
178 #elif defined _APG_CFG_ACHAR && _APG_CFG_ACHAR == 4
180 #elif defined _APG_CFG_ACHAR && _APG_CFG_ACHAR == 8
187 #define APG_TRUE 1 // apg_uint true value
190 #define APG_FALSE 0 // apg_uint false value
194 #define APG_UNDEFINED -1 // often used to represent an undefined integer
199 #define APG_INFINITE -1 // often used to represent an infinite integer
228 #if defined(_APG_CFG_DEBUG)
230 #undef _APG_CFG_TRACE
231 #define _APG_CFG_TRACE
233 #undef _APG_CFG_STATS
234 #define _APG_CFG_STATS
237 #if defined(_APG_CFG_TRACE)
239 #define APG_TRACE_ADMIN(ctx, a, i, e, c) vTraceAdmin((ctx), (a), (i), (e), (c));
240 #define APG_TRACE(ctx, op, a, i, off, pl) if((ctx)->vpTraceCtx){vTrace((ctx), (op), (a), (i), (off), (pl));}
242 #define APG_TRACE_ADMIN(ctx, a, i, e, c)
243 #define APG_TRACE(ctx, op, a, i, off, pl)
246 #if defined(_APG_CFG_STATS)
247 #define APG_STATS_ADMIN(ctx, a, s, r, cfg) vStatsAdmin((ctx), (a), (s), (r), (cfg))
248 #define APG_STATS(ctx, a, s, o, r) vStats((ctx), (a), (s), (o), (r))
250 #define APG_STATS_ADMIN(ctx, a, s, r, cfg)
251 #define APG_STATS(ctx, a, s, o, r)
256 #undef APG_VEC_ELEMENT
261 #define APG_VEC_ELEMENT ((apg_uint)1) // default vector element size (bytes)
265 #define APG_VEC_ALLOC ((apg_uint)100) // default initial number of vector elements allocated
267 #define APG_DISPLAY_MAX_LINE 128
276 typedef void (*
PFN_ALERT)(
unsigned int uiLine,
const char* cpFile);
282 typedef void (*
PFN_ALERT_MSG)(
unsigned int uiLine,
const char* cpFile,
const char* cpMsg);
296 #define min(a,b) (((a) < (b)) ? (a) : (b))
298 #define max(a,b) (((a) > (b)) ? (a) : (b))
310 int apg_stricmp(
const char* cpLhs,
const char* cpRhs);
342 char* cpApgVersion();
344 char* cpApgDescription();
345 char* cpApgCopyright();
347 char* cpApgWebsite();
348 char* cpApgGPLNotice();
371 typedef void* (*PFN_ALLOCATOR)(size_t);
380 void vMemFree(
void* vpCtx,
void* vpData);
392 void*
vpVecPush(
void* vpVec,
void* vpElement);
526 #define PRE_PARSE ((apg_uint)0) // pre-branch state
532 #define NOMATCH ((apg_uint)1) // post-branch, string was not matched by grammar syntax
538 #define EMPTY ((apg_uint)2) // post-branch, syntax was matched by an empty string
544 #define MATCH ((apg_uint)3) // post-branch, syntax was matched with a string of one or more characters
550 #define PRE_AST ((apg_uint)4) // post-branch state (semantic analysis only)
556 #define POST_AST ((apg_uint)5) // post-branch state (semantic analysis only)
641 #define APG_TRACE_ALL 1
643 #define APG_TRACE_TRG 2
645 #define APG_TRACE_TBS 3
647 #define APG_TRACE_TLS 4
649 #define APG_TRACE_AND 5
651 #define APG_TRACE_NOT 6
653 #define APG_TRACE_CAT 7
655 #define APG_TRACE_ALT 8
657 #define APG_TRACE_REP 9
659 #define APG_TRACE_RNM 10
661 #define APG_TRACE_UDT 11
665 #define APG_TRACE_COUNT 12
686 #if defined(__cplusplus)
generated by the Memory component, available to the user for display of memory statistics
apg_uint uiUdtLib_u_doublequotedstring(APG_CBDATA *spData)
apg_uint uiParserAstTranslate(void *vpCtx, APG_CALLBACK *pfnRuleCallbacks, APG_CALLBACK *pfnUdtCallbacks, void *vpData)
void * vpVecFront(void *vpCtx)
void vParserAstInitCallbacks(void *vpCtx, APG_CALLBACK *spRuleCallbacks, APG_CALLBACK *spUdtCallbacks)
void *(* PFN_ALLOCATOR)(size_t)
full set of statistics gathered during parsing, uiParserSyntaxAnalysis()
void * vpVecPopn(void *vpCtx, apg_uint uiCount)
void vMemDtor(void *vpCtx)
apg_uint uiParserStatsEnable(void *vpCtx, apg_uint uiEnable)
the state of the parser after parsing an input string.
void vVecClear(void *vpCtx)
void * vpVecPopTo(void *vpCtx, apg_uint uiIndex)
void * vpVecBack(void *vpCtx)
void * vpMemRealloc(void *vpCtx, void *vpData, apg_uint uiBytes)
apg_uint uiVecSize(void *vpCtx)
void vDefaultAlertHandler(unsigned int uiLine, const char *cpFile)
void vParserDtor(void *vpCtx)
apg_uint uiVecBytes(void *vpCtx)
void * vpVecCtor(void *vpMemCtx, apg_uint uiElementSize, apg_uint uiInitialAlloc)
void vVecDtor(void *vpCtx)
apg_uint(* APG_CALLBACK)(APG_CBDATA *spData)
APG_NAME_STAT * spNameStats
void * vpVecPop(void *vpCtx)
void vExecuteUdt(APG_CBDATA *spData, apg_uint uiId, apg_uint uiOffset)
apg_uint uiUdtLib_u_alphanum_hyphen(APG_CBDATA *spData)
apg_uint uiUdtLib_u_lineend(APG_CBDATA *spData)
apg_uint uiUdtLib_u_semi_comment(APG_CBDATA *spData)
void(* PFN_DEALLOCATOR)(void *)
void(* PFN_ALERT)(unsigned int uiLine, const char *cpFile)
void vMemFree(void *vpCtx, void *vpData)
void * vpMemAlloc(void *vpCtx, apg_uint uiBytes)
APG_NAME_STAT * spNameStatsAlpha
apg_uint uiUdtLib_u_cpp_comment(APG_CBDATA *spData)
the parsers total node hit statistics
apg_uint uiVecElementSize(void *vpCtx)
void * vpVecAt(void *vpCtx, apg_uint uiIndex)
apg_uint uiParserSyntaxInitCallbacks(void *vpCtx, APG_CALLBACK *spRuleCallbacks, APG_CALLBACK *spUdtCallbacks)
apg_uint uiUdtLib_e_any(APG_CBDATA *spData)
apg_uint uiUdtLib_e_owsp(APG_CBDATA *spData)
void * vpVecPush(void *vpVec, void *vpElement)
apg_uint uiUdtLib_u_c_comment(APG_CBDATA *spData)
apg_uint uiACharToStringSize(const apg_achar *acpAChars, apg_uint uiALen)
void vExecuteRule(APG_CBDATA *spData, apg_uint uiId, apg_uint uiOffset)
void vParserTraceOp(void *vpCtx, apg_uint uiOpId, apg_uint uiEnable)
apg_uint uiUdtLib_u_hexnum(APG_CBDATA *spData)
void vParserAstInitNodes(void *vpCtx, apg_uint *uipRules, apg_uint *uipUdts)
void vMemClear(void *vpCtx)
apg_uint uiParserState(void *vpCtx, APG_PARSER_STATE *spState)
void vParserTraceRange(void *vpCtx, apg_uint uiBegin, apg_uint uiCount)
APG_NAME_STAT * spNameStatsCount
apg_uint uiVecReallocations(void *vpCtx)
void vParserTraceRule(void *vpCtx, apg_uint uiIndex, apg_uint uiEnable)
The data structure passed to all syntax and AST callback functions, both rule and UDT.
void * vpParserCtor(void *vpParserInit, PFN_ALERT pfnAlertHandler)
apg_uint uiACharToString(char *cpChars, apg_uint uiCLen, const apg_achar *acpAChars, apg_uint uiALen)
apg_uint uiUdtLib_u_quotedstring(APG_CBDATA *spData)
void vParserTraceUdt(void *vpCtx, apg_uint uiIndex, apg_uint uiEnable)
void(* PFN_ALERT_MSG)(unsigned int uiLine, const char *cpFile, const char *cpMsg)
void vMemFreeToCheckPoint(void *vpCtx, apg_uint uiChk)
apg_uint uiUdtLib_u_decnum(APG_CBDATA *spData)
apg_uint uiUdtLib_u_singlequotedstring(APG_CBDATA *spData)
apg_uint uiUdtLib_u_wsp(APG_CBDATA *spData)
void * vpVecPushn(void *vpCtx, void *vpElement, apg_uint uiCount)
apg_uint uiParserTraceEnable(void *vpCtx, apg_uint uiEnable)
named rule or UDT node statistics
void vCharToAChar(apg_achar *acpAChars, const char *cpChars, apg_uint uiLen)
int apg_stricmp(const char *cpLhs, const char *cpRhs)
apg_uint uiUdtLib_u_alphanum(APG_CBDATA *spData)
apg_uint uiMemCheckPoint(void *vpCtx)
apg_uint uiParserSyntaxAnalysis(void *vpCtx, apg_uint uiStartRule, const apg_achar *acpSrc, apg_uint uiSrcLen, void *vpData)
apg_uint uiVecValidate(void *vpCtx)
apg_uint uiUdtLib_u_alphanum_under(APG_CBDATA *spData)
void * vpMemCtorA(PFN_ALLOCATOR pfnAllocator, PFN_DEALLOCATOR pfnDeAllocator)
apg_uint uiMemValidate(void *vpCtx)
apg_uint uiParserStatsGet(void *vpCtx, APG_PARSER_STATS *spStats, apg_uint *uipBufferSize)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
http://www.gnu.org/licenses/licenses.html
or write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.