Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
format.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 * *************************************************************************************/
34 #ifndef FMT_H_
35 #define FMT_H_
36 
39 
42 #define FMT_HEX 0
43 
45 #define FMT_HEX2 1
46 
51 #define FMT_ASCII 2
52 
55 #define FMT_CANONICAL 3
56 
59 #define FMT_UNICODE 4
60 
62 void* vpFmtCtor(exception* spEx);
63 void vFmtDtor(void* vpCtx);
64 abool bFmtValidate(void* vpCtx);
65 void vFmtIndent(void* vpCtx, int iIndent);
66 const char* cpFmtFirstBytes(void* vpCtx, const uint8_t* ucpChars, uint64_t uiLength, int iStyle, uint64_t uiOffset, uint64_t uiLimit);
67 const char* cpFmtFirstFile(void* vpCtx, const char* cpFileName, int iStyle, uint64_t uiOffset, uint64_t uiLimit);
68 const char* cpFmtFirstUnicode(void* vpCtx, const uint32_t* uipChars, uint64_t uiLength, uint64_t uiOffset, uint64_t uiLimit);
69 const char* cpFmtNext(void* vpCtx);
70 
71 #endif /* FMT_H_ */
cpFmtFirstUnicode
const char * cpFmtFirstUnicode(void *vpCtx, const uint32_t *uipChars, uint64_t uiLength, uint64_t uiOffset, uint64_t uiLimit)
Initiate the iterator over an array of 32-bit Unicode code points.
Definition: format.c:341
cpFmtFirstBytes
const char * cpFmtFirstBytes(void *vpCtx, const uint8_t *ucpChars, uint64_t uiLength, int iStyle, uint64_t uiOffset, uint64_t uiLimit)
Initiate the iterator over an array of 8-bit byte data.
Definition: format.c:210
cpFmtNext
const char * cpFmtNext(void *vpCtx)
Formats the next line of data.
Definition: format.c:386
fmt_tag::iStyle
int iStyle
The display style identifier. One of these..
Definition: format.c:89
vFmtIndent
void vFmtIndent(void *vpCtx, int iIndent)
Set the an indentation for the display.
Definition: format.c:181
bFmtValidate
abool bFmtValidate(void *vpCtx)
Validate a format context pointer.
Definition: format.c:167
exception
A structure to describe the type and location of a caught exception.
Definition: exception.h:47
vpFmtCtor
void * vpFmtCtor(exception *spEx)
The object constructor.
Definition: format.c:118
vFmtDtor
void vFmtDtor(void *vpCtx)
The object destructor.
Definition: format.c:146
abool
uint8_t abool
abool is the APG bool type.
Definition: apg.h:140
fmt_tag::iIndent
int iIndent
The number of spaces to indent before displaying data.
Definition: format.c:90
cpFmtFirstFile
const char * cpFmtFirstFile(void *vpCtx, const char *cpFileName, int iStyle, uint64_t uiOffset, uint64_t uiLimit)
Initiate the iterator over file of 8-bit byte data.
Definition: format.c:271
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.