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

Header file for the 32-bit integer version of the lines objects. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  line_u
 Carries detailed information about the characters and line endings. One for each line in the input grammar file. More...
 

Functions

void * vpLinesuCtor (exception *spEx, const uint32_t *uipInput, aint uiLength)
 The linesu object constructor. More...
 
void vLinesuDtor (void *vpCtx)
 The linesu object destructor. More...
 
line_uspLinesuFirst (void *vpCtx)
 Initialize an iterator over the lines. More...
 
line_uspLinesuNext (void *vpCtx)
 Returns the next line from the iterator. More...
 
aint uiLinesuCount (void *vpCtx)
 Returns the number of lines. More...
 
aint uiLinesuLength (void *vpCtx)
 Returns the number of integers in the 32-bit integer array. More...
 
abool bLinesuFindLine (void *vpCtx, aint uiOffset, aint *uipLine, aint *uipRelOffset)
 Find the line that the given integer is in. More...
 

Detailed Description

Header file for the 32-bit integer version of the lines objects.

Definition in file linesu.h.

Function Documentation

◆ bLinesuFindLine()

abool bLinesuFindLine ( void *  vpCtx,
aint  uiOffset,
aint uipLine,
aint uipRelOffset 
)

Find the line that the given integer is in.

Parameters
vpCtxPointer to a valid linesu context, previously returned from vpLinesuCtor() If not valid the application will silently exit with a BAD_CONTEXT exit code.
uiOffsetThe zero-based offset of the integer to find.
uipLinePointer to an integer, set to the found line number on return.
uipRelOffsetPointer to an integer, set to the relative offset of the integer in the found line.
Returns
True if the line is found, false if the line could not be found (i.e. uiOffset is beyond the last integer of data)

Definition at line 149 of file linesu.c.

◆ spLinesuFirst()

line_u* spLinesuFirst ( void *  vpCtx)

Initialize an iterator over the lines.

Sets up the iterator and returns the first line.

Parameters
vpCtxPointer to a valid linesu context, previously returned from vpLinesuCtor() If not valid the application will silently exit with a BAD_CONTEXT exit code.
Returns
Pointer to the first line.

Definition at line 173 of file linesu.c.

◆ spLinesuNext()

line_u* spLinesuNext ( void *  vpCtx)

Returns the next line from the iterator.

Parameters
vpCtxPointer to a valid linesu context, previously returned from vpLinesuCtor() If not valid the application will silently exit with a BAD_CONTEXT exit code.
Returns
Pointer to the next line. NULL if no further lines are available.

Definition at line 187 of file linesu.c.

◆ uiLinesuCount()

aint uiLinesuCount ( void *  vpCtx)

Returns the number of lines.

Parameters
vpCtxPointer to a valid linesu context, previously returned from vpLinesuCtor() If not valid the application will silently exit with a BAD_CONTEXT exit code.
Returns
The number of lines.

Definition at line 204 of file linesu.c.

◆ uiLinesuLength()

aint uiLinesuLength ( void *  vpCtx)

Returns the number of integers in the 32-bit integer array.

Count includes the line ending integers.

Parameters
vpCtxPointer to a valid linesu context, previously returned from vpLinesuCtor() If not valid the application will silently exit with a BAD_CONTEXT exit code.
Returns
The number of array integers.

Definition at line 220 of file linesu.c.

◆ vLinesuDtor()

void vLinesuDtor ( void *  vpCtx)

The linesu object destructor.

Releases all allocated memory and clears the context to prevent accidental reuse.

Parameters
vpCtxA pointer to a valid lines context previously return from vpLinesuCtor(). Silently ignored if NULL. However, if non-NULL it must be a valid lines context pointer. The application will silently exit with BAD_CONTEXT exit code if vpCtx is invalid.

Definition at line 126 of file linesu.c.

◆ vpLinesuCtor()

void* vpLinesuCtor ( exception spEx,
const uint32_t *  uipInput,
aint  uiLength 
)

The linesu object constructor.

Reads the 32-bint integer input and separates it into individual lines, generating a list of line_u structures, one for each line.

Parameters
spExPointer to a valid exception structure initialized with XCTOR(). If not valid the application will silently exit with a BAD_CONTEXT exit code.
uipInputPointer to the array of integers
uiLength- the number of integers in the array
Returns
Pointer to the object context. Exception thrown on memory allocation failure.

Definition at line 92 of file linesu.c.

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