|
mdcore
0.1.5
|
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <strings.h>#include <alloca.h>#include "../config.h"#include "errs.h"#include "reader.h"Defines | |
| #define | error(r, id) reader_error( r , id , __LINE__ , __FUNCTION__ ) |
Functions | |
| int | reader_error (struct reader *r, int id, int line, const char *function) |
| int | reader_getc (struct reader *r) |
| Read the next char. | |
| int | reader_getline (struct reader *r, char *buff, int buff_size) |
| Read until a newline. | |
| int | reader_skipline (struct reader *r) |
| Skip until a newline. | |
| int | reader_iscomm_stop (struct reader *r, int c) |
| Check if a character is a comment stop. | |
| int | reader_iscomm_start (struct reader *r, int c) |
| Check if a character is a comment start. | |
| int | reader_isws (struct reader *r, int c) |
| Check if a character is whitespace. | |
| int | reader_getcomment (struct reader *r, char *buff, int buff_size) |
| Read the next comment from the given reader. | |
| int | reader_skipcomment (struct reader *r) |
| Skip the next comment from the given reader. | |
| int | reader_gettoken (struct reader *r, char *buff, int buff_size) |
| Read a token from the given reader. | |
| int | reader_skiptoken (struct reader *r) |
| Skip a token from the given reader. | |
| int | reader_init (struct reader *r, FILE *file, char *ws, char *comm_start, char *comm_stop) |
| Initialize the reader. | |
Variables | |
| int | reader_err = reader_err_ok |
| char * | reader_err_msg [6] |
| char | reader_buff [100] |
| #define error | ( | r, | |
| id | |||
| ) | reader_error( r , id , __LINE__ , __FUNCTION__ ) |
| int reader_error | ( | struct reader * | r, |
| int | id, | ||
| int | line, | ||
| const char * | function | ||
| ) |
| int reader_getc | ( | struct reader * | r | ) |
Read the next char.
| r | The reader. |
| int reader_getcomment | ( | struct reader * | r, |
| char * | buff, | ||
| int | buff_size | ||
| ) |
Read the next comment from the given reader.
| r | the reader. |
| buff | Pointer to char at which to store the token. |
| buff_size | Size of the buff. |
| int reader_getline | ( | struct reader * | r, |
| char * | buff, | ||
| int | buff_size | ||
| ) |
Read until a newline.
| r | The reader. |
| buff | Pointer to char at which to store the token. |
| buff_size | Size of the buff. |
| int reader_gettoken | ( | struct reader * | r, |
| char * | buff, | ||
| int | buff_size | ||
| ) |
Read a token from the given reader.
| r | The reader. |
| buff | Pointer to char at which to store the token. |
| buff_size | Size of the buff. |
| int reader_init | ( | struct reader * | r, |
| FILE * | file, | ||
| char * | ws, | ||
| char * | comm_start, | ||
| char * | comm_stop | ||
| ) |
Initialize the reader.
| 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.
| int reader_iscomm_start | ( | struct reader * | r, |
| int | c | ||
| ) |
| int reader_iscomm_stop | ( | struct reader * | r, |
| int | c | ||
| ) |
| int reader_isws | ( | struct reader * | r, |
| int | c | ||
| ) |
| int reader_skipcomment | ( | struct reader * | r | ) |
Skip the next comment from the given reader.
| r | the reader. |
| int reader_skipline | ( | struct reader * | r | ) |
Skip until a newline.
| r | The reader. |
| int reader_skiptoken | ( | struct reader * | r | ) |
Skip a token from the given reader.
| r | The reader. |
| char reader_buff[100] |
| int reader_err = reader_err_ok |
ID of the last error
| char* reader_err_msg[6] |
{
"Nothing bad happened.",
"An unexpected NULL pointer was encountered.",
"A call to malloc failed, probably due to insufficient memory.",
"An input-output error occurred.",
"Maximum buffer size reached.",
"End of file reached.",
}
1.7.6.1