Skip to content

Commit

Permalink
MiniScript: some more Library support
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Dec 19, 2023
1 parent 9597e51 commit 7540020
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/MiniScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ const string MiniScript::Variable::TYPENAME_SET = "Set";

const vector<string> MiniScript::Method::CONTEXTFUNCTIONS_ALL = {};

const string MiniScript::getBaseClassHeader() {
return "miniscript/miniscript/MiniScript.h";
}

const string MiniScript::getBaseClass() {
return "miniscript::miniscript::MiniScript";
Expand Down
5 changes: 5 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/MiniScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,11 @@ class miniscript::miniscript::MiniScript {
*/
virtual ~MiniScript();

/**
* @return base class header
*/
virtual const string getBaseClassHeader();

/**
* @return base class
*/
Expand Down
2 changes: 2 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/Transpiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ void Transpiler::transpile(MiniScript* miniScript, const string& transpilationFi
miniScriptCPPString = StringTools::replace(miniScriptCPPString, "{$script}", scriptFileName);
miniScriptCPPString = StringTools::replace(miniScriptCPPString, "{$class-name}", miniScriptClassName);
miniScriptCPPString = StringTools::replace(miniScriptCPPString, "{$base-class}", miniScript->getBaseClass());
miniScriptCPPString = StringTools::replace(miniScriptCPPString, "{$base-class-header}", miniScript->getBaseClassHeader());
miniScriptCPP = StringTools::tokenize(miniScriptCPPString, "\n", true);
} else {
FileSystem::getContentAsStringArray(FileSystem::getPathName(transpilationCPPFileName), FileSystem::getFileName(transpilationCPPFileName), miniScriptCPP);
Expand Down Expand Up @@ -628,6 +629,7 @@ void Transpiler::transpile(MiniScript* miniScript, const string& transpilationFi
miniScriptHeaderString = StringTools::replace(miniScriptHeaderString, "{$script}", scriptFileName);
miniScriptHeaderString = StringTools::replace(miniScriptHeaderString, "{$class-name}", miniScriptClassName);
miniScriptHeaderString = StringTools::replace(miniScriptHeaderString, "{$base-class}", miniScript->getBaseClass());
miniScriptHeaderString = StringTools::replace(miniScriptHeaderString, "{$base-class-header}", miniScript->getBaseClassHeader());
miniScriptClassHeader = StringTools::tokenize(miniScriptHeaderString, "\n", true);
} else {
FileSystem::getContentAsStringArray(FileSystem::getPathName(transpilationHeaderFileName), FileSystem::getFileName(transpilationHeaderFileName), miniScriptClassHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <miniscript/miniscript.h>
#include <miniscript/miniscript/MiniScript.h>

#include <{$base-class-header}>

/*__MINISCRIPT_TRANSPILEDMINISCRIPTCODE_INCLUDES_START__*/
/*__MINISCRIPT_TRANSPILEDMINISCRIPTCODE_INCLUDES_END__*/

Expand Down
2 changes: 2 additions & 0 deletions resources/miniscript/templates/transpilation/Transpilation.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <miniscript/miniscript.h>
#include <miniscript/miniscript/MiniScript.h>

#include <{$base-class-header}>

/**
* MiniScript -> C++ transpilation of {$script}
*/
Expand Down
4 changes: 4 additions & 0 deletions src/tdme/engine/logics/LogicMiniScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ LogicMiniScript::LogicMiniScript(): EngineMiniScript(), prototypesToAddMutex("pr
LogicMiniScript::~LogicMiniScript() {
}

const string LogicMiniScript::getBaseClassHeader() {
return "tdme/engine/logics/LogicMiniScript.h";
}

const string LogicMiniScript::getBaseClass() {
return "tdme::engine::logics::LogicMiniScript";
}
Expand Down
1 change: 1 addition & 0 deletions src/tdme/engine/logics/LogicMiniScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class tdme::engine::logics::LogicMiniScript: public EngineMiniScript {
virtual ~LogicMiniScript();

// overridden methods
const string getBaseClassHeader();
const string getBaseClass();
const vector<string> getTranspilationUnits();
void registerStateMachineStates() override;
Expand Down
4 changes: 4 additions & 0 deletions src/tdme/gui/scripting/GUIMiniScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ GUIMiniScript::GUIMiniScript(GUIScreenNode* screenNode): EngineMiniScript(), scr
GUIMiniScript::~GUIMiniScript() {
}

const string GUIMiniScript::getBaseClassHeader() {
return "tdme/gui/scripting/GUIMiniScript.h";
}

const string GUIMiniScript::getBaseClass() {
return "tdme::gui::scripting::GUIMiniScript";
}
Expand Down
1 change: 1 addition & 0 deletions src/tdme/gui/scripting/GUIMiniScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class tdme::gui::scripting::GUIMiniScript: public EngineMiniScript {
virtual ~GUIMiniScript();

// overridden methods
const string getBaseClassHeader();
const string getBaseClass();
const vector<string> getTranspilationUnits();
void registerStateMachineStates() override;
Expand Down

0 comments on commit 7540020

Please sign in to comment.