From ba5e7d419c73b82b95f70ef86fb9d685dd036738 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 21 Apr 2021 00:49:26 +0200 Subject: [PATCH] - cleaned up the remains of the old def parser. --- source/CMakeLists.txt | 2 +- source/build/include/scriptfile.h | 124 -------------------- source/build/src/defs.cpp | 10 -- source/core/{parsefuncs.h => defparser.cpp} | 0 4 files changed, 1 insertion(+), 135 deletions(-) delete mode 100644 source/build/include/scriptfile.h delete mode 100644 source/build/src/defs.cpp rename source/core/{parsefuncs.h => defparser.cpp} (100%) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 20f6710ae..6b9a94144 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -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 diff --git a/source/build/include/scriptfile.h b/source/build/include/scriptfile.h deleted file mode 100644 index 8799759ee..000000000 --- a/source/build/include/scriptfile.h +++ /dev/null @@ -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 diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp deleted file mode 100644 index ce54fc1df..000000000 --- a/source/build/src/defs.cpp +++ /dev/null @@ -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" - - diff --git a/source/core/parsefuncs.h b/source/core/defparser.cpp similarity index 100% rename from source/core/parsefuncs.h rename to source/core/defparser.cpp