12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #ifndef FILE_READER_H
- #define FILE_READER_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "Error.h"
- typedef enum {
- FT_PATH,
- FT_NEWLINE,
- FT_LITERAL,
- FT_SINGLE,
- FT_SPACE,
- FT_END
- } FileToken;
- typedef struct {
- unsigned char* data;
- int capacity;
- int writeIndex;
- int readIndex;
- } FileTokens;
- typedef struct {
- unsigned char* data;
- const char* path;
- int length;
- int readIndex;
- int line;
- } FileReader;
- void ftInit(const char* path, FileTokens* ft, Error* e);
- void ftDelete(FileTokens* ft);
- FileToken ftRead(FileTokens* ft);
- bool ftReadSingleIf(FileTokens* ft, char c);
- char ftReadSingle(FileTokens* ft);
- const char* ftReadString(FileTokens* ft, int* length);
- #ifdef __cplusplus
- }
- #endif
- #endif
|