- cleaned up the remains of the old def parser.

This commit is contained in:
Christoph Oelckers 2021-04-21 00:49:26 +02:00
parent 1ea25e5d0e
commit ba5e7d419c
4 changed files with 1 additions and 135 deletions

View file

@ -1028,7 +1028,6 @@ set (PCH_SOURCES
# Todo: Split out the license-safe code from this.
build/src/clip.cpp
build/src/defs.cpp
build/src/engine.cpp
build/src/mdsprite.cpp
build/src/polymost.cpp
@ -1072,6 +1071,7 @@ set (PCH_SOURCES
core/zcompile.cpp
core/statusbar2.cpp
core/gi.cpp
core/defparser.cpp
core/nodebuilder/nodebuild.cpp
core/nodebuilder/nodebuild_classify_nosse2.cpp

View file

@ -1,124 +0,0 @@
#ifndef BUILD_SCRIPTFILE_H_
#define BUILD_SCRIPTFILE_H_
#include "sc_man.h"
#include "filesystem.h"
using scriptfile = FScanner;
inline int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num)
{
bool res = sf->GetNumber();
if (num)
{
if (res) *num = sf->Number;
else *num = 0;
}
return !res;
}
inline int32_t scriptfile_getdouble(scriptfile *sf, double *num)
{
bool res = sf->GetFloat();
if (num)
{
if (res) *num = sf->Float;
else *num = 0;
}
return !res;
}
inline int32_t scriptfile_getstring(scriptfile *sf, FString *st)
{
bool res = sf->GetString();
if (st)
{
if (res) *st = sf->String;
else *st = "";
}
return !res;
}
inline int32_t scriptfile_getsymbol(scriptfile *sf, int32_t *num)
{
bool res = sf->GetNumber(true);
if (num)
{
if (res) *num = sf->Number;
else *num = 0;
}
return !res;
}
inline int32_t scriptfile_getsymbol(scriptfile* sf, int64_t* num)
{
bool res = sf->GetNumber(true);
if (num)
{
if (res) *num = sf->BigNumber;
else *num = 0;
}
return !res;
}
inline FScriptPosition scriptfile_getposition(scriptfile *sf)
{
return FScriptPosition(*sf);
}
inline int32_t scriptfile_getbraces(scriptfile *sf, FScanner::SavedPos *braceend)
{
if (sf->CheckString("{"))
{
auto here = sf->SavePos();
sf->SkipToEndOfBlock();
*braceend = sf->SavePos();
sf->RestorePos(here);
return 0;
}
else
{
sf->ScriptError("'{' expected");
return -1;
}
}
inline bool scriptfile_endofblock(scriptfile* sf, FScanner::SavedPos& braceend)
{
auto here = sf->SavePos();
return here.SavedScriptPtr >= braceend.SavedScriptPtr;
}
inline void scriptfile_setposition(scriptfile* sf, const FScanner::SavedPos& pos)
{
sf->RestorePos(pos);
}
inline scriptfile *scriptfile_fromfile(const char *fn)
{
int lump = fileSystem.FindFile(fn);
if (lump < 0) return nullptr;
auto sc = new FScanner;
sc->OpenLumpNum(lump);
sc->SetNoOctals(true);
sc->SetNoFatalErrors(true);
return sc;
}
inline void scriptfile_close(scriptfile *sf)
{
delete sf;
}
enum
{
T_EOF = -2,
T_ERROR = -1,
};
#endif

View file

@ -1,10 +0,0 @@
/*
* Definitions file parser for Build
* by Jonathon Fowler (jf@jonof.id.au)
* Remixed substantially by Ken Silverman
* See the included license file "BUILDLIC.TXT" for license info.
*/
#include "parsefuncs.h"