Woolz Image Processing
Version 1.7.5
|
File I/O functions to parse the bibtex based file syntax used for serial section data, .... More...
Macros | |
#define | BIBFILE_REGEXPR_CACHE /* Cache regular expressions */ |
#define | BIBFILE_REGEXPR_REGEXEC /* Use regexec(3) and regcomp(3) */ |
#define | BIBFILE_EOL '\n' |
#define | BIBFILE_RESTRICTED_NUM 4 |
#define | BIBFILE_STRBUF_START 256 |
#define | BIBFILE_STRBUF_INC 1024 |
Functions | |
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... | |
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... | |
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... | |
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 | BibFileFieldError (char **eMsg, BibFileField *field) |
Build an error string showing with some field info. More... | |
static BibFileError | BibFileRecordError (char **eMsg, BibFileRecord *record) |
Build an error string showing with some record info. More... | |
static BibFileError | BibFileSkipSpaces (FILE *fP) |
Read and skip white space characters. 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... | |
File I/O functions to parse the bibtex based file syntax used for serial section data, ....
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. The syntax is:
file := (comment | record) comment := COMMENT text EOL record := NEW name OPEN id field (SEP field)* CLOSE field := name EQUAL OPEN value CLOSE
Example:
% this is a comment which is ignored @Comment { 0, Text = {This is a comment too, but it is parsed} } @Fred{1, FFred={First bit}, SFred={Second line of text} % comment here too } % another comment @Bert{2,FBert={bert's 1st value has a newline and an escaped newline \ too}, SBert = {bert's 2nd includes a \} character}}
All the tokens (eg OPEN, CLOSE, ...) are parsed using regular expressions and character lists held in tables. The parsing could be changed/extended by modifying the tables, eg changing the definition of OPEN/CLOSE to allow the double quote character. Using regular expressions has made coding easier and the parsing more flexible at the cost of speed. On a Sparc 10/40 with -O4 optimisation about 20% of the execution time is spent matching regular expressions.
#define BIBFILE_REGEXPR_CACHE /* Cache regular expressions */ |
#define BIBFILE_REGEXPR_REGEXEC /* Use regexec(3) and regcomp(3) */ |
#define BIBFILE_EOL '\n' |
Referenced by BibFileCharMatch(), BibFileRecordWrite(), and BibFileStrRead().
#define BIBFILE_RESTRICTED_NUM 4 |
Referenced by BibFileEscapeRestrictedChar().
#define BIBFILE_STRBUF_START 256 |
Referenced by BibFileEscapeRestrictedChar(), and BibFileStrRead().
#define BIBFILE_STRBUF_INC 1024 |
Referenced by BibFileEscapeRestrictedChar(), and BibFileStrRead().
enum BibFileTok |