Data Structures | |
struct | cif_handler_s |
A set of functions defining a handler interface for directing and taking appropriate action in response to a traversal of a CIF. More... | |
struct | cif_parse_opts_s |
Represents a collection of CIF parsing options. More... | |
struct | cif_write_opts_s |
Represents a collection of CIF writing options. More... | |
struct | cif_string_analysis_s |
Represents the results of analyzing a string for characteristics directing its form when presented as a CIF data value. More... | |
Typedefs | |
typedef struct cif_s | cif_tp |
An opaque handle on a managed CIF. | |
typedef struct cif_container_s | cif_container_tp |
An opaque handle on a managed CIF data block or save frame. | |
typedef struct cif_container_s | cif_block_tp |
Equivalent to and interchangeable with cif_container_tp , but helpful for bookkeeping to track those containers that are supposed to be data blocks. | |
typedef struct cif_container_s | cif_frame_tp |
Equivalent to and interchangeable with cif_container_tp , but helpful for bookkeeping to track those containers that are supposed to be save frames. | |
typedef struct cif_loop_s | cif_loop_tp |
An opaque handle on a managed CIF loop. | |
typedef struct cif_packet_s | cif_packet_tp |
An opaque data structure representing a CIF loop packet. | |
typedef struct cif_pktitr_s | cif_pktitr_tp |
An opaque data structure encapsulating the state of an iteration through the packets of a loop in a managed CIF. | |
typedef union cif_value_u | cif_value_tp |
The type of all data value objects. | |
typedef enum cif_kind | cif_kind_tp |
The type used for codes representing the dynamic kind of the data in a cif_value_tp object. | |
typedef enum cif_quoted | cif_quoted_tp |
The type used for representing values' quoting status, to allow applications to distinguish between the same value when presented quoted and when presented unquoted. | |
typedef struct cif_handler_s | cif_handler_tp |
A set of functions defining a handler interface for directing and taking appropriate action in response to a traversal of a CIF. | |
typedef int(* | cif_parse_error_callback_tp )(int code, size_t line, size_t column, const UChar *text, size_t length, void *data) |
A pointer to a callback function to be invoked when a parse error occurs. | |
typedef void(* | cif_syntax_callback_tp )(size_t line, size_t column, const UChar *token, size_t length, void *data) |
A pointer to a callback function by which a client application can be notified of a syntactic element. | |
Enumerations | |
enum | cif_kind { CIF_CHAR_KIND = 0, CIF_NUMB_KIND = 1, CIF_LIST_KIND = 2, CIF_TABLE_KIND = 3, CIF_NA_KIND = 4, CIF_UNK_KIND = 5 } |
The type used for codes representing the dynamic kind of the data in a | |
enum | cif_quoted { CIF_NOT_QUOTED = 0, CIF_QUOTED = 1 } |
The type used for representing values' quoting status, to allow applications to distinguish between the same value when presented quoted and when presented unquoted. More... |
typedef struct cif_container_s cif_container_tp |
An opaque handle on a managed CIF data block or save frame.
From a structural perspective, save frames and data blocks are distinguished only by nesting level: data blocks are (the only meaningful) top-level components of whole CIFs, whereas save frames are nested inside data blocks. They are otherwise exactly the same with respect to contents and allowed operations, and cif_container_tp
models that commonality.
typedef struct cif_handler_s cif_handler_tp |
A set of functions defining a handler interface for directing and taking appropriate action in response to a traversal of a CIF.
Each structural element of the CIF being traversed will be presented to the appropriate handler function, along with the appropriate context object, if any. When traversal is performed via the cif_walk()
function, the context object is the one passed to cif_walk()
by its caller. The handler may perform any action it considers suitable, and it is expected to return a code influencing the traversal path, one of:
CIF_TRAVERSE_CONTINUE
for the walker to continue on its default path (for instance, to descend to the current element's first child), or CIF_TRAVERSE_SKIP_CURRENT
for the walker to skip traversal of the current element's children, if any, and the current element itself if possible (meaningfully distinct from CIF_TRAVERSE_CONTINUE
only for the *_start
callbacks), or CIF_TRAVERSE_SKIP_SIBLINGS
for the walker to skip the current element if possible, its children, and all its siblings that have not yet been traversed, or CIF_TRAVERSE_END
for the walker to stop without traversing any more elementsA handler function may, alternatively, return a CIF API error code, which has the effect of CIF_TRAVERSE_END plus additional semantics specific to the traversal function (cif_walk()
forwards the code to its caller as its return value).
typedef struct cif_packet_s cif_packet_tp |
An opaque data structure representing a CIF loop packet.
This is not a "handle" in the sense of some of the other opaque data types, as instances have no direct connection to a managed CIF.
typedef int(* cif_parse_error_callback_tp)(int code, size_t line, size_t column, const UChar *text, size_t length, void *data) |
A pointer to a callback function to be invoked when a parse error occurs.
Note that this function receives the location where the error was detected , which is not necessarily the location of the actual error.
[in] | code | a parse error code indicating the nature of the error |
[in] | line | the one-based line number at which the error was detected |
[in] | column | the one-based column number at which the error was detected |
[in] | text | if not NULL , a Unicode string -- not necessarily NUL terminated -- containing the specific CIF text being parsed where the error was detected |
[in] | length | the number of UChar code units starting at the one text points to that may be relevant to the reported error. Accessing text [length] or beyond produces undefined behavior. |
[in,out] | data | a pointer to the user data object provided by the parser caller |
typedef void(* cif_syntax_callback_tp)(size_t line, size_t column, const UChar *token, size_t length, void *data) |
A pointer to a callback function by which a client application can be notified of a syntactic element.
Callbacks of this type are provided for some syntax elements that are not otherwise directly signaled, such as whitespace runs, certain keywords, and data names. These support a physical / lexical view of a parse process, as opposed to the logical / structural view provided by the callbacks belonging to a cif_handler_tp
. Unlike those or an error callback, syntax callbacks cannot directly influence CIF traversal or interrupt parsing, but they have access to the same user data object that all other callbacks receive.
The pointer token
and all subsequent values through token
+
length
are guaranteed to be valid pointer values for comparison and arithmetic. The result of dereferencing token
+
length
is not defined. The caller does not guarantee that the data pointed to by token
or the token
pointer itself will remain valid or stable after this function returns. If this function wants to provide longer-duration access then it must make a copy.
[in] | line | the one-based line number of the start of the syntax element |
[in] | column | the one-based column number of the first character of the syntax element |
[in] | token | a pointer to the start of the character sequence of the element, which is not necessarily NUL-terminated |
[in] | length | the number of characters in the sequence. ( token + length ) is guaranteed to be a valid pointer value for comparison and arithmetic, but the result of dereferencing it is undefined; whether incrementing it results in a valid pointer value is undefined. Under some circumstances, length may be zero. |
[in,out] | data | a pointer to the user data object provided by the parser caller |
enum cif_kind |
The type used for codes representing the dynamic kind of the data in a cif_value_tp
object.
enum cif_quoted |
The type used for representing values' quoting status, to allow applications to distinguish between the same value when presented quoted and when presented unquoted.
Copyright 2014, 2015 John C. Bollinger