Function return codes

Defines

#define CIF_OK   0
 A result code indicating successful completion of the requested operation.
#define CIF_FINISHED   1
 A result code indicating that the requested operation completed successfully, but subsequent repetitions of the same operation can be expected to fail.
#define CIF_ERROR   2
 A result code indicating that the requested operation failed because an error occurred in one of the underlying libraries.
#define CIF_MEMORY_ERROR   3
 A result code indicating that the requested operation could not be performed because of a dynamic memory allocation failure.
#define CIF_INVALID_HANDLE   4
 A result code returned on a best-effort basis to indicate that a user-provided object handle is invalid.
#define CIF_INTERNAL_ERROR   5
 A result code indicating that an internal error or inconsistency was encountered.
#define CIF_ARGUMENT_ERROR   6
 A result code indicating generally that one or more arguments to the function do not satisfy the function's requirements.
#define CIF_MISUSE   7
 A result code indicating that although the function was called with with substantially valid arguments, the context or conditions do not allow the call.
#define CIF_NOT_SUPPORTED   8
 A result code indicating that an optional feature was invoked and the library implementation in use does not support it.
#define CIF_ENVIRONMENT_ERROR   9
 A result code indicating that the operating environment is missing data or features required to complete the operation.
#define CIF_CLIENT_ERROR   10
 A result code indicating a synthetic error injected by client code via a callback function.
