2012-03-26 22:04:59 +00:00
|
|
|
|
|
|
|
#ifndef BUILD_SCRIPTFILE_H_
|
|
|
|
#define BUILD_SCRIPTFILE_H_
|
|
|
|
|
2007-01-29 01:18:16 +00:00
|
|
|
typedef struct {
|
|
|
|
char *textbuf;
|
2009-01-09 09:29:17 +00:00
|
|
|
uint32_t textlength;
|
2007-01-29 01:18:16 +00:00
|
|
|
char *ltextptr; // pointer to start of the last token fetched (use this for line numbers)
|
|
|
|
char *textptr;
|
|
|
|
char *eof;
|
|
|
|
char *filename;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t linenum;
|
|
|
|
int32_t *lineoffs;
|
2007-01-29 01:18:16 +00:00
|
|
|
} scriptfile;
|
|
|
|
|
|
|
|
char *scriptfile_gettoken(scriptfile *sf);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num);
|
|
|
|
int32_t scriptfile_getdouble(scriptfile *sf, double *num);
|
|
|
|
int32_t scriptfile_getstring(scriptfile *sf, char **st);
|
2017-06-27 02:24:28 +00:00
|
|
|
int scriptfile_getsymbol(scriptfile *sf, int32_t *num);
|
2012-01-10 23:45:34 +00:00
|
|
|
int32_t scriptfile_getlinum(const scriptfile *sf, const char *ptr);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t scriptfile_getbraces(scriptfile *sf, char **braceend);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2010-08-14 21:32:28 +00:00
|
|
|
scriptfile *scriptfile_fromfile(const char *fn);
|
|
|
|
scriptfile *scriptfile_fromstring(const char *string);
|
2007-01-29 01:18:16 +00:00
|
|
|
void scriptfile_close(scriptfile *sf);
|
2017-06-27 02:24:28 +00:00
|
|
|
int scriptfile_eof(scriptfile *sf);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2016-01-11 05:06:10 +00:00
|
|
|
int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val);
|
|
|
|
int32_t scriptfile_addsymbolvalue(char const *name, int32_t val);
|
2007-01-29 01:18:16 +00:00
|
|
|
void scriptfile_clearsymbols(void);
|
2012-03-26 22:04:59 +00:00
|
|
|
|
2020-09-08 16:39:47 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *text;
|
|
|
|
int32_t tokenid;
|
|
|
|
}
|
|
|
|
tokenlist;
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
T_EOF = -2,
|
|
|
|
T_ERROR = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens);
|
|
|
|
|
2012-03-26 22:04:59 +00:00
|
|
|
#endif
|