- hooked up the compiler extension and the static actor data setup.

This commit is contained in:
Christoph Oelckers 2022-01-23 10:38:23 +01:00
parent 0398ba4ff0
commit e035ce00b6
4 changed files with 10 additions and 11 deletions

View file

@ -272,4 +272,4 @@ struct AFuncDesc;
struct FieldDesc;
AFuncDesc *FindFunction(PContainerType *cls, const char * string);
FieldDesc *FindField(PContainerType *cls, const char * string);
void SetImplicitArgs(TArray<PType*>* args, TArray<uint32_t>* argflags, TArray<FName>* argnames, PContainerType* cls, uint32_t funcflags, int useflags);
//void SetImplicitArgs(TArray<PType*>* args, TArray<uint32_t>* argflags, TArray<FName>* argnames, PContainerType* cls, uint32_t funcflags, int useflags);

View file

@ -183,7 +183,7 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
if (part2 == NULL)
{ // Search all lists
int max = strict ? 2 : NUM_FLAG_LISTS;
int max = strict ? 1 : NUM_FLAG_LISTS;
for (int i = 0; i < max; ++i)
{
if ((FlagLists[i].Use & 1) && type->IsDescendantOf (*FlagLists[i].Type))

View file

@ -1,6 +1,8 @@
#pragma once
#include "zcc_compile.h"
class DCoreActor;
void SetImplicitArgs(TArray<PType*>* args, TArray<uint32_t>* argflags, TArray<FName>* argnames, PContainerType* cls, uint32_t funcflags, int useflags);
class ZCCRazeCompiler : public ZCCCompiler
@ -12,10 +14,6 @@ public:
int Compile() override;
protected:
bool PrepareMetaData(PClass *type) override;
void SetImplicitArgs(TArray<PType*>* args, TArray<uint32_t>* argflags, TArray<FName>* argnames, PContainerType* cls, uint32_t funcflags, int useflags) override
{
::SetImplicitArgs(args, argflags, argnames, cls, funcflags, useflags);
}
private:
void CompileAllProperties();
bool CompileProperties(PClass *type, TArray<ZCC_Property *> &Properties, FName prefix);
@ -25,7 +23,6 @@ private:
void ProcessDefaultProperty(PClassActor *cls, ZCC_PropertyStmt *prop, Baggage &bag);
void ProcessDefaultFlag(PClassActor *cls, ZCC_FlagStmt *flg);
void InitDefaults() override final;
int CheckActionKeyword(ZCC_FuncDeclarator *f, uint32_t &varflags, int useflags, ZCC_StructWork *c);
};

View file

@ -37,13 +37,14 @@
#include "filesystem.h"
#include "sc_man.h"
#include "zcc_parser.h"
#include "zcc_compile.h"
#include "zcc_compile_raze.h"
#include "codegen.h"
#include "stats.h"
#include "printf.h"
#include "dobject.h"
void InitImports();
void InitThingdef();
void SynthesizeFlagFields();
void ParseScripts()
{
@ -56,7 +57,7 @@ void ParseScripts()
auto newns = ParseOneScript(lump, state);
PSymbolTable symtable;
ZCCCompiler cc(state, NULL, symtable, newns, lump, state.ParseVersion);
ZCCRazeCompiler cc(state, NULL, symtable, newns, lump, state.ParseVersion);
cc.Compile();
if (FScriptPosition::ErrorCounter > 0)
@ -78,7 +79,7 @@ void LoadScripts()
cycle_t timer;
PType::StaticInit();
InitImports();
InitThingdef();
timer.Reset(); timer.Clock();
FScriptPosition::ResetErrorCounter();
@ -95,6 +96,7 @@ void LoadScripts()
timer.Unclock();
if (!batchrun) Printf("script parsing took %.2f ms\n", timer.TimeMS());
SynthesizeFlagFields();
// Now we may call the scripted OnDestroy method.
PClass::bVMOperational = true;