#ifndef file_buffer_h_included
#define file_buffer_h_included
typedef struct Filebuf_len_str {
size_t n_char;
char *sz;
} FBSTRING;
typedef union Filebuf_obj {
FBSTRING str_value;
unsigned long ulong_value;
long long_value;
double dbl_value;
} FBOBJ;
typedef struct Filebuf {
FILE *fp;
bool is_eof;
bool f_skip_to_eol;
* skipped before getting the next item from the buffer.
* This flag is set when a comment terminates an item,
* such as "abc# This is a comment." */
size_t n_byte_buf_alloc;
char *p_buf;
char *p_obj_start;
char *p_obj_end;
char *p_data_cur;
* circumstances, it points to either the character
* being processed or the next character to process */
char *p_data_end;
char *p_buf_end;
* p_buf + n_byte_buf_alloc, so it is redundant, but
* convenient to have available */
} FILEBUF;
typedef enum FBtype {
BUF_TYPE_STRING,
BUF_TYPE_ULONG,
BUF_TYPE_LONG,
BUF_TYPE_DOUBLE
} FBTYPE;
FILEBUF *fbopen(const char *filename, size_t n_byte_buf_init);
int fbget(FILEBUF *p_fb, unsigned int n_type_wanted, FBTYPE *p_type_wanted,
FBTYPE *p_type_found, FBOBJ *p_fbobj);
int fbclose(FILEBUF *fbp);
#endif