Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
Data Structures | Macros | Functions
output.c File Reference

Constructs the source and header files for the generated parser. More...

#include "../api/api.h"
#include "../api/apip.h"
#include "../api/attributes.h"
#include "../library/parserp.h"
Include dependency graph for output.c:

Go to the source code of this file.

Data Structures

struct  init_hdr_out
 Header for the parser initialization data. More...
 

Macros

#define OUTPUT_LINE_LENGTH   30
 Controls the number of integers per line in the output source file. More...
 
#define LUINT_MAX(x, y)   if(((x) < (y)) && ((y) != (luint)-1))x = (y)
 Replace x with y only if y > x. More...
 

Functions

void vApiOutput (void *vpCtx, const char *cpOutput)
 Generate a source and header file that can be used to construct a parser for the specified SABNF grammar. More...
 
void * vpApiOutputParser (void *vpCtx)
 Generate a parser object directly from the specified SABNF grammar. More...
 

Detailed Description

Constructs the source and header files for the generated parser.

Definition in file output.c.

Macro Definition Documentation

◆ LUINT_MAX

#define LUINT_MAX (   x,
 
)    if(((x) < (y)) && ((y) != (luint)-1))x = (y)

Replace x with y only if y > x.

Definition at line 83 of file output.c.

◆ OUTPUT_LINE_LENGTH

#define OUTPUT_LINE_LENGTH   30

Controls the number of integers per line in the output source file.

Definition at line 78 of file output.c.

Function Documentation

◆ vApiOutput()

void vApiOutput ( void *  vpCtx,
const char *  cpOutput 
)

Generate a source and header file that can be used to construct a parser for the specified SABNF grammar.

Parameters
vpCtx- Pointer to an API context previously returned from vpApiCtor().
cpOutputThe root of the file name to use for the generated source and header files. Any extension will be stripped and replaces with .h for the header file and .c for the source file. The name may be relative or absolute. Any directories in the pathname must exist.
Returns
Throws exceptions on errors.

Definition at line 152 of file output.c.

◆ vpApiOutputParser()

void* vpApiOutputParser ( void *  vpCtx)

Generate a parser object directly from the specified SABNF grammar.

The generated parser has its own memory object and is independent of the parent API object other than sharing the same exception object. That is, throw exceptions will land in the API catch block. But the API and the generated parser must each call their respective destructors to prevent memory leaks.

Parameters
vpCtx- Pointer to an API context previously returned from vpApiCtor().
Returns
Throws exceptions on errors.

Definition at line 217 of file output.c.

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