2008-05-09 17:35:24 -07:00
|
|
|
#ifndef __INCLUDED_LIB_FRAMEWORK_LEXER_INPUT_H__
|
|
|
|
#define __INCLUDED_LIB_FRAMEWORK_LEXER_INPUT_H__
|
|
|
|
|
|
|
|
#include <physfs.h>
|
2009-04-18 13:28:16 -07:00
|
|
|
#include <stdio.h>
|
2008-05-09 17:35:24 -07:00
|
|
|
|
2009-03-29 13:49:35 -07:00
|
|
|
enum lexinput_type
|
|
|
|
{
|
2009-04-17 15:02:15 -07:00
|
|
|
LEXINPUT_STDIO,
|
2009-03-29 13:49:35 -07:00
|
|
|
LEXINPUT_PHYSFS,
|
|
|
|
LEXINPUT_BUFFER,
|
|
|
|
};
|
|
|
|
|
2008-05-09 17:35:24 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
2009-04-17 15:02:15 -07:00
|
|
|
FILE* stdiofile;
|
2008-05-09 17:35:24 -07:00
|
|
|
PHYSFS_file* physfsfile;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
const char* begin;
|
|
|
|
const char* end;
|
|
|
|
} buffer;
|
|
|
|
} input;
|
2009-03-29 13:49:35 -07:00
|
|
|
enum lexinput_type type;
|
2008-05-09 17:35:24 -07:00
|
|
|
} lexerinput_t;
|
|
|
|
|
|
|
|
#ifdef YY_EXTRA_TYPE
|
|
|
|
# undef YY_EXTRA_TYPE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define YY_EXTRA_TYPE lexerinput_t *
|
|
|
|
|
|
|
|
extern int lexer_input(lexerinput_t* input, char* buf, size_t max_size, int nullvalue);
|
|
|
|
|
|
|
|
#define YY_INPUT(buf, result, max_size) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
result = lexer_input(yyextra, buf, max_size, YY_NULL); \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#endif // __INCLUDED_LIB_FRAMEWORK_LEXER_INPUT_H__
|