2012-03-26 22:04:59 +00:00
|
|
|
|
|
|
|
#ifndef BUILD_SCRIPTFILE_H_
|
|
|
|
#define BUILD_SCRIPTFILE_H_
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
2012-11-05 02:49:08 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
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);
|
|
|
|
int32_t 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);
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t scriptfile_eof(scriptfile *sf);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t scriptfile_getsymbolvalue(char *name, int32_t *val);
|
|
|
|
int32_t scriptfile_addsymbolvalue(char *name, int32_t val);
|
2007-01-29 01:18:16 +00:00
|
|
|
void scriptfile_clearsymbols(void);
|
2012-03-26 22:04:59 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
2012-11-05 02:49:08 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-26 22:04:59 +00:00
|
|
|
#endif
|