Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
|
Go to the documentation of this file.
30 #ifndef UTILS_UTILS_H_
31 #define UTILS_UTILS_H_
43 #include "../library/lib.h"
54 void vUtilFileWrite(
void* vpMem,
const char* cpFileName, uint8_t* ucpData,
aint uiLen);
56 void vUtilFileRead(
void* vpMem,
const char* cpFileName, uint8_t* ucpData,
aint* uipLen);
abool bUtilCompareFiles(const char *cpFileL, const char *cpFileR)
Compare two files, byte for byte.
const char * cpUtilPhraseToStr(void *vpMem, apg_phrase *spPhrase)
Convert an apg_phrase to a null-terminated ASCII string.
char * cpUtilPrintChar(char cChar, char *cpBuf)
Generates a string representation for a single character.
const char * cpUtilPhrase32ToStr(void *vpMem, u32_phrase *spPhrase)
Convert an u32_phrase to a null-terminated ASCII string.
A composite header for the utility objects.
Carries detailed information about the characters and line endings. One for each line in the input gr...
void vUtilApgInfo(void)
Display the current state of apg.h.
void vUtilSizes(void)
Display the APG type sizes, the compiler's C-language type sizes and a few max values.
uint_fast8_t achar
achar is the type for the parser's alphabet characters.
abool bUtilAstToXml(void *vpCtx, char *cpType, const char *cpFileName)
Convert the AST records to XML format.
uint32_t * uipUtilStrToUint32(void *vpMem, const char *cpStr, aint *uipLen)
Convert a null-terminated ASCII string to an array of 32-bit unsigned integers.
Available to the user for display of memory statistics.
const char * cpType(aint uiId)
Convert an attribute type ID to an ASCII string.
const char * cpUtilUtfTypeName(aint uiType)
Convert a conversion type identifier to a readable, printable ASCII string. Conversion type identifie...
void vUtilFileWrite(void *vpMem, const char *cpFileName, uint8_t *ucpData, aint uiLen)
Write from the caller's data area to the given file name.
void vUtilPrintParserState(parser_state *spState)
Display the parser state in human-readable format to stdout.
uint_fast32_t aint
The APG parser's unsigned integer type.
void vUtilPrintMemStats(const mem_stats *spStats)
Display the memory object's statistics.
The parser's final state.
A structure to describe the type and location of a caught exception.
Defines a pointer to an achar array plus its length. That is, a phrase as is often used by APG.
void vUtilCharsToAscii(FILE *spFile, const achar *acpChars, aint uiLength)
Convert a string of alphabet characters to printable ASCII.
void vUtilPrintMsgs(void *vpMsgs)
Display the list of messages in a message object to stdout.
void vUtilPrintLine(line *spLine)
Display one line from a line object.
abool bUtilCompareFileLines(void *vpMem, const char *cpFileL, const char *cpFileR)
Compare two text files, line by line, without regard for the line ending characters.
uintmax_t luint
luint is used to cast integers suitable for the %"PRIuMAX" printf format.
void vUtilPrintVecStats(const vec_stats *spStats)
Display the vector object's statistics.
void vUtilPrintException(exception *spEx)
Prints exception information from an exception structure.
Defines the characteristics of a single line.
void vUtilCurrentWorkingDirectory(void)
Display the current working directory.
achar * acpUtilStrToAchar(void *vpMem, const char *cpStr, aint *uipLen)
Convert a null-terminated ASCII string to an array of achar characters.
const char * cpUtilUint32ToStr(void *vpMem, const uint32_t *uipUint, aint uiLen)
Convert an array of 32-bit unsigned integers to a null-terminated ASCII string.
uint8_t abool
abool is the APG bool type.
void vUtilIndent(FILE *spFile, aint uiIndent)
Indent by adding the given number of spaces to the output file.
void vUtilPrintLineu(line_u *spLine)
Display one line from a line_u object.
char * cpUtilPrintUChar(uint32_t uiChar, char *cpBuf)
Generates a string representation for a single Unicode character.
const char * cpUtilOpName(aint uiId)
Convert an opcode identifier to a human-readable opcode name.
apg_phrase * spUtilStrToPhrase(void *vpMem, const char *cpStr)
Convert a null-terminated ASCII string to an apg_phrase.
Defines a pointer to an array of 32-bit unsigned integers plus its length. Typically needed by Unicod...
void vUtilFileRead(void *vpMem, const char *cpFileName, uint8_t *ucpData, aint *uipLen)
Read a file into the caller's data area.
void vUtilConvertLineEnds(exception *spEx, const char *cpString, const char *cpEnd, const char *cpFileName)
Convert all line ending characters.
const char * cpUtilAcharToStr(void *vpMem, achar *acpAchar, aint uiLen)
Convert an array of achar characters to a null-terminated ASCII string.
const char * cpUtilTrueFalse(luint luiTrue)
Return a human-readable string version of the given value in its true/false sense.
u32_phrase * spUtilStrToPhrase32(void *vpMem, const char *cpStr)
Convert a null-terminated ASCII string to a 32-bit phrase.
APG Version 7.0 is licensed under the
2-Clause BSD License,
an Open Source Initiative Approved License.