2019-01-31 17:56:18 +01:00
|
|
|
#ifndef INPUT_FILE_H
|
|
|
|
#define INPUT_FILE_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
FILE *f;
|
|
|
|
char *line;
|
|
|
|
const char *filename;
|
|
|
|
size_t linenum;
|
|
|
|
} input_file_t;
|
|
|
|
|
2019-01-31 22:09:38 +01:00
|
|
|
typedef struct {
|
|
|
|
const char *name;
|
|
|
|
int (*handle)(input_file_t *f, void *obj);
|
|
|
|
} keyword_handler_t;
|
2019-01-31 17:56:18 +01:00
|
|
|
|
|
|
|
void cleanup_file(input_file_t *f);
|
|
|
|
|
|
|
|
int open_file(input_file_t *f, const char *filename);
|
|
|
|
|
2019-01-31 22:09:38 +01:00
|
|
|
int process_file(input_file_t *f, const keyword_handler_t *handlers,
|
|
|
|
size_t count, void *obj);
|
|
|
|
|
|
|
|
void input_file_complain(const input_file_t *f, const char *msg);
|
|
|
|
|
2019-01-31 17:56:18 +01:00
|
|
|
#endif /* INPUT_FILE_H */
|