Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
linesu.h
Go to the documentation of this file.
1 /* *************************************************************************************
2  Copyright (c) 2021, Lowell D. Thomas
3  All rights reserved.
4 
5  This file is part of APG Version 7.0.
6  APG Version 7.0 may be used under the terms of the BSD 2-Clause License.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  1. Redistributions of source code must retain the above copyright notice, this
12  list of conditions and the following disclaimer.
13 
14  2. Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 * *************************************************************************************/
30 #ifndef LINESU_H_SAVE_
31 #define LINESU_H_SAVE_
32 
40 typedef struct {
45  uint32_t uiaLineEnd[3];
46 } line_u;
47 
48 void* vpLinesuCtor(exception* spEx, const uint32_t* uipInput, aint uiLength);
49 void vLinesuDtor(void* vpCtx);
50 line_u* spLinesuFirst(void* vpCtx);
51 line_u* spLinesuNext(void* vpCtx);
52 aint uiLinesuCount(void* vpCtx);
53 aint uiLinesuLength(void* vpCtx);
54 abool bLinesuFindLine(void* vpCtx, aint uiOffset, aint* uipLine, aint* uipRelOffset);
55 
56 #endif /* LINESU_H_SAVE_ */
line_u::uiLineIndex
aint uiLineIndex
zero-based line number
Definition: linesu.h:41
spLinesuNext
line_u * spLinesuNext(void *vpCtx)
Returns the next line from the iterator.
Definition: linesu.c:187
line_u
Carries detailed information about the characters and line endings. One for each line in the input gr...
Definition: linesu.h:40
uiLinesuCount
aint uiLinesuCount(void *vpCtx)
Returns the number of lines.
Definition: linesu.c:204
line_u::uiTextLength
aint uiTextLength
number of Unicode text characters in the line, excluding line end characters
Definition: linesu.h:44
aint
uint_fast32_t aint
The APG parser's unsigned integer type.
Definition: apg.h:79
exception
A structure to describe the type and location of a caught exception.
Definition: exception.h:47
vpLinesuCtor
void * vpLinesuCtor(exception *spEx, const uint32_t *uipInput, aint uiLength)
The linesu object constructor.
Definition: linesu.c:92
spLinesuFirst
line_u * spLinesuFirst(void *vpCtx)
Initialize an iterator over the lines.
Definition: linesu.c:173
bLinesuFindLine
abool bLinesuFindLine(void *vpCtx, aint uiOffset, aint *uipLine, aint *uipRelOffset)
Find the line that the given integer is in.
Definition: linesu.c:149
uiLinesuLength
aint uiLinesuLength(void *vpCtx)
Returns the number of integers in the 32-bit integer array.
Definition: linesu.c:220
abool
uint8_t abool
abool is the APG bool type.
Definition: apg.h:140
vLinesuDtor
void vLinesuDtor(void *vpCtx)
The linesu object destructor.
Definition: linesu.c:126
line_u::uiLineLength
aint uiLineLength
number of Unicode characters in the line, including line end characters
Definition: linesu.h:43
line_u::uiCharIndex
aint uiCharIndex
zero-based index of the first Unicode character of the line
Definition: linesu.h:42
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.