Working on the library side of things
This commit is contained in:
parent
ef9895de56
commit
0095bd9ecc
13
DMS.sln
13
DMS.sln
@ -5,6 +5,11 @@ VisualStudioVersion = 16.0.30320.27
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DMS", "DMS\DMS.vcxproj", "{0ECF46C1-EB08-4F8E-8ACB-002E38BFC1FA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DMS_DLL", "DMS_DLL\DMS_DLL.vcxproj", "{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0ECF46C1-EB08-4F8E-8ACB-002E38BFC1FA} = {0ECF46C1-EB08-4F8E-8ACB-002E38BFC1FA}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@ -21,6 +26,14 @@ Global
|
||||
{0ECF46C1-EB08-4F8E-8ACB-002E38BFC1FA}.Release|x64.Build.0 = Release|x64
|
||||
{0ECF46C1-EB08-4F8E-8ACB-002E38BFC1FA}.Release|x86.ActiveCfg = Release|Win32
|
||||
{0ECF46C1-EB08-4F8E-8ACB-002E38BFC1FA}.Release|x86.Build.0 = Release|Win32
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Debug|x64.Build.0 = Debug|x64
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Debug|x86.Build.0 = Debug|Win32
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Release|x64.ActiveCfg = Release|x64
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Release|x64.Build.0 = Release|x64
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{B9978D79-836D-4A4D-9BFE-4EDE7B1BAF9F}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
39
DMS/DMS.cpp
39
DMS/DMS.cpp
@ -4,19 +4,46 @@
|
||||
#include "pch.h"
|
||||
#include "dms.h"
|
||||
#include "actors.h"
|
||||
#include <Windows.h>
|
||||
|
||||
typedef int(__cdecl* MYPROC)(int);
|
||||
using namespace dms;
|
||||
int main()
|
||||
{
|
||||
//HINSTANCE hinstLib;
|
||||
//MYPROC ProcAdd;
|
||||
//BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
|
||||
//hinstLib = LoadLibrary(TEXT("Test.dll"));
|
||||
|
||||
//if (hinstLib != NULL) {
|
||||
// ProcAdd = (MYPROC)GetProcAddress(hinstLib, "Init");
|
||||
|
||||
// // If the function address is valid, call the function.
|
||||
|
||||
// if (NULL != ProcAdd)
|
||||
// {
|
||||
// fRunTimeLinkSuccess = TRUE;
|
||||
// (ProcAdd)(100);
|
||||
// }
|
||||
// // Free the DLL module.
|
||||
|
||||
// fFreeResult = FreeLibrary(hinstLib);
|
||||
//}
|
||||
//exit(0);
|
||||
// TODO fix disp cmd to handle the standard
|
||||
|
||||
multi::runner run;
|
||||
|
||||
LineParser parser = LineParser("test.dms");
|
||||
dms_state* state = parser.Parse();
|
||||
dms_state* state = new dms_state();
|
||||
state->OnCustomBlock += [](customBlock* cb) {
|
||||
std::cout << "Block Type: " << cb->type << std::endl;
|
||||
std::cout << "Stringed Block: " << cb->toks->toString() << std::endl;
|
||||
};
|
||||
LineParser parser;
|
||||
state = parser.Parse(state,"test.dms");
|
||||
// Load audio stuff
|
||||
dms::audio::init(state);
|
||||
state->dump();
|
||||
|
||||
memory* mem = state->getMem();
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(1024, 768, 32), "Background Test");
|
||||
@ -53,10 +80,12 @@ int main()
|
||||
////std::cout << test << std::endl;
|
||||
|
||||
state->OnText += [&](dms::message msg) {
|
||||
text.setString(dms::utils::concat(msg.chara->getName(),": ",msg.text));
|
||||
std::cout << dms::utils::concat(msg.chara->getName(), ": ", msg.text) << std::endl;
|
||||
//text.setString(dms::utils::concat(msg.chara->getName(),": ",msg.text));
|
||||
};
|
||||
state->OnAppendText += [&](dms::message msg) {
|
||||
text.setString(dms::utils::concat(text.getString().toAnsiString(), msg.text));
|
||||
std::cout << dms::utils::concat(text.getString().toAnsiString(), msg.text) << std::endl;
|
||||
//text.setString(dms::utils::concat(text.getString().toAnsiString(), msg.text));
|
||||
};
|
||||
|
||||
sf::RectangleShape rectangle;
|
||||
|
||||
@ -216,11 +216,9 @@
|
||||
<ClInclude Include="multibase.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="sound.h" />
|
||||
<ClInclude Include="s_value.h" />
|
||||
<ClInclude Include="token.h" />
|
||||
<ClInclude Include="utils.h" />
|
||||
<ClInclude Include="value.h" />
|
||||
<ClInclude Include="wrapper.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
|
||||
@ -19,30 +19,9 @@
|
||||
<Filter Include="Source Files\DMS">
|
||||
<UniqueIdentifier>{e3410a7b-6408-4022-b606-2c14cfaac52c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\DMS\C-API">
|
||||
<UniqueIdentifier>{f71964f6-66b3-4d8c-a8da-56d703ad1c2a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DMS\C-API">
|
||||
<UniqueIdentifier>{32abbbfd-6359-488c-83be-f61da8fd8f4d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DMS\standardMethods">
|
||||
<UniqueIdentifier>{10d9f698-b08c-40c5-b6b1-e6d903f4b279}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\DMS\standardMethods">
|
||||
<UniqueIdentifier>{4757b859-2680-4c9a-83e8-be3bf06f192e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DMS\parser">
|
||||
<UniqueIdentifier>{be440a96-7b07-48b3-a84e-64b10775c979}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DMS\state">
|
||||
<UniqueIdentifier>{9490aa5b-7d9d-415c-a263-ef1ecd8dd188}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DMS\objects">
|
||||
<UniqueIdentifier>{4c0bb4c5-388c-4f15-abb7-143cb6d6232f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\DMS\objects">
|
||||
<UniqueIdentifier>{978b41cd-27e4-4b8c-874e-3b6e927b3d4d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\DMS\platformdep">
|
||||
<UniqueIdentifier>{ef57bfaf-35f9-4b3e-8642-7ee96fb82139}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -55,12 +34,12 @@
|
||||
<Filter Include="Source Files\multi">
|
||||
<UniqueIdentifier>{f3de0fc4-d3ed-4241-9432-4b9136f0b672}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\DMS\gui">
|
||||
<UniqueIdentifier>{8b07822b-59fb-4826-89ce-7481977f640b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\gui">
|
||||
<UniqueIdentifier>{490b48c7-06fe-4e6f-9b95-93a0b01a963c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\gui">
|
||||
<UniqueIdentifier>{8b07822b-59fb-4826-89ce-7481977f640b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="cmd.cpp">
|
||||
@ -87,21 +66,12 @@
|
||||
<ClCompile Include="Handlers.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="character.cpp">
|
||||
<Filter>Source Files\DMS\objects</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="enviroment.cpp">
|
||||
<Filter>Source Files\DMS\objects</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dms_custom.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="memory.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core.cpp">
|
||||
<Filter>Source Files\DMS\standardMethods</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LineParserBuilds.cpp">
|
||||
<Filter>Source Files\DMS\parser</Filter>
|
||||
</ClCompile>
|
||||
@ -114,15 +84,6 @@
|
||||
<ClCompile Include="LineParserUtils.cpp">
|
||||
<Filter>Source Files\DMS\parser</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dms_state.cpp">
|
||||
<Filter>Source Files\DMS\state</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dms_state_interpret.cpp">
|
||||
<Filter>Source Files\DMS\state</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Invoker.cpp">
|
||||
<Filter>Source Files\DMS\objects</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
@ -135,6 +96,24 @@
|
||||
<ClCompile Include="guiimpl.cpp">
|
||||
<Filter>Source Files\gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="character.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="enviroment.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Invoker.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dms_state.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dms_state_interpret.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core.cpp">
|
||||
<Filter>Source Files\DMS</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="value.h">
|
||||
@ -173,12 +152,6 @@
|
||||
<ClInclude Include="Handlers.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="character.h">
|
||||
<Filter>Header Files\DMS\objects</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="enviroment.h">
|
||||
<Filter>Header Files\DMS\objects</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="memory.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
@ -188,18 +161,6 @@
|
||||
<ClInclude Include="comparisons.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wrapper.h">
|
||||
<Filter>Header Files\DMS\C-API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Invoker.h">
|
||||
<Filter>Header Files\DMS\objects</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core.h">
|
||||
<Filter>Header Files\DMS\standardMethods</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="s_value.h">
|
||||
<Filter>Header Files\DMS\C-API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
@ -216,7 +177,19 @@
|
||||
<Filter>Header Files\multi</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gui.h">
|
||||
<Filter>Header Files\DMS\gui</Filter>
|
||||
<Filter>Header Files\gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="character.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="enviroment.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Invoker.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core.h">
|
||||
<Filter>Header Files\DMS</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -63,6 +63,8 @@ namespace dms {
|
||||
void _Parse(tokenstream* stream);
|
||||
bool ParseLoop(tokenstream* stream, size_t count=0);
|
||||
std::stack<std::string> lastCall;
|
||||
// Block Handling Code
|
||||
bool match_process_blocks(tokenstream* stream);
|
||||
// Match Process Code
|
||||
bool match_process_debug(tokenstream* stream);
|
||||
bool match_process_disp(tokenstream* stream);
|
||||
|
||||
@ -4,6 +4,97 @@ using namespace dms::tokens;
|
||||
using namespace dms::utils;
|
||||
// TODO: process if elseif else statements, for loops and while loops
|
||||
namespace dms {
|
||||
bool LineParser::match_process_blocks(tokenstream* stream) {
|
||||
if (stream->match(tokens::bracketo, tokens::name, tokens::bracketc, tokens::newline)) {
|
||||
stream->next();
|
||||
std::string name = stream->next().name;
|
||||
createBlock(name, bt_block);
|
||||
line = stream->next().line_num; // Consume
|
||||
return true;
|
||||
}
|
||||
// This handles a few block types since they all follow a similar format
|
||||
else if (stream->match(tokens::bracketo, tokens::name, tokens::colon, tokens::name, tokens::bracketc)) {
|
||||
stream->next();
|
||||
std::string name = stream->next().name;
|
||||
line = stream->next().line_num;
|
||||
std::string temp = stream->next().name;
|
||||
// Characters are a feature I want to have intergrated into the language
|
||||
if (temp == "char") {
|
||||
createBlock(name, bt_character);
|
||||
}
|
||||
// Enviroments are sortof like objects, they can be uses as an object. They are a cleaner way to build a hash map like object
|
||||
else if (temp == "env") {
|
||||
createBlock(name, bt_env);
|
||||
}
|
||||
// Menus are what they say on the tin. They provide the framework for having menus within your game
|
||||
else if (temp == "menu") {
|
||||
createBlock(name, bt_menu);
|
||||
}
|
||||
else {
|
||||
std::vector<token>* toks = new std::vector<token>;
|
||||
while (!match_process_blocks(stream) && stream->peek().type != tokens::eof && stream->peek().type != tokens::none) {
|
||||
toks->push_back(stream->next());
|
||||
}
|
||||
tokenstream* ts = new tokenstream(toks);
|
||||
customBlock* cb = new customBlock(temp,ts);
|
||||
state->OnCustomBlock.fire(cb);
|
||||
}
|
||||
stream->next();
|
||||
return true;
|
||||
}
|
||||
// Function block type
|
||||
else if (stream->match(tokens::bracketo, tokens::name, tokens::colon, tokens::name, tokens::parao)) {
|
||||
std::stringstream str;
|
||||
stream->next();
|
||||
std::string name = stream->next().name;
|
||||
line = stream->next().line_num; // The color, not needed after the inital match, but we still need to consume it
|
||||
std::string b = stream->next().name;
|
||||
if (b == "function") {
|
||||
createBlock(name, bt_method); // We have a method let's set the block type to that, but we aren't done yet
|
||||
// We need to set the params if any so the method can be supplied with arguments
|
||||
stream->next(); // parao
|
||||
std::vector<token> tokens = stream->next(tokens::parac); // Consume until we see parac
|
||||
dms_args args;
|
||||
for (size_t i = 0; i < tokens.size() - 1; i++) {//The lase symbol is parac since that was the consume condition
|
||||
if (tokens[i].type == tokens::name) {
|
||||
// We got a name which is refering to a variable so lets build one
|
||||
value v(tokens[i].name, datatypes::variable);
|
||||
args.push(v);
|
||||
}
|
||||
else if (tokens[i].type == tokens::seperator) {
|
||||
// We just ignore this
|
||||
}
|
||||
else {
|
||||
std::stringstream str;
|
||||
str << "Unexpected symbol: " << tokens[i];
|
||||
state->push_error(errors::error{ errors::badtoken,str.str(),true,line,current_chunk });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// If all went well the 'args' now has all of tha params for the method we will be working with
|
||||
current_chunk->params = args;
|
||||
for (size_t i = 0; i < args.size(); i++) {
|
||||
current_chunk->cmds.back()->args.push(args.args[i]);
|
||||
}
|
||||
|
||||
// Thats should be all we need to do
|
||||
if (stream->peek().type != tokens::bracketc) {
|
||||
state->push_error(errors::error{ errors::badtoken, "Incomplete function block declaration! Expected ']' to close the block!",true,line,current_chunk });
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
stream->next();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
str << "'function' keyword expected got " << b;
|
||||
state->push_error(errors::error{ errors::badtoken, str.str(),true,line,current_chunk });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool LineParser::match_process_standard(tokenstream* stream, value& v) {
|
||||
stream->chomp(newline);
|
||||
//utils::debug(stream->peek());
|
||||
|
||||
@ -415,84 +415,7 @@ namespace dms {
|
||||
}
|
||||
}
|
||||
// Default block
|
||||
if (stream->match(tokens::bracketo, tokens::name, tokens::bracketc, tokens::newline)) {
|
||||
stream->next();
|
||||
std::string name = stream->next().name;
|
||||
createBlock(name, bt_block);
|
||||
line = stream->next().line_num; // Consume
|
||||
}
|
||||
// This handles a few block types since they all follow a similar format
|
||||
else if (stream->match(tokens::bracketo, tokens::name, tokens::colon, tokens::name, tokens::bracketc)) {
|
||||
stream->next();
|
||||
std::string name = stream->next().name;
|
||||
line = stream->next().line_num;
|
||||
std::string temp = stream->next().name;
|
||||
// Characters are a feature I want to have intergrated into the language
|
||||
if (temp == "char") {
|
||||
createBlock(name, bt_character);
|
||||
}
|
||||
// Enviroments are sortof like objects, they can be uses as an object. They are a cleaner way to build a hash map like object
|
||||
else if (temp == "env") {
|
||||
createBlock(name, bt_env);
|
||||
}
|
||||
// Menus are what they say on the tin. They provide the framework for having menus within your game
|
||||
else if (temp == "menu") {
|
||||
createBlock(name, bt_menu);
|
||||
}
|
||||
stream->next();
|
||||
}
|
||||
// Function block type
|
||||
else if (stream->match(tokens::bracketo, tokens::name, tokens::colon, tokens::name, tokens::parao)) {
|
||||
std::stringstream str;
|
||||
stream->next();
|
||||
std::string name = stream->next().name;
|
||||
line = stream->next().line_num; // The color, not needed after the inital match, but we still need to consume it
|
||||
std::string b = stream->next().name;
|
||||
if (b == "function") {
|
||||
createBlock(name, bt_method); // We have a method let's set the block type to that, but we aren't done yet
|
||||
// We need to set the params if any so the method can be supplied with arguments
|
||||
stream->next(); // parao
|
||||
std::vector<token> tokens = stream->next(tokens::parac); // Consume until we see parac
|
||||
dms_args args;
|
||||
for (size_t i = 0; i < tokens.size() - 1; i++) {//The lase symbol is parac since that was the consume condition
|
||||
if (tokens[i].type == tokens::name) {
|
||||
// We got a name which is refering to a variable so lets build one
|
||||
value v(tokens[i].name, datatypes::variable);
|
||||
args.push(v);
|
||||
}
|
||||
else if (tokens[i].type == tokens::seperator) {
|
||||
// We just ignore this
|
||||
}
|
||||
else {
|
||||
std::stringstream str;
|
||||
str << "Unexpected symbol: " << tokens[i];
|
||||
state->push_error(errors::error{ errors::badtoken,str.str(),true,line,current_chunk });
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// If all went well the 'args' now has all of tha params for the method we will be working with
|
||||
current_chunk->params = args;
|
||||
for (size_t i = 0; i < args.size(); i++) {
|
||||
current_chunk->cmds.back()->args.push(args.args[i]);
|
||||
}
|
||||
|
||||
// Thats should be all we need to do
|
||||
if (stream->peek().type != tokens::bracketc) {
|
||||
state->push_error(errors::error{ errors::badtoken, "Incomplete function block declaration! Expected ']' to close the block!",true,line,current_chunk });
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
stream->next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
str << "'function' keyword expected got " << b;
|
||||
state->push_error(errors::error{ errors::badtoken, str.str(),true,line,current_chunk });
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
match_process_blocks(stream);
|
||||
// Control Handle all controls here
|
||||
manageCount(match_process_choice(stream), count, current_count);
|
||||
manageCount(match_process_while(stream), count, current_count);
|
||||
|
||||
@ -28,6 +28,7 @@ namespace dms {
|
||||
void init(dms_state* state) {
|
||||
state->invoker.registerFunction("print", print);
|
||||
state->invoker.registerFunction("type", type);
|
||||
//state->invoker.registerFunction("concat", concat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,10 +11,22 @@
|
||||
#include "comparisons.h"
|
||||
#include "Connection.h"
|
||||
namespace dms {
|
||||
struct tokenstream;
|
||||
struct customBlock {
|
||||
dms::chunk* chnk;
|
||||
std::string type;
|
||||
dms::tokenstream* toks;
|
||||
customBlock(std::string s, dms::tokenstream* ts) {
|
||||
type = s;
|
||||
toks = ts;
|
||||
}
|
||||
};
|
||||
|
||||
struct message {
|
||||
character* chara;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
struct statedata {
|
||||
codes::op code;
|
||||
cmd* c = nullptr;
|
||||
@ -25,6 +37,7 @@ namespace dms {
|
||||
size_t ln = 0;
|
||||
std::string temp;
|
||||
};
|
||||
|
||||
struct Handler;
|
||||
value blockInvoke(void*, dms_state*, dms_args*);
|
||||
struct dms_state
|
||||
@ -97,6 +110,7 @@ namespace dms {
|
||||
multi::connection<message> OnText;
|
||||
multi::connection<message> OnAppendText;
|
||||
multi::connection<dms_state*> HandleHalt;
|
||||
multi::connection<customBlock*> OnCustomBlock;
|
||||
private:
|
||||
// From what I gathered
|
||||
//std::mutex memory_mutex;
|
||||
|
||||
BIN
DMS/dump.bin
BIN
DMS/dump.bin
Binary file not shown.
3263
DMS/dump.txt
3263
DMS/dump.txt
File diff suppressed because it is too large
Load Diff
@ -4,15 +4,9 @@
|
||||
#include "memory.h"
|
||||
#include "Invoker.h"
|
||||
namespace dms {
|
||||
enum class env_type {
|
||||
env,
|
||||
character,
|
||||
function
|
||||
};
|
||||
struct enviroment : Invoker {
|
||||
std::string name = "";
|
||||
memory values;
|
||||
env_type type = env_type::env;
|
||||
bool has(std::string index);
|
||||
void set(std::string index, value val);
|
||||
value get(std::string index);
|
||||
|
||||
@ -58,6 +58,12 @@ namespace dms::audio {
|
||||
return "stopped";
|
||||
}
|
||||
}
|
||||
value isPlaying(void* self, dms_state* state, dms_args* args) {
|
||||
return ((sf::Music*)self)->getStatus() == sf::Music::Status::Playing;
|
||||
}
|
||||
value isPaused(void* self, dms_state* state, dms_args* args) {
|
||||
return ((sf::Music*)self)->getStatus() == sf::Music::Status::Paused;
|
||||
}
|
||||
// The customtype will be "sound"
|
||||
// We need to assoiate the sound type with an invoker so the interperter knows how to handle it
|
||||
|
||||
@ -72,19 +78,18 @@ namespace dms::audio {
|
||||
inv->registerFunction("setPitch", setPitch);
|
||||
inv->registerFunction("setVolume", setVolume);
|
||||
inv->registerFunction("getStatus", getStatus);
|
||||
inv->registerFunction("isPlaying", isPlaying);
|
||||
inv->registerFunction("isPaused", isPaused);
|
||||
|
||||
auto* env = new enviroment;
|
||||
env->registerFunction("loadMusic", loadMusic);
|
||||
state->assoiateType("audiostream",inv);
|
||||
state->injectEnv("audio",env);
|
||||
|
||||
//state->invoker.registerFunction("loadMusic", loadMusic);
|
||||
}
|
||||
|
||||
value loadMusic(void* self, dms_state* state, dms_args* args)
|
||||
{
|
||||
if (args->size() || args->args[0].resolve(state).type == datatypes::string) {
|
||||
|
||||
sf::Music* music = new sf::Music;
|
||||
if (!music->openFromFile(args->args[0].getString())) {
|
||||
return value("Cannot open audio stream!", datatypes::error);
|
||||
|
||||
67
DMS/test.dms
67
DMS/test.dms
@ -17,69 +17,12 @@ music = audio.loadMusic("test.ogg")
|
||||
|
||||
[main]
|
||||
// Let's extend the base feature set
|
||||
music2.play()
|
||||
music2.setVolume(50)
|
||||
Ryan: "Hello how are you?"
|
||||
Bob: "Slot 3 = " + testINV["slot3"]
|
||||
music.play()
|
||||
while(music.isPlaying()){}
|
||||
|
||||
//print("Sound finished!")
|
||||
wait 5
|
||||
setBG("background2.jpg")
|
||||
|
||||
Ryan: "Hello how are you?"
|
||||
wait 3
|
||||
Bob: "I'm good how are you?"
|
||||
wait 3
|
||||
Ryan: "I am great :D"
|
||||
|
||||
a=0
|
||||
// {} Still errors out, this needs to be fixed!!!
|
||||
while(music2.getStatus()!="stopped"){}
|
||||
// a = 0
|
||||
// while (true){
|
||||
// asm {
|
||||
// add %a %a 1
|
||||
// add %p "a = " %a
|
||||
// func %print nil %p
|
||||
// }
|
||||
// a = a + 1
|
||||
// print("a = " + a)
|
||||
// }
|
||||
// while(true){
|
||||
// song = SelectSong()
|
||||
// player(song)
|
||||
// }
|
||||
|
||||
[SelectSong:function()]
|
||||
choice "Pick song:" {
|
||||
"Music 1" {
|
||||
return music
|
||||
}
|
||||
"Music 2" {
|
||||
return music2
|
||||
}
|
||||
}
|
||||
|
||||
[player:function(song,food)]
|
||||
choice "What you wanna do?" {
|
||||
"play/resume" {
|
||||
song.play()
|
||||
player(song)
|
||||
}
|
||||
"pause" {
|
||||
song.pause()
|
||||
player(song)
|
||||
}
|
||||
"stop" {
|
||||
song.stop()
|
||||
player(song)
|
||||
}
|
||||
"newSong" {
|
||||
song.stop()
|
||||
player(song)
|
||||
}
|
||||
"quit" exit 0
|
||||
}
|
||||
[testblock:metest]
|
||||
"Hello World"
|
||||
a = 10
|
||||
|
||||
[Ryan:char]
|
||||
age = 21
|
||||
|
||||
178
DMS_DLL/DMS_DLL.vcxproj
Normal file
178
DMS_DLL/DMS_DLL.vcxproj
Normal file
@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{b9978d79-836d-4a4d-9bfe-4ede7b1baf9f}</ProjectGuid>
|
||||
<RootNamespace>DMSDLL</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;DMSDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;DMSDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;DMSDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;DMSDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="dmsFunctions.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dmsFunctions.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DMS\DMS.vcxproj">
|
||||
<Project>{0ecf46c1-eb08-4f8e-8acb-002e38bfc1fa}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
39
DMS_DLL/DMS_DLL.vcxproj.filters
Normal file
39
DMS_DLL/DMS_DLL.vcxproj.filters
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dmsFunctions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dmsFunctions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
19
DMS_DLL/dllmain.cpp
Normal file
19
DMS_DLL/dllmain.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include "pch.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
2
DMS_DLL/dmsFunctions.cpp
Normal file
2
DMS_DLL/dmsFunctions.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "pch.h"
|
||||
#include "dmsFunctions.h"
|
||||
165
DMS_DLL/dmsFunctions.h
Normal file
165
DMS_DLL/dmsFunctions.h
Normal file
@ -0,0 +1,165 @@
|
||||
#pragma once
|
||||
extern "C" {
|
||||
typedef unsigned long int uint;
|
||||
// Define variables
|
||||
typedef void* DMS_STATE;
|
||||
typedef void* DMS_ENV;
|
||||
typedef void* DMS_CHAR;
|
||||
typedef void* DMS_CHUNK;
|
||||
typedef void* DMS_INVK;
|
||||
typedef void* DMS_MEM;
|
||||
typedef void* DMS_CONN;
|
||||
typedef void* DMS_MSG;
|
||||
struct DMS_VAL;
|
||||
typedef void* DMS_LIST;
|
||||
typedef void* DMS_BLOCK;
|
||||
typedef void* DMS_MEMSTACK;
|
||||
typedef void* DMS_STATSTACK;
|
||||
typedef void* DMS_STAT;
|
||||
typedef void* DMS_ARGS;
|
||||
typedef void* DMS_TOKENSTREAM;
|
||||
typedef uint DMS_TOKENTYPE;
|
||||
typedef uint DMS_OP;
|
||||
|
||||
struct DMS_CBLOCK {
|
||||
DMS_CHUNK chunk;
|
||||
const char* type;
|
||||
DMS_TOKENSTREAM toks;
|
||||
};
|
||||
|
||||
struct DMS_TOKEN {
|
||||
DMS_TOKENTYPE type;
|
||||
DMS_OP raw;
|
||||
const char* name;
|
||||
unsigned long long line_num = 0;
|
||||
};
|
||||
|
||||
struct DMS_CMD {
|
||||
uint opcode;
|
||||
DMS_ARGS args;
|
||||
};
|
||||
|
||||
struct DMS_LABEL {
|
||||
const char* label;
|
||||
uint pos;
|
||||
};
|
||||
|
||||
typedef void(*DMS_FUNC)(void*, DMS_STATE, DMS_ARGS);
|
||||
|
||||
// Code Execution
|
||||
DMS_STATE dms_loadFile(const char*);
|
||||
bool dms_loadFileB(DMS_STATE, const char*);
|
||||
DMS_STATE dms_loadString(const char*);
|
||||
bool dms_loadStringB(DMS_STATE, const char*);
|
||||
bool dms_loopState(DMS_STATE);
|
||||
bool dms_nextState(DMS_STATE);
|
||||
|
||||
// Token Handling
|
||||
DMS_TOKEN dms_next(DMS_TOKENSTREAM);
|
||||
DMS_TOKEN dms_prev(DMS_TOKENSTREAM);
|
||||
DMS_TOKEN dms_chomp(DMS_TOKENSTREAM, DMS_TOKEN);
|
||||
DMS_TOKEN* dms_nextBalanced(DMS_TOKENSTREAM,DMS_TOKEN, DMS_TOKEN);
|
||||
DMS_TOKEN* dms_nextBalancedNL(DMS_TOKENSTREAM, DMS_TOKEN, DMS_TOKEN,bool);
|
||||
DMS_TOKEN dms_peek(DMS_TOKENSTREAM);
|
||||
DMS_TOKEN dms_last(DMS_TOKENSTREAM);
|
||||
DMS_TOKEN dms_nextUntil(DMS_TOKENSTREAM,DMS_TOKEN);
|
||||
bool dms_can(DMS_TOKENSTREAM);
|
||||
bool dms_match(DMS_TOKENSTREAM, uint, DMS_TOKEN*);
|
||||
bool dms_hasScope(DMS_TOKENSTREAM, uint);
|
||||
|
||||
// Connection Handling
|
||||
int dms_connectText(DMS_CONN, void(*)(DMS_MSG));
|
||||
int dms_connectAppend(DMS_CONN, void(*)(DMS_MSG));
|
||||
int dms_connectHandleHalt(DMS_CONN, void(*)(DMS_STATE));
|
||||
int dms_connectCBlock(DMS_CONN, void(*)(DMS_CBLOCK));
|
||||
|
||||
// Message Handling
|
||||
DMS_CHAR dms_getCharacter(DMS_MSG);
|
||||
const char* dms_getText(DMS_MSG);
|
||||
|
||||
// Value Handling
|
||||
DMS_VAL* dms_getValue(DMS_STATE, const char*);
|
||||
uint dms_getType(DMS_VAL*);
|
||||
long long int dms_getInt(DMS_VAL*);
|
||||
double dms_getDouble(DMS_VAL*);
|
||||
bool dms_getBool(DMS_VAL*);
|
||||
bool dms_isNil(DMS_VAL*);
|
||||
DMS_ENV dms_getEnviroment(DMS_VAL*);
|
||||
const char* dms_getString(DMS_VAL*);
|
||||
DMS_BLOCK dms_getBlock(DMS_VAL*);
|
||||
DMS_LIST dms_getList(DMS_VAL*);
|
||||
// Value Creation
|
||||
DMS_VAL* dms_newInt(long long int);
|
||||
DMS_VAL* dms_newDouble(double);
|
||||
DMS_VAL* dms_newString(const char*);
|
||||
DMS_VAL* dms_newBool(bool);
|
||||
DMS_VAL* dms_newNIL();
|
||||
DMS_VAL* dms_newList(DMS_LIST);
|
||||
|
||||
// Custom Value Creation
|
||||
DMS_VAL* dms_newValue(DMS_STATE,void*,const char*);
|
||||
|
||||
// List Handling
|
||||
uint dms_getLength(DMS_LIST);
|
||||
DMS_VAL* dms_listGet(DMS_LIST, uint);
|
||||
void dms_listSet(DMS_LIST, uint);
|
||||
// List Creation
|
||||
DMS_LIST dms_newList(uint, DMS_VAL**);
|
||||
|
||||
// Args Handling
|
||||
uint dms_getLength(DMS_ARGS);
|
||||
DMS_VAL* dms_getArg(DMS_ARGS, uint);
|
||||
void dms_pushArg(DMS_ARGS, DMS_VAL*);
|
||||
// Args Creation
|
||||
DMS_ARGS dms_newArgs();
|
||||
DMS_ARGS dms_newArgsN(uint);
|
||||
|
||||
// Invoker Handling
|
||||
bool dms_registerFunction(DMS_INVK,const char*, DMS_FUNC);
|
||||
bool dms_registerFunctionOverride(DMS_INVK, const char*, DMS_FUNC);
|
||||
DMS_VAL* dms_invokeA(DMS_INVK, const char*, DMS_STATE, DMS_ARGS);
|
||||
DMS_VAL* dms_invokeB(DMS_INVK, void* ref, const char*, DMS_STATE, DMS_ARGS);
|
||||
// Invoker Creation
|
||||
DMS_INVK dms_newInvoker();
|
||||
|
||||
// Enviroment Handling
|
||||
bool dms_registerEnvFunction(DMS_INVK, const char*, DMS_FUNC);
|
||||
bool dms_registerEnvFunctionOverride(DMS_INVK, const char*, DMS_FUNC);
|
||||
DMS_VAL* dms_env_InvokeA(DMS_INVK, const char*, DMS_STATE, DMS_ARGS);
|
||||
DMS_VAL* dms_env_InvokeB(DMS_INVK, void* ref, const char*, DMS_STATE, DMS_ARGS);
|
||||
DMS_VAL* dms_indexENV(const char*);
|
||||
void dms_setENV(const char*, DMS_VAL*);
|
||||
DMS_MEM dms_getEnvMem(DMS_ENV);
|
||||
void dms_setEnvMem(DMS_ENV, DMS_MEM);
|
||||
const char* dms_getEnvName(DMS_ENV);
|
||||
bool dms_envHas(DMS_ENV, const char*);
|
||||
void dms_envSet(DMS_ENV, const char*, DMS_VAL*);
|
||||
DMS_VAL* dms_envGet(DMS_ENV, const char*);
|
||||
// Enviroment Creation
|
||||
DMS_ENV dms_newEnviroment();
|
||||
|
||||
// Memory Handling
|
||||
uint dms_memCount(DMS_MEM, const char*);
|
||||
void dms_memErase(DMS_MEM, const char*);
|
||||
DMS_VAL* dms_memGet(DMS_MEM, const char*);
|
||||
void dms_memSet(DMS_MEM, const char*,DMS_VAL*);
|
||||
DMS_MEM dms_getParent(DMS_MEM);
|
||||
// Memory Creation
|
||||
DMS_MEM dms_newMemory();
|
||||
|
||||
// Chunk Handling
|
||||
uint dms_getChunkType(DMS_CHUNK);
|
||||
DMS_ARGS dms_getChunkParams(DMS_CHUNK);
|
||||
const char* dms_getChunkName(DMS_CHUNK);
|
||||
DMS_CMD* dms_getCmds(DMS_CHUNK);
|
||||
void dms_addLabel(DMS_CHUNK,const char*, DMS_LABEL);
|
||||
DMS_LABEL* dms_getLabels(DMS_CHUNK);
|
||||
void dms_setChunkType(DMS_CHUNK, uint);
|
||||
|
||||
// State Handling
|
||||
bool dms_assoiateType(DMS_STATE, const char*, DMS_INVK);
|
||||
bool dms_injectEnv(DMS_STATE, const char*, DMS_ENV);
|
||||
DMS_INVK dms_getStateInvoker(DMS_STATE);
|
||||
|
||||
}
|
||||
|
||||
5
DMS_DLL/framework.h
Normal file
5
DMS_DLL/framework.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
5
DMS_DLL/pch.cpp
Normal file
5
DMS_DLL/pch.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||
13
DMS_DLL/pch.h
Normal file
13
DMS_DLL/pch.h
Normal file
@ -0,0 +1,13 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
|
||||
#endif //PCH_H
|
||||
Loading…
x
Reference in New Issue
Block a user