Skip to content

Commit

Permalink
- hooked up the compiler extension and the static actor data setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jan 23, 2022
1 parent 0398ba4 commit e035ce0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion source/common/scripting/core/symbols.h
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion source/core/thingdef_data.cpp
Expand Up @@ -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))
Expand Down
7 changes: 2 additions & 5 deletions source/core/zcc_compile_raze.h
@@ -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
Expand All @@ -12,10 +14,6 @@ class ZCCRazeCompiler : public ZCCCompiler
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);
Expand All @@ -25,7 +23,6 @@ class ZCCRazeCompiler : public ZCCCompiler
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);

};

Expand Down
10 changes: 6 additions & 4 deletions source/core/zcompile.cpp
Expand Up @@ -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()
{
Expand All @@ -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)
Expand All @@ -78,7 +79,7 @@ void LoadScripts()
cycle_t timer;

PType::StaticInit();
InitImports();
InitThingdef();
timer.Reset(); timer.Clock();
FScriptPosition::ResetErrorCounter();

Expand All @@ -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;
Expand Down

0 comments on commit e035ce0

Please sign in to comment.