ZEDA
1.6.18
|
Macros | |
#define | zIsWS(c) ( (c) == ' ' || (c) == '\t' ) |
check if a charactor is the whitespace. More... | |
#define | zIsQuotation(c) ( (c) == '\'' || (c) == '\"' ) |
check if a charactor is a quotation mark. More... | |
#define | ZDEFAULT_COMMENT_IDENT '%' |
Functions | |
void | zSetDelimiter (char s[]) |
specify a delimiter set. More... | |
void | zResetDelimiter (void) |
reset a delimiter set. More... | |
void | zSetOperator (char s[]) |
specify an operator set. More... | |
void | zResetOperator (void) |
reset an operator set. More... | |
bool | zIsIncludedChar (char c, char *s) |
check if a charactor is included in a specified set. More... | |
bool | zIsDelimiter (char c) |
check if a charactor is a delimiter. More... | |
bool | zIsOperator (char c) |
check if a charactor is an operator. More... | |
bool | zStrIsHex (char *str) |
check if a string represents a hexadecimal number. More... | |
char | zFSkipWS (FILE *fp) |
skip whitespaces in a file. More... | |
char * | zSSkipWS (char *str) |
skip whitespaces in a string. More... | |
char | zFSkipIncludedChar (FILE *fp, char *s) |
skip a certain charactors in a stream. More... | |
char * | zSSkipIncludedChar (char *str, char *s) |
skip a certain charactors in a string. More... | |
char | zFSkipDelimiter (FILE *fp) |
skip delimiter in a file. More... | |
char * | zSSkipDelimiter (char *str) |
skip delimiter in a string. More... | |
void | zSetCommentIdent (char ident) |
specify the comment identifier. More... | |
void | zResetCommentIdent (void) |
reset the comment identifier. More... | |
char | zFSkipComment (FILE *fp) |
skip comments. More... | |
char * | zFToken (FILE *fp, char *tkn, size_t size) |
tokenize a file. More... | |
char * | zSTokenSkim (char *str, char *tkn, size_t size) |
tokenize a string. More... | |
char * | zSToken (char *str, char *tkn, size_t size) |
char * | zFIntToken (FILE *fp, char *tkn, size_t size) |
tokenize an integer value in a file. More... | |
char * | zFNumToken (FILE *fp, char *tkn, size_t size) |
tokenize a real number in a file. More... | |
char * | zSIntToken (char *str, char *tkn, size_t size) |
tokenize an integer value in a string. More... | |
char * | zSNumToken (char *str, char *tkn, size_t size) |
tokenize a real number in a string. More... | |
char * | zFInt (FILE *fp, int *val) |
get an integer value from file. More... | |
char * | zSInt (char *str, int *val) |
get an integer value from a string. More... | |
char * | zFDouble (FILE *fp, double *val) |
get a d-float value in a file. More... | |
char * | zSDouble (char *str, double *val) |
get a d-float value in a string. More... | |
#define zIsWS | ( | c | ) | ( (c) == ' ' || (c) == '\t' ) |
check if a charactor is the whitespace.
zIsWS() is a boolean. It is the true value if a charactor c is either the whitespace or the tab charactor.
#define zIsQuotation | ( | c | ) | ( (c) == '\'' || (c) == '\"' ) |
check if a charactor is a quotation mark.
zIsQuotation() is a boolean. It is the true value if c is either ' or ".
#define ZDEFAULT_COMMENT_IDENT '%' |
void zSetDelimiter | ( | char | s[] | ) |
specify a delimiter set.
zSetDelimiter() specifies a delimiter set for s. It works for tokenization functions. To reset the delimiter set, call zResetDelimiter().
void zResetDelimiter | ( | void | ) |
reset a delimiter set.
zResetDelimiter() resets a delimiter set. The default delimiter set includes: whitespace, tab \t, new line \n, carriage return \r, comma, colon :, semi-colon ;, vertical bar |, parenthesis (), brace {}, null character \0 and end of file EOF.
They work for tokenization functions.
void zSetOperator | ( | char | s[] | ) |
specify an operator set.
zSetOperator() specifies an operator set for s. It works for tokenization functions. To reset the operator set, call zResetOperator().
void zResetOperator | ( | void | ) |
reset an operator set.
zResetOperator() resets an operator set. The default operator set includes: exclamation !, percent %, ampasand &, asterisk *, plus +, minus -, slash /, more than <, equal =, less than >, question ?, at-mark @, back slash \, carat ^ and tilde ~
They work for tokenization functions.
bool zIsIncludedChar | ( | char | c, |
char * | s | ||
) |
check if a charactor is included in a specified set.
zIsIncludedChar() checks if a charactor c is included in a charactor set s.
bool zIsDelimiter | ( | char | c | ) |
check if a charactor is a delimiter.
zIsDelimiter() checks if a charactor c is a delimiter, namely, if c is included in the delimiter set defined by zSetDelimiter().
bool zIsOperator | ( | char | c | ) |
check if a charactor is an operator.
zIsOperator() checks if a charactor c is an operator, namely, if c is included in the operator set defined by zSetOperator().
bool zStrIsHex | ( | char * | str | ) |
check if a string represents a hexadecimal number.
zStrIsHex() checks if a string pointed by str represents a hexadecimal number, namely, if str consists only of numbers and a-f alphabets.
char zFSkipWS | ( | FILE * | fp | ) |
skip whitespaces in a file.
zFSkipWS() skips whitespaces in a file fp from the current position.
char* zSSkipWS | ( | char * | str | ) |
skip whitespaces in a string.
zSSkipWS() skips whitespaces in a string str from the current position.
char zFSkipIncludedChar | ( | FILE * | fp, |
char * | s | ||
) |
skip a certain charactors in a stream.
zFSkipIncludedChar() skips charactors in a specified set s from the current position of a file referred by fp.
char* zSSkipIncludedChar | ( | char * | str, |
char * | s | ||
) |
skip a certain charactors in a string.
zSSkipIncludedChar() skips charactors in a specified set s from the current position of a string str.
char zFSkipDelimiter | ( | FILE * | fp | ) |
skip delimiter in a file.
zFSkipDelimiter() skips delimiters in a file fp from the current position.
char* zSSkipDelimiter | ( | char * | str | ) |
skip delimiter in a string.
zSSkipDelimiter() skips delimiters in a string str from the current position.
void zSetCommentIdent | ( | char | ident | ) |
specify the comment identifier.
void zResetCommentIdent | ( | void | ) |
reset the comment identifier.
char zFSkipComment | ( | FILE * | fp | ) |
skip comments.
zFSkipComment() skips comments, i.e., a one-line string which begins with a specified identifier, in a file fp. Vague lines are also skipped. The identifier can be set by zSetCommentIdent() and be reset by zResetCommentIdent().
char* zFToken | ( | FILE * | fp, |
char * | tkn, | ||
size_t | size | ||
) |
tokenize a file.
zFToken() acquires a first token in a file fp appearing from the current position, and copies it where tkn points. Token is a charactor set segmented by a delimiter, charactors enclosed in quotation marks or double quotation marks. The token size is limited up to size. If the first quotation mark does not have a corresponding closing mark, the token buffer is filled with the rest charactors in the file.
char* zSTokenSkim | ( | char * | str, |
char * | tkn, | ||
size_t | size | ||
) |
tokenize a string.
zSToken() acquires the first token in a string str and copies it where tkn points. Token is a charactor set segmented by a delimiter, charactors enclosed in quotation marks or double quotation marks. The token size is limited up to size. If the first quotation mark does not have a corresponding closing mark, the token buffer is filled with the rest charactors in the string. str is overridden by the remaining string destructively.
zSTokenSkim() also acquires the first token in a string str and copies it where tkn points. The difference from zSToken() is that it returns a pointer immediately after tkn in str and does not destroy str.
zSTokenSkim() returns a pointer immediately after tkn, which corresponds to a charactor in str.
char* zSToken | ( | char * | str, |
char * | tkn, | ||
size_t | size | ||
) |
char* zFIntToken | ( | FILE * | fp, |
char * | tkn, | ||
size_t | size | ||
) |
tokenize an integer value in a file.
zFIntToken() tokenizes an integer value in a file fp from the current position, and puts it where tkn points. size is the size of tkn. The charactors beyond size are truncated.
char* zFNumToken | ( | FILE * | fp, |
char * | tkn, | ||
size_t | size | ||
) |
tokenize a real number in a file.
zFNumToken() tokenizes a real number in a file fp from the current position, and puts it where tkn points. size is the size of tkn. The charactors beyond size are truncated.
char* zSIntToken | ( | char * | str, |
char * | tkn, | ||
size_t | size | ||
) |
tokenize an integer value in a string.
zSIntToken() tokenizes an integer value in a string str, and puts it where tkn points. size is the size of tkn. The charactors beyond size are truncated. str is overridden by the remaining string destructively.
char* zSNumToken | ( | char * | str, |
char * | tkn, | ||
size_t | size | ||
) |
tokenize a real number in a string.
zSNumToken() tokenizes a real number in a string str, and puts it where tkn points. size is the size of tkn. The charactors beyond size are truncated. str is overridden by the remaining string destructively.
char* zFInt | ( | FILE * | fp, |
int * | val | ||
) |
get an integer value from file.
zFInt() acquires an integer value in a file fp from the current position. If no integer value is recognized at the current position, zero is returned.
char* zSInt | ( | char * | str, |
int * | val | ||
) |
get an integer value from a string.
zSInt() acquires an integer value in a string str. If no integer value is recognized at the head of the string, zero is returned.
char* zFDouble | ( | FILE * | fp, |
double * | val | ||
) |
get a d-float value in a file.
zFDouble() acquires a double-precision floating-point value in a file fp from the current position. If no value is recognized at the current position, zero is returned.
char* zSDouble | ( | char * | str, |
double * | val | ||
) |
get a d-float value in a string.
zSDouble() acquires a double-precision floating-point value in a string str. If no value is recognized at the head of the string, zero is returned.