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

A 32-bit integer version of the lines objects. More...

#include "../library/lib.h"
#include "./linesu.h"
Include dependency graph for linesu.c:

Go to the source code of this file.

Data Structures

struct  lines_u
 The lines object context. More...
 

Macros

Unicode Line Ending Characters

Macro definitions of the set of Unicode line ending characters. In addition to the below characters, the combined pair, CRLF, is also recognized as a line ending.

#define LF   0x0A
 Line Feed. More...
 
#define VT   0x0B
 Vertical Tab. More...
 
#define FF   0x0C
 Form Feed. More...
 
#define CR   0x0D
 Carriage Return. More...
 
#define NEL   0x85
 Next Line. More...
 
#define LS   0x2028
 Line Separator. More...
 
#define PS   0x2029
 Paragraph Separator. 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...
 
abool bLinesuFindLine (void *vpCtx, aint uiOffset, aint *uipLine, aint *uipRelOffset)
 Find the line that the given integer is in. 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...
 

Detailed Description

A 32-bit integer version of the lines objects.

This object works similarly to the `lines` object except that the data is 32-bit words rather that 8-bit ASCII characters. Line breaks are made on the Unicode line ending characters.

Other than the line breaks, the data is considered raw 32-bit data. It is given no other Unicode considerations.

Definition in file linesu.c.

Macro Definition Documentation

◆ CR

#define CR   0x0D

Carriage Return.

Definition at line 54 of file linesu.c.

◆ FF

#define FF   0x0C

Form Feed.

Definition at line 53 of file linesu.c.

◆ LF

#define LF   0x0A

Line Feed.

Definition at line 51 of file linesu.c.

◆ LS

#define LS   0x2028

Line Separator.

Definition at line 56 of file linesu.c.

◆ NEL

#define NEL   0x85

Next Line.

Definition at line 55 of file linesu.c.

◆ PS

#define PS   0x2029

Paragraph Separator.

Definition at line 57 of file linesu.c.

◆ VT

#define VT   0x0B

Vertical Tab.

Definition at line 52 of file linesu.c.

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.