APG
… an ABNF Parser Generator
|
The API input functions. These functions assist with retrieving the ABNF grammar or grammars for processing. More...
Go to the source code of this file.
Macros | |
#define | CR 13 |
#define | LF 10 |
#define | TAB 9 |
#define | BUF_SIZE 128 |
Functions | |
void | vApiInClear (void *vpCtx) |
Clears the input and related memory. More... | |
const char * | cpApiInFile (void *vpCtx, const char *cpFileName) |
Reads an SABNF grammar byte stream from a file. More... | |
const char * | cpApiInString (void *vpCtx, const char *cpString) |
Reads an SABNF grammar byte stream from a string. More... | |
void | vApiInValidate (void *vpCtx, abool bStrict) |
Scans the input SABNF grammar for invalid characters and line ends. More... | |
void | vApiInToAscii (void *vpCtx, const char *cpFileName) |
Display the input lines with line numbers and character offsets. More... | |
void | vApiInToHtml (void *vpCtx, const char *cpFileName, const char *cpTitle) |
Display the input lines with line numbers and character offsets. More... | |
void | vLineError (api *spCtx, aint uiCharIndex, const char *cpSrc, const char *cpMsg) |
Finds the grammar line associated with a character index and formats an error message to the error log. More... | |
The API input functions. These functions assist with retrieving the ABNF grammar or grammars for processing.
Definition in file input.c.
const char* cpApiInFile | ( | void * | vpCtx, |
const char * | cpFileName | ||
) |
Reads an SABNF grammar byte stream from a file.
May be called multiple times. Successive calls will append data to the previous grammar result. May be mixed with calls to cpApiInString().
[in] | vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
[in] | cpFileName | - Name of the file to read. |
const char* cpApiInString | ( | void * | vpCtx, |
const char * | cpString | ||
) |
Reads an SABNF grammar byte stream from a string.
May be called multiple times. Successive calls will append data to the previous SABNF grammar result. May be mixed with calls to cpApiInFile().
[in] | vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
[in] | cpString | - Pointer to the string to read. |
void vApiInClear | ( | void * | vpCtx | ) |
Clears the input and related memory.
The user must call this to clear any previous input grammar before reusing the API object for another job.
[in] | vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
void vApiInToAscii | ( | void * | vpCtx, |
const char * | cpFileName | ||
) |
Display the input lines with line numbers and character offsets.
Writes the input grammar in ASCII format to a file.
[in] | vpCtx | - pointer to an API context previously returned from vpApiCtor(). |
[in] | cpFileName | - Name of the file to write the result to. If NULL, stdout is used. |
void vApiInToHtml | ( | void * | vpCtx, |
const char * | cpFileName, | ||
const char * | cpTitle | ||
) |
Display the input lines with line numbers and character offsets.
Writes the input grammar as an HTML page to a file.
[in] | vpCtx | - pointer to an API context previously returned from vpApiCtor(). |
[in] | cpFileName | - name of the file to write the result to. |
[in] | cpTitle | - HTML title. If NULL, a default page title is used. |
void vApiInValidate | ( | void * | vpCtx, |
abool | bStrict | ||
) |
Scans the input SABNF grammar for invalid characters and line ends.
Constructs a lines
object for dealing with finding and handling lines.
[in] | vpCtx | - Pointer to an API context previously returned from vpApiCtor(). |
[in] | bStrict | - If true, validate as strict ABNF. If APG_TRUE, validate as strict ABNF (RFC5234 & RFC7405). Otherwise, validate as SABNF. |
Finds the grammar line associated with a character index and formats an error message to the error log.
[in] | spCtx | - pointer to an API context previously returned from vpApiCtor(). |
uiCharIndex | The index of the character whose line number is desired. | |
cpSrc | An string idendifying the caller. | |
cpMsg | The error message. |