Woolz Image Processing
Version 1.8.3
|
Convenience procedures for reading and writing "bibtex" style text files for record-formatted data. libbibfile for more detail. More...
Files | |
file | bibFile.h |
Types and constants for the bibtex based file syntax used for serial section data, .... | |
file | bibFileAlloc.c |
Functions for allocation and freeing of the bibtex based record and field data structures. | |
file | bibFileIO.c |
File I/O functions to parse the bibtex based file syntax used for serial section data, .... | |
file | bibFileParse.c |
Functions to parse the bibtex based file syntax. | |
Functions | |
void | BibFileRecordFree (BibFileRecord **record) |
Free's the given record and sets it to NULL. More... | |
void | BibFileFieldFree (BibFileField **field) |
Recursively free's the given field and sets it to NULL. More... | |
BibFileRecord * | BibFileRecordMake (char *name, char *id, BibFileField *field) |
Given record name and id strings and a field pointer a new record is created. More... | |
BibFileField * | BibFileFieldMake (char *name, char *value, BibFileField *next) |
Given field name and value strings and a field pointer for the next field, a new field is created. More... | |
BibFileField * | BibFileFieldMakeVa (char *name, char *value,...) |
Given a list of field name and value string pairs which is terminated by a NULL. A hierarchy of new fields is created. More... | |
BibFileField * | BibFileFieldJoin (BibFileField *field0, BibFileField *field1,...) |
Given a NULL terminated varargs list of fields, these are joined by filling in the appropriate next fields. More... | |
BibFileError | BibFileRecordRead (BibFileRecord **record, char **eMsg, FILE *fP) |
Read a bibtex style record from the given stream and allocate storage as required. More... | |
BibFileError | BibFileRecordWrite (FILE *fP, char **eMsg, BibFileRecord *record) |
Write a bibtex style record to the given stream. More... | |
static BibFileError | BibFileRecordError (char **eMsg, BibFileRecord *record) |
Build an error string showing with some record info. More... | |
BibFileError | BibFileFieldRead (BibFileField **field, char **eMsg, int *endFlag, FILE *fP) |
Read a bibtex style field from the given stream and allocate storage as required. More... | |
BibFileError | BibFileFieldWrite (FILE *fP, char **eMsg, BibFileField *field) |
Write a bibtex style field to the given stream. More... | |
static BibFileError | BibFileFieldError (char **eMsg, BibFileField *field) |
Build an error string showing with some field info. More... | |
static BibFileError | BibFileStrRead (char **str, BibFileTok tok, int skipSp, FILE *fP) |
Read a character string from the given stream until a character not matched by the given charcter list is read, this character is then put back so that it can be read again. If the skip spaces flag is non zero then leading white space characters will be skipped. Characters in the string may be escaped by the escape character. String length is only limited by the memory available to AlcMalloc. More... | |
static BibFileError | BibFileCharMatch (BibFileTok tok, int skipFlag, int skipSp, FILE *fP) |
Check for a character that matches the given charcter list. If the skip flag is zero this character is put back so that it can be read again. If the skip spaces flag is non zero then leading white space characters will be skipped. More... | |
static BibFileError | BibFileCharUnread (char newC, FILE *fP) |
Put a character back into the stream from which it was read. More... | |
static BibFileError | BibFileCharRegEx (char given, BibFileTok tok) |
Match the given character to the given regular expression. The regular expression may either be compilled or a charcater string. More... | |
static BibFileError | BibFileSkipSpaces (FILE *fP) |
Read and skip white space characters. More... | |
BibFileError | BibFileEscapeRestrictedChar (char *inString, char **outString) |
Replace any special character with ESC+spacial char. More... | |
BibFileError | BibFileUnEscapeRestrictedChar (char *inString, char **outString) |
Replace any special caracter with ESC+spacial char. More... | |
int | BibFileFieldParseFmt (BibFileField *topField, void *value, char *fmt, char *name,...) |
Given the top most field from which to parse fields and a NULL terminated varargs list of field value pointers, format strings (for sscanf) and field name strings. All fields are parsed for all name strings. Parsed values are allowed to overwrite those previously parsed. Note that string values are parsed using a char ** and are AlcStrDup()'d. More... | |
Convenience procedures for reading and writing "bibtex" style text files for record-formatted data. libbibfile for more detail.
void BibFileRecordFree | ( | BibFileRecord ** | record | ) |
Free's the given record and sets it to NULL.
record | Record ptr to free. |
References AlcFree(), BibFileFieldFree(), BibFileRecord::field, BibFileRecord::id, and BibFileRecord::name.
Referenced by BibFileRecordRead(), WlzEffBibRead3DView(), WlzEffBibWrite3DSectionViewParamsRecord(), WlzEffBibWriteFileRecord(), WlzEffBibWriteTiePointVtxsRecord(), WlzEffBibWriteWarpInputSegmentationParamsRecord(), WlzEffBibWriteWarpInputThresholdParamsRecord(), and WlzEffBibWriteWarpTransformParamsRecord().
void BibFileFieldFree | ( | BibFileField ** | field | ) |
Recursively free's the given field and sets it to NULL.
field | Field ptr to free. |
References AlcFree(), _BibFileField::name, _BibFileField::next, and _BibFileField::value.
Referenced by BibFileFieldMakeVa(), and BibFileRecordFree().
BibFileRecord* BibFileRecordMake | ( | char * | name, |
char * | id, | ||
BibFileField * | field | ||
) |
Given record name and id strings and a field pointer a new record is created.
name | Record name string. |
id | Record id string. |
field | Top field of record. |
References AlcCalloc(), AlcFree(), AlcStrDup(), BibFileRecord::field, BibFileRecord::id, _BibFileField::name, and BibFileRecord::name.
Referenced by WlzEffBibWrite3DSectionViewParamsRecord(), WlzEffBibWriteFileRecord(), WlzEffBibWriteTiePointVtxsRecord(), WlzEffBibWriteWarpInputSegmentationParamsRecord(), WlzEffBibWriteWarpInputThresholdParamsRecord(), and WlzEffBibWriteWarpTransformParamsRecord().
BibFileField* BibFileFieldMake | ( | char * | name, |
char * | value, | ||
BibFileField * | next | ||
) |
Given field name and value strings and a field pointer for the next field, a new field is created.
name | Field name string. |
value | Field value string. |
next | Next field below this one. |
References AlcCalloc(), AlcFree(), AlcStrDup(), _BibFileField::name, _BibFileField::next, and _BibFileField::value.
Referenced by BibFileFieldMakeVa().
BibFileField* BibFileFieldMakeVa | ( | char * | name, |
char * | value, | ||
... | |||
) |
Given a list of field name and value string pairs which is terminated by a NULL. A hierarchy of new fields is created.
name | First field name string. |
value | First field value string. |
... | NULL terminated varargs list of name value pairs. |
References BibFileFieldFree(), BibFileFieldMake(), _BibFileField::name, _BibFileField::next, and _BibFileField::value.
Referenced by WlzEffBibWrite3DSectionViewParamsRecord(), WlzEffBibWriteFileRecord(), WlzEffBibWriteTiePointVtxsRecord(), WlzEffBibWriteWarpInputSegmentationParamsRecord(), WlzEffBibWriteWarpInputThresholdParamsRecord(), and WlzEffBibWriteWarpTransformParamsRecord().
BibFileField* BibFileFieldJoin | ( | BibFileField * | field0, |
BibFileField * | field1, | ||
... | |||
) |
Given a NULL terminated varargs list of fields, these are joined by filling in the appropriate next fields.
field0 | Top most field of join. |
field1 | Field to be added to top field. |
... | NULL terminated varargs list of fields to be joined. |
References _BibFileField::next.
BibFileError BibFileRecordRead | ( | BibFileRecord ** | record, |
char ** | eMsg, | ||
FILE * | fP | ||
) |
Read a bibtex style record from the given stream and allocate storage as required.
record | Destination ptr for the record. |
eMsg | Ptr for error message strings. |
fP | Input file stream. |
References AlcCalloc(), BIBFILE_ER_EOF, BIBFILE_ER_MALLOC, BIBFILE_ER_NONE, BIBFILE_TOK_CLOSE, BIBFILE_TOK_NEW, BIBFILE_TOK_OPEN, BIBFILE_TOK_RECID, BIBFILE_TOK_RECNAME, BIBFILE_TOK_SEP, BibFileCharMatch(), BibFileFieldRead(), BibFileRecordError(), BibFileRecordFree(), and BibFileStrRead().
Referenced by WlzEffBibRead3DView().
BibFileError BibFileRecordWrite | ( | FILE * | fP, |
char ** | eMsg, | ||
BibFileRecord * | record | ||
) |
Write a bibtex style record to the given stream.
fP | Output file stream. |
eMsg | Ptr for error message strings. |
record | Record ptr. |
References BIBFILE_ER_NONE, BIBFILE_ER_SYNTAX, BibFileRecord::field, BibFileRecord::id, and BibFileRecord::name.
Referenced by WlzEffBibWrite3DSectionViewParamsRecord(), WlzEffBibWriteFileRecord(), WlzEffBibWriteTiePointVtxsRecord(), WlzEffBibWriteWarpInputSegmentationParamsRecord(), WlzEffBibWriteWarpInputThresholdParamsRecord(), and WlzEffBibWriteWarpTransformParamsRecord().
static BibFileError BibFileRecordError | ( | char ** | eMsg, |
BibFileRecord * | record | ||
) |
Build an error string showing with some record info.
eMsg | Ptr for error message strings. |
record | Record ptr. |
References BIBFILE_ER_NONE.
Referenced by BibFileRecordRead().
BibFileError BibFileFieldRead | ( | BibFileField ** | field, |
char ** | eMsg, | ||
int * | endFlag, | ||
FILE * | fP | ||
) |
Read a bibtex style field from the given stream and allocate storage as required.
field | Destination ptr for the field. |
eMsg | Ptr for error message strings. |
endFlag | Set to non zero if last field. |
fP | Input file stream. |
References AlcCalloc(), AlcFree(), BIBFILE_ER_EOF, BIBFILE_ER_MALLOC, BIBFILE_ER_NONE, BIBFILE_ER_SYNTAX, BIBFILE_TOK_CLOSE, BIBFILE_TOK_EQUAL, BIBFILE_TOK_FLDNAME, BIBFILE_TOK_FLDVAL, BIBFILE_TOK_OPEN, BIBFILE_TOK_SEP, BibFileCharMatch(), BibFileFieldError(), BibFileStrRead(), _BibFileField::name, and _BibFileField::value.
Referenced by BibFileRecordRead().
BibFileError BibFileFieldWrite | ( | FILE * | fP, |
char ** | eMsg, | ||
BibFileField * | field | ||
) |
Write a bibtex style field to the given stream.
fP | Output file stream. |
eMsg | Ptr for error message strings. |
field | Field ptr. |
References BIBFILE_ER_NONE, BIBFILE_ER_SYNTAX, _BibFileField::name, and _BibFileField::value.
static BibFileError BibFileFieldError | ( | char ** | eMsg, |
BibFileField * | field | ||
) |
Build an error string showing with some field info.
eMsg | Ptr for error message strings. |
field | Field ptr. |
References BIBFILE_ER_NONE, and _BibFileField::name.
Referenced by BibFileFieldRead().
static BibFileError BibFileStrRead | ( | char ** | str, |
BibFileTok | tok, | ||
int | skipSp, | ||
FILE * | fP | ||
) |
Read a character string from the given stream until a character not matched by the given charcter list is read, this character is then put back so that it can be read again. If the skip spaces flag is non zero then leading white space characters will be skipped. Characters in the string may be escaped by the escape character. String length is only limited by the memory available to AlcMalloc.
str | Ptr for the string to be read. |
tok | Regular expression for valid characters within the string. |
skipSp | Skip leading white space characters if non zero. |
fP | Given input stream. |
References AlcMalloc(), BIBFILE_ER_MALLOC, BIBFILE_ER_NONE, and BIBFILE_STRBUF_START.
Referenced by BibFileFieldRead(), and BibFileRecordRead().
static BibFileError BibFileCharMatch | ( | BibFileTok | tok, |
int | skipFlag, | ||
int | skipSp, | ||
FILE * | fP | ||
) |
Check for a character that matches the given charcter list. If the skip flag is zero this character is put back so that it can be read again. If the skip spaces flag is non zero then leading white space characters will be skipped.
tok | Regular expression token. |
skipFlag | Put the character back into the input stream if non zero. |
skipSp | Skip leading white space characters if non zero. |
fP | Given input stream. |
References BIBFILE_ER_NONE.
Referenced by BibFileFieldRead(), and BibFileRecordRead().
static BibFileError BibFileCharUnread | ( | char | newC, |
FILE * | fP | ||
) |
Put a character back into the stream from which it was read.
newC | The character to put back. |
fP | Given input stream. |
References BIBFILE_ER_NONE, and BIBFILE_ER_READ.
static BibFileError BibFileCharRegEx | ( | char | given, |
BibFileTok | tok | ||
) |
Match the given character to the given regular expression. The regular expression may either be compilled or a charcater string.
given | Character to match. |
tok | Regular expression for valid characters to match. |
References BIBFILE_ER_MALLOC, BIBFILE_ER_NONE, BIBFILE_TOK_MAX, and BIBFILE_TOK_MIN.
static BibFileError BibFileSkipSpaces | ( | FILE * | fP | ) |
Read and skip white space characters.
fP | Given input stream. |
References BIBFILE_ER_EOF, and BIBFILE_ER_NONE.
BibFileError BibFileEscapeRestrictedChar | ( | char * | inString, |
char ** | outString | ||
) |
Replace any special character with ESC+spacial char.
inString | Given string. |
outString | Destination pointer for the escaped string. |
References AlcMalloc(), BIBFILE_ER_NONE, BIBFILE_RESTRICTED_NUM, and BIBFILE_STRBUF_START.
BibFileError BibFileUnEscapeRestrictedChar | ( | char * | inString, |
char ** | outString | ||
) |
Replace any special caracter with ESC+spacial char.
inString | Original string. |
outString | The escaped string. |
References AlcFree(), AlcMalloc(), AlcStrDup(), BIBFILE_ER_MALLOC, and BIBFILE_ER_NONE.
int BibFileFieldParseFmt | ( | BibFileField * | topField, |
void * | value, | ||
char * | fmt, | ||
char * | name, | ||
... | |||
) |
Given the top most field from which to parse fields and a NULL terminated varargs list of field value pointers, format strings (for sscanf) and field name strings. All fields are parsed for all name strings. Parsed values are allowed to overwrite those previously parsed. Note that string values are parsed using a char ** and are AlcStrDup()'d.
topField | Top most field in hierarchy of fields to be parsed. |
value | First value pointer for result, passed directly to sscanf. |
fmt | First format string for sscanf. |
name | First field name to be matched. |
... | NULL terminated varargs list of value, format and name triples. |
References AlcStrDup(), _BibFileField::name, _BibFileField::next, and _BibFileField::value.
Referenced by WlzEffBibParse3DSectionViewParamsRecord(), WlzEffBibParseFileRecord(), WlzEffBibParseTiePointVtxsRecord(), WlzEffBibParseWarpInputSegmentationParamsRecord(), WlzEffBibParseWarpInputThresholdParamsRecord(), and WlzEffBibParseWarpTransformParamsRecord().