-
Notifications
You must be signed in to change notification settings - Fork 3
/
sc_man.h
95 lines (81 loc) · 2.03 KB
/
sc_man.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef __SC_MAN_H__
#define __SC_MAN_H__
#include "doomtype.h"
enum EToken
{
Tk_Other,
Tk_Int,
Tk_Float,
Tk_String,
Tk_Bool
};
// Converted the entire Script manager into a class to allow recursive usage of scripts
class ScriptMan
{
enum
{
MAX_STRING_SIZE=4096
};
public:
char *sc_String;
int sc_Number;
double sc_Float;
int sc_Line;
bool sc_Quote;
boolean sc_End;
boolean sc_Crossed;
boolean sc_FileScripts;
int sc_Token;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
private:
char ScriptName[128];
char *ScriptBuffer;
char *ScriptPtr;
char *ScriptEndPtr;
char StringBuffer[MAX_STRING_SIZE];
boolean ScriptOpen;
int ScriptSize;
boolean AlreadyGot;
int FreeScript;
char *SavedScriptPtr;
int SavedScriptLine;
int ScriptLump;
char * tokensep;
public:
ScriptMan(char * tok="{}|=") { memset(this,0,sizeof(*this)); tokensep=tok; }
void SC_Open (const char *name);
void SC_OpenFile (const char *name);
void SC_OpenMem (const char *name, char *buffer, int size);
void SC_OpenLumpNum (QWORD lump, const char *name);
void SC_PrepareScript (void);
void SC_Close (void);
void SC_SavePos (void);
void SC_RestorePos (void);
boolean SC_GetString (void);
void SC_MustGetString (void);
void SC_MustGetStringName (const char *name);
boolean SC_GetNumber (void);
void SC_MustGetNumber (void);
boolean SC_GetFloat (void);
void SC_MustGetFloat (void);
void SC_UnGet (void);
int SC_MatchString (const char **strings);
int SC_MustMatchString (const char **strings);
boolean SC_Compare (const char *text);
void SC_ScriptError (const char *message, ...);
void CheckOpen(void);
bool SC_CheckString (const char *name);
void SC_MustGetToken (void);
int tkInt(const char *key = NULL);
double tkFloat(const char *key = NULL);
bool tkBool(const char *key = NULL);
int tkString(const char *key = NULL);
void tkCopyString(const char *key, char *dest, int len);
void ChkCom();
bool TestCom();
void ChkBraceOpn();
bool TestBraceOpn();
void ChkBraceCls();
bool TestBraceCls();
};
#endif //__SC_MAN_H__