Go to the source code of this file.
Data Structures |
| struct | reader |
Defines |
| #define | reader_err_ok 0 |
| #define | reader_err_null -1 |
| #define | reader_err_malloc -2 |
| #define | reader_err_io -3 |
| #define | reader_err_buff -4 |
| #define | reader_err_eof -5 |
| #define | reader_flag_none 0 |
| #define | reader_flag_ready 1 |
| #define | reader_flag_eof 2 |
Functions |
| int | reader_getc (struct reader *r) |
| | Read the next char.
|
| int | reader_init (struct reader *r, FILE *file, char *ws, char *comm_start, char *comm_stop) |
| | Initialize the reader.
|
| int | reader_gettoken (struct reader *r, char *buff, int buff_size) |
| | Read a token from the given reader.
|
| int | reader_getcomment (struct reader *r, char *buff, int buff_size) |
| | Read the next comment from the given reader.
|
| int | reader_getline (struct reader *r, char *buff, int buff_size) |
| | Read until a newline.
|
| int | reader_skiptoken (struct reader *r) |
| | Skip a token from the given reader.
|
| int | reader_skipcomment (struct reader *r) |
| | Skip the next comment from the given reader.
|
| int | reader_skipline (struct reader *r) |
| | Skip until a newline.
|
| int | reader_isws (struct reader *r, int c) |
| | Check if a character is whitespace.
|
| int | reader_iscomm_start (struct reader *r, int c) |
| | Check if a character is a comment start.
|
| int | reader_iscomm_stop (struct reader *r, int c) |
| | Check if a character is a comment stop.
|
Variables |
| int | reader_err |
Define Documentation
Function Documentation
Read the next char.
- Parameters:
-
- Returns:
- The next character or < 0 on error (see reader_err).
Read the next comment from the given reader.
- Parameters:
-
| r | the reader. |
| buff | Pointer to char at which to store the token. |
| buff_size | Size of the buff. |
- Returns:
- The number of read characters or < 0 on error (see reader_err).
Read until a newline.
- Parameters:
-
| r | The reader. |
| buff | Pointer to char at which to store the token. |
| buff_size | Size of the buff. |
- Returns:
- The number of read characters or < 0 on error (see reader_err).
Read a token from the given reader.
- Parameters:
-
| r | The reader. |
| buff | Pointer to char at which to store the token. |
| buff_size | Size of the buff. |
- Returns:
- The number of read characters or < 0 on error (see reader_err).
| int reader_init |
( |
struct reader * |
r, |
|
|
FILE * |
file, |
|
|
char * |
ws, |
|
|
char * |
comm_start, |
|
|
char * |
comm_stop |
|
) |
| |
Initialize the reader.
- Parameters:
-
| r | The reader structure. |
| file | The FILE with which the reader should be associated. |
| ws | String containing the accepted whitespace characters. |
| comm_start | String containing characters indicating the start of a comment. |
| comm_stop | String containing characters indicating the end of a comment. |
The FILE supplied should be open and will be read as of its current position.
- Returns:
- reader_err_ok or < 0 on error (see reader_err).
Check if a character is a comment start.
- Parameters:
-
| r | The reader. |
| c | The character to verify. |
- Returns:
- 1 if
c is in the comm_start of the reader r or 0 otherwise.
Check if a character is a comment stop.
- Parameters:
-
| r | The reader. |
| c | The character to verify. |
- Returns:
- 1 if
c is in the comm_stop of the reader r or 0 otherwise.
Check if a character is whitespace.
- Parameters:
-
| r | The reader. |
| c | The character to verify. |
- Returns:
- 1 if
c is in the comm_stop of the reader r or 0 otherwise.
Skip the next comment from the given reader.
- Parameters:
-
- Returns:
- The number of read characters or < 0 on error (see reader_err).
Skip until a newline.
- Parameters:
-
- Returns:
- The number of read characters or < 0 on error (see reader_err).
Skip a token from the given reader.
- Parameters:
-
- Returns:
- The number of read characters or < 0 on error (see reader_err).
Variable Documentation