#define CIF_DUP_BLOCKCODE   11
 A result code signaling an attempt to cause a CIF to contain blocks with duplicate (by CIF's criteria) block codes.
#define CIF_INVALID_BLOCKCODE   12
 A result code signaling an attempt to cause a CIF to contain a block with an invalid block code.
#define CIF_NOSUCH_BLOCK   13
 A result code signaling an attempt to retrieve a data block from a CIF (by reference to its block code) when that CIF does not contain a block bearing that code.
#define CIF_DUP_FRAMECODE   21
 A result code signaling an attempt to cause a data block to contain save frames with duplicate (by CIF's criteria) frame codes.
#define CIF_INVALID_FRAMECODE   22
 A result code signaling an attempt to cause a data block to contain a save frame with an invalid frame code.
#define CIF_NOSUCH_FRAME   23
 A result code signaling an attempt to retrieve a save frame from a data block (by reference to its frame code) when that block does not contain a frame bearing that code.
#define CIF_CAT_NOT_UNIQUE   31
 A result code signaling an attempt to retrieve a loop from a save frame or data block by category, when there is more than one loop tagged with the specified category.
#define CIF_INVALID_CATEGORY   32
 A result code signaling an attempt to retrieve a loop from a save frame or data block by category, when the requested category is invalid.
#define CIF_NOSUCH_LOOP   33
 A result code signaling an attempt to retrieve a loop from a save frame or data block by category, when the container does not contain any loop tagged with the specified category.
#define CIF_RESERVED_LOOP   34
 A result code signaling an attempt to manipulate a loop having special significance to the library, in a manner that is not allowed.
#define CIF_WRONG_LOOP   35
 A result code indicating that an attempt was made to add an item value to a different loop than the one containing the item.
#define CIF_EMPTY_LOOP   36
 A result code indicating that a packet iterator was requested for a loop that contains no packets, or that a packet-less loop was encountered during parsing.
#define CIF_NULL_LOOP   37
 A result code indicating that an attempt was made to create a loop devoid of any data names.
#define CIF_DUP_ITEMNAME   41
 A result code indicating that an attempt was made to add an item to a data block or save frame that already contains an item of the same data name.
#define CIF_INVALID_ITEMNAME   42
 A result code indicating that an attempt was made to add an item with an invalid data name to a CIF.
#define CIF_NOSUCH_ITEM   43
 A result code indicating that an attempt to retrieve an item by name failed as a result of no item bearing that data name being present in the target container.
#define CIF_AMBIGUOUS_ITEM   44
 A result code indicating that an attempt to retrieve a presumed scalar has instead returned one of multiple values found.
#define CIF_INVALID_PACKET   52
 A result code indicating that the requested operation could not be performed because a packet object provided by the user was invalid.
#define CIF_PARTIAL_PACKET   53
 A result code indicating that during parsing, the last packet in a loop construct contained fewer values than the associated loop header had data names.
#define CIF_DISALLOWED_VALUE   62
 A result code indicating that an attempt was made to parse or write a value in a context that allows only values of kinds different from the given value's.
#define CIF_INVALID_NUMBER   72
 A result code indicating that a string provided by the user could not be parsed as a number.
#define CIF_INVALID_INDEX   73
 A result code indicating that a (Unicode) string provided by the user as a table index is not valid for that use.
#define CIF_INVALID_BARE_VALUE   74
 A result code indicating that a bare value encountered while parsing CIF starts with a character that is not allowed for that purpose.
#define CIF_INVALID_CHAR   102
 A result code indicating that an invalid code sequence has been detected during I/O: a source character representation is not a valid code sequence in the encoding with which it is being interpreted.
#define CIF_UNMAPPED_CHAR   103
 A result code indicating that I/O fidelity cannot be maintained on account of there being no representation for a source character in the target form.
#define CIF_DISALLOWED_CHAR   104
 A result code indicating that a well-formed code sequence encountered during I/O decodes to a character that is not allowed to appear in CIF.
#define CIF_MISSING_SPACE   105
 A result code indicating that required whitespace was missing during CIF parsing.
#define CIF_MISSING_ENDQUOTE   106
 A result code indicating that an in-line quoted string started on the current line but was not closed before the end of the line.
#define CIF_UNCLOSED_TEXT   107
 A result code indicating that a text field or triple-quoted string remained open when the end of the input was reached.
#define CIF_OVERLENGTH_LINE   108
 A result code indicating that input or output exceeded the relevant line-length limit.
#define CIF_DISALLOWED_INITIAL_CHAR   109
 A result code indicating that a well-formed code sequence encountered at the beginning of CIF I/O decodes to a character that is not allowed to appear as the initial character of a CIF.
#define CIF_WRONG_ENCODING   110
 A result code indicating that input is being parsed according to CIF-2 syntax, but being decoded according to a different encoding form than UTF-8.
#define CIF_NO_BLOCK_HEADER   113
 A result code indicating that during CIF parsing, something other than whitespace was encountered before the first block header.
#define CIF_FRAME_NOT_ALLOWED   122
 A result code indicating that during CIF parsing, a save frame header was encountered but save frame support was disabled.
#define CIF_NO_FRAME_TERM   123
 A result code indicating that during CIF parsing, a data block header or save frame header was encountered while a save frame was being parsed, thus indicating that a save frame terminator must have been omitted.
#define CIF_UNEXPECTED_TERM   124
 A result code indicating that during CIF parsing, a save frame terminator was encountered while no save frame was being parsed.
#define CIF_EOF_IN_FRAME   126
 A result code indicating that during CIF parsing, the end of input was encountered while parsing a save frame.
#define CIF_RESERVED_WORD   132
 A result code indicating that an unquoted reserved word was encountered during CIF parsing.
#define CIF_MISSING_VALUE   133
 A result code indicating that during CIF parsing, no data value was encountered where one was expected.
#define CIF_UNEXPECTED_VALUE   134
 A result code indicating that during CIF parsing, a data value was encountered where one was not expected.
#define CIF_UNEXPECTED_DELIM   135
 A result code indicating that during CIF parsing, a closing list or table delimiter was encountered outside the scope of any value.
#define CIF_MISSING_DELIM   136
 A result code indicating that during CIF parsing, a putative list or table value was encountered without a closing delimiter.
#define CIF_MISSING_KEY   137
 A result code indicating that during parsing of a table value, an entry with no key was encountered.
#define CIF_UNQUOTED_KEY   138
 A result code indicating that during parsing of a table value, an unquoted key was encountered.
#define CIF_MISQUOTED_KEY   139
 A result code indicating that during parsing of a table value, text block was encountered as a table key.
#define CIF_NULL_KEY   140
 A result code indicating that during parsing of a table value, colon-delimited key/value "pair" was encountered with no key at all (just colon, value).
#define CIF_TRAVERSE_CONTINUE   0
 A return code for CIF-handler functions (see cif_handler_tp) that indicates CIF traversal should continue along its normal path; has the same value as CIF_OK.
#define CIF_TRAVERSE_SKIP_CURRENT   -1
 A return code for CIF-handler functions (see cif_handler_tp) that indicates CIF traversal should bypass the current element, or at least any untraversed children, and thereafter proceed along the normal path.
#define CIF_TRAVERSE_SKIP_SIBLINGS   -2
 A return code for CIF-handler functions (see cif_handler_tp) that indicates CIF traversal should bypass the current element, or at least any untraversed children, and any untraversed siblings, and thereafter proceed along the normal path.
#define CIF_TRAVERSE_END   -3
 A return code for CIF-handler functions (see cif_handler_tp) that indicates CIF traversal should stop immediately.

Variables

const char cif_errlist [][80]
 A table of short descriptions of the errors indicated by the various CIF API error codes.
const int cif_nerr
 The number of entries in cif_errlist.

Define Documentation

#define CIF_ARGUMENT_ERROR   6

A result code indicating generally that one or more arguments to the function do not satisfy the function's requirements.

This is a fallback code -- a more specific code will be emitted when one is available.

#define CIF_DISALLOWED_CHAR   104

A result code indicating that a well-formed code sequence encountered during I/O decodes to a character that is not allowed to appear in CIF.

Recovery normally involves accepting the character.

#define CIF_DISALLOWED_INITIAL_CHAR   109

A result code indicating that a well-formed code sequence encountered at the beginning of CIF I/O decodes to a character that is not allowed to appear as the initial character of a CIF.

At the point where this error is encountered, it may not yet be known which version of CIF is being parsed. The normal recovery path is to leave the character alone, likely allowing it to trigger a different, more specific error later.

#define CIF_DISALLOWED_VALUE   62

A result code indicating that an attempt was made to parse or write a value in a context that allows only values of kinds different from the given value's.

The only context in CIF 2.0 that allows values of some kinds but not others is table indices. For this purpose, "allowed" is defined in terms of CIF syntax, ignoring any other considerations such as validity with respect to a data dictionary.

#define CIF_DUP_ITEMNAME   41

A result code indicating that an attempt was made to add an item to a data block or save frame that already contains an item of the same data name.

"Same" in this sense is judged with the use of Unicode normalization and case folding.

#define CIF_ENVIRONMENT_ERROR   9

A result code indicating that the operating environment is missing data or features required to complete the operation.

For example, the cif_create() function of an SQLite-based implementation that depends on foreign keys might emit this code if it determines that the external sqlite library against which it is running omits foreign key support.

#define CIF_EOF_IN_FRAME   126

A result code indicating that during CIF parsing, the end of input was encountered while parsing a save frame.

This can indicate that the input was truncated or that the frame terminator was omitted.

#define CIF_ERROR   2

A result code indicating that the requested operation failed because an error occurred in one of the underlying libraries.

This is the library's general-purpose error code for faults that it cannot more specifically diagnose. Pretty much any API function can return this code under some set of circumstances. Failed memory allocations or unexpected errors emitted by the storage back end are typical triggers for this code. In the event that this code is returned, the C library's global errno variable may indicate the nature of the error more specifically.

#define CIF_FINISHED   1

A result code indicating that the requested operation completed successfully, but subsequent repetitions of the same operation can be expected to fail.

This code is used mainly by packet iterators to signal the user when the last available packet is returned.

#define CIF_INTERNAL_ERROR   5

A result code indicating that an internal error or inconsistency was encountered.

If this code is emitted then it means a bug in the library has been triggered (if for no other reason than that this is the wrong code to return if an internal bug has not been triggered).

#define CIF_INVALID_BARE_VALUE   74

A result code indicating that a bare value encountered while parsing CIF starts with a character that is not allowed for that purpose.

This error is recognized where the start character does not cause the "value" to be interpreted as something else altogether, such as a data name or a comment. In CIF 2.0 parsing mode, only the dollar sign (as the first character of something that could be a value) will trigger this error; in CIF 1.1 mode, the opening and closing square brackets will also trigger it.

#define CIF_INVALID_CATEGORY   32

A result code signaling an attempt to retrieve a loop from a save frame or data block by category, when the requested category is invalid.

The main invalid category is NULL (as opposed to the empty category name), which is invalid only for retrieval, not loop creation.

#define CIF_INVALID_CHAR   102

A result code indicating that an invalid code sequence has been detected during I/O: a source character representation is not a valid code sequence in the encoding with which it is being interpreted.

This includes those code sequences ICU describes as "illegal" as well as those it describes as "irregular".

#define CIF_INVALID_HANDLE   4

A result code returned on a best-effort basis to indicate that a user-provided object handle is invalid.

The library does not guarantee to be able to recognize invalid handles. If an invalid handle is provided then a CIF_ERROR code may be returned instead, or really anything might happen -- generally speaking, library behavior is undefined in these cases.

Where it does detect invalidity, that result may be context dependent. That is, the handle may be invalid for the use for which it presented, but valid for different uses. In particular, this may be the case if a save frame handle is presented to one of the functions that requires specifically a data block handle.

#define CIF_INVALID_ITEMNAME   42

A result code indicating that an attempt was made to add an item with an invalid data name to a CIF.

Note that attempts to retrieve items by invalid name, on the other hand, simply return CIF_NOSUCH_ITEM

#define CIF_INVALID_NUMBER   72

A result code indicating that a string provided by the user could not be parsed as a number.

"Number" here should be interpreted in the CIF sense: an optionally-signed integer or floating-point number in decimal format, with optional signed exponent and optional standard uncertainty.

#define CIF_INVALID_PACKET   52

A result code indicating that the requested operation could not be performed because a packet object provided by the user was invalid.

For example, the packet might have been empty in a context where that is not allowed.

#define CIF_MEMORY_ERROR   3

A result code indicating that the requested operation could not be performed because of a dynamic memory allocation failure.

Few library clients will care about the distinction between this code and CIF_ERROR, but some future wrappers may do. For instance, a Python extension would be expected to distinguish memory allocation failures from other errors so as to signal them to the host Python environment.

#define CIF_MISQUOTED_KEY   139

A result code indicating that during parsing of a table value, text block was encountered as a table key.

The parser can handle that case just fine, but it is not allowed by the CIF 2.0 specifications.

#define CIF_MISSING_DELIM   136

A result code indicating that during CIF parsing, a putative list or table value was encountered without a closing delimiter.

Alternatively, it is also conceivable that the previously-parsed opening delimiter was meant to be part of a value, but was not so interpreted on account of the value being unquoted.

#define CIF_MISSING_KEY   137

A result code indicating that during parsing of a table value, an entry with no key was encountered.

Note that "no key" is different from "zero-length key" or "blank key"; the latter two are permitted.

#define CIF_MISSING_SPACE   105

A result code indicating that required whitespace was missing during CIF parsing.

Recovery generally involves assuming the missing whitespace, which is fine as long as the reason for the error is not some previous, unobserved error such as an omitted opening table delimiter.

#define CIF_MISUSE   7

A result code indicating that although the function was called with with substantially valid arguments, the context or conditions do not allow the call.

This code is returned, for example, if cif_pktitr_remove_packet() is passed a packet iterator that has not yet provided a packet that could be removed.

#define CIF_NOSUCH_LOOP   33

A result code signaling an attempt to retrieve a loop from a save frame or data block by category, when the container does not contain any loop tagged with the specified category.

This code is related to loop references by category. Contrast with CIF_NOSUCH_ITEM .

#define CIF_NOT_SUPPORTED   8

A result code indicating that an optional feature was invoked and the library implementation in use does not support it.

There are very few optional features defined at this point, so this code should rarely, if ever, be seen.

#define CIF_RESERVED_LOOP   34

A result code signaling an attempt to manipulate a loop having special significance to the library, in a manner that is not allowed.

The only reserved loops in this version of the library are those that hold items that do not / should not appear in explicit CIF loop_ constructs. There is at most one of these per data block or save frame, and they are identified by empty (not NULL) category tags. (C code can use the CIF_SCALARS macro for this category).

#define CIF_UNCLOSED_TEXT   107

A result code indicating that a text field or triple-quoted string remained open when the end of the input was reached.

If the closing delimiter of a text field or triple-quoted string is omitted then havoc ensues -- likely the entire remainder of the file is parsed incorrectly -- possibly all as a single (unterminated) multiline value.

#define CIF_UNEXPECTED_VALUE   134

A result code indicating that during CIF parsing, a data value was encountered where one was not expected.

Typically this means that either the associated tag was omitted or the value itself was duplicated

#define CIF_UNMAPPED_CHAR   103

A result code indicating that I/O fidelity cannot be maintained on account of there being no representation for a source character in the target form.

Recovery normally involves mapping the source character to a substitution character.

#define CIF_UNQUOTED_KEY   138

A result code indicating that during parsing of a table value, an unquoted key was encountered.

The parser distinguishes this case from the "missing key" case by the presence of a colon in the bare string.

 All Data Structures Variables

Copyright 2014, 2015 John C. Bollinger