2012-03-26 22:04:59 +00:00
|
|
|
|
|
|
|
#ifndef BUILD_SCRIPTFILE_H_
|
|
|
|
#define BUILD_SCRIPTFILE_H_
|
|
|
|
|
2020-09-13 09:28:32 +00:00
|
|
|
#include "sc_man.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);
|
2020-09-13 08:29:57 +00:00
|
|
|
int32_t scriptfile_getstring(scriptfile *sf, FString *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);
|
2020-09-14 20:55:21 +00:00
|
|
|
FScriptPosition scriptfile_getposition(const scriptfile *sf);
|
2020-09-13 09:28:32 +00:00
|
|
|
int32_t scriptfile_getbraces(scriptfile *sf, FScanner::SavedPos *braceend);
|
2020-09-13 22:19:20 +00:00
|
|
|
inline bool scriptfile_endofblock(scriptfile* sf, FScanner::SavedPos& braceend)
|
|
|
|
{
|
|
|
|
return sf->textptr >= braceend.SavedScriptPtr;
|
|
|
|
}
|
2020-09-13 09:28:32 +00:00
|
|
|
void scriptfile_setposition(scriptfile* sf, const FScanner::SavedPos& pos);
|
2007-01-29 01:18:16 +00:00
|
|
|
|
2010-08-14 21:32:28 +00:00
|
|
|
scriptfile *scriptfile_fromfile(const char *fn);
|
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
|