doing some deep debugging

This commit is contained in:
Ryan Ward 2019-02-25 11:19:23 -05:00
parent ac7118092a
commit 8a7baf793f
6 changed files with 40 additions and 52 deletions

View File

@ -27,9 +27,9 @@
<Keywords name="Keywords1">ENABLE DISABLE LOAD ENTRY USING VERSION as</Keywords>
<Keywords name="Keywords2">if then return and or True False</Keywords>
<Keywords name="Keywords3">leaking debugging warnings</Keywords>
<Keywords name="Keywords4">ceil tan CSIM log10 sinh GOTOE lshift deg MUL QUIT cosh exp rad GOTO SUB log ADD JUMP error POW randomseed floor tanh max atan SKIP acos DIV abs rshif COMPARE print atan2 asin cos sin mod sqrt function getInput sleep getVar setVar</Keywords>
<Keywords name="Keywords4">ceil tan CSIM log10 sinh GOTOE lshift deg MUL QUIT cosh exp rad GOTO SUB log ADD JUMP error POW randomseed floor tanh max atan SKIP acos DIV abs rshif COMPARE print atan2 asin cos sin mod sqrt function getInput sleep getVar setVar newThread</Keywords>
<Keywords name="Keywords5">_VERSION</Keywords>
<Keywords name="Keywords6"></Keywords>
<Keywords name="Keywords6">filesystem extendedDefine</Keywords>
<Keywords name="Keywords7"></Keywords>
<Keywords name="Keywords8"></Keywords>
<Keywords name="Delimiters">00:: 01 02:: 03$ 04 05$ 06&quot; 07 08&quot; 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
@ -44,7 +44,7 @@
<WordsStyle name="KEYWORDS3" fgColor="408080" bgColor="293134" fontName="Monospac821 BT" fontStyle="1" fontSize="12" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="5959AC" bgColor="293134" fontName="Monospac821 BT" fontStyle="1" fontSize="12" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="FF0080" bgColor="293134" fontName="Monospac821 BT" fontStyle="0" fontSize="12" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="149311" bgColor="293134" fontName="" fontStyle="1" fontSize="12" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="EAC195" bgColor="293134" fontName="Monospac821 BT" fontStyle="1" nesting="0" />

23
StoryTest/init.dms Normal file
View File

@ -0,0 +1,23 @@
ENTRY INIT
USING filesystem as bin
[INIT]{
size = bin.fileExist("data.dat")
if size!=True then JUMP("CREATEDATA")|JUMP("HASDATA")
}
[CREATEDATA]{
"We have no data! Let's create it!"
name = getInput("Please Enter your name: ")
file = bin.new()
file:addBlock(name,16) //Name
file:addBlock(100,4) //Money
file:addBlock("START",16) //Current Label
file:tofile("data.dat")
JUMP("HASDATA")
}
[HASDATA]{
file = bin.load("data.dat")
name = file:getBlock("s",16)
money = file:getBlock("n",4)
label = file:getBlock("s",16)
"Name: $name$ Money: $money$ Label: $label$"
}

View File

@ -0,0 +1 @@
Testing stuff

BIN
data.dat Normal file

Binary file not shown.

View File

@ -2,24 +2,23 @@ package.path="?/init.lua;lua/?/init.lua;lua/?.lua;"..package.path
local bin = require("bin")
local multi = require("multi")
require("parseManager")
require("bit")
test=parseManager:load("test.dms")
test=parseManager:load("StoryTest/init.dms")
print(test:dump())
--Code would happen here anyway
local runner = function(block,t)
if not t then return nil end
t=test:next()
while t do
if t.Type=="text" then
io.write(t.text)
io.read()
t=self:next()
t=test:next()
elseif t.Type=="condition" then
t=self:next()
t=test:next()
elseif t.Type=="assignment" then
t=self:next()
t=test:next()
elseif t.Type=="label" then
t=self:next()
t=test:next()
elseif t.Type=="method" then
t=self:next()
t=test:next()
elseif t.Type=="choice" then
print(t.text)
for i=1,#t.choices do
@ -27,52 +26,16 @@ local runner = function(block,t)
end
io.write("Choose#: ")
cm=tonumber(io.read())
t=self:next(nil,cm,nil,t)
t=test:next(nil,cm,nil,t)
elseif t.Type=="end" then
if t.text=="leaking" then -- go directly to the block right under the current block if it exists
t=self:next()
t=test:next()
else
os.exit()
end
elseif t.Type=="error" then
error(t.text)
else
t=self:next()
t=test:next()
end
return t
end
test.mainRunner = runner
test.active = false
multi:newThread("Parse Manager Main State",function()
local dat = self:mainRunner(nil,self:next())
while dat do
thread.skip()
dat = self:mainRunner(nil,dat)
end
end)
function test:run()
multi:mainloop()
end
test:define{
sleep = function(self,n)
thread.sleep(n)
end,
newLightThread = function(self,block)
local state = parseManager:load(self.currentChunk.path)
state.mainENV = self.mainENV
state.mainRunner = runner
multi:newThread("Parse Manager State",function()
local dat = state:mainRunner(nil,state:next())
while dat do
thread.skip()
dat = state:mainRunner(nil,dat)
end
end)
end
}
--End of injecting
--~ test:run()
multi:newThread("",function()
print("Threading works")
end)
multi:mainloop()

View File

@ -13,7 +13,8 @@ ENTRY MAIN
in = getInput("Enter Something: ")
file = bin.new(in)
file:tofile("WeCanWriteEm.txt")
test(1,2)
tt = test(1,2)
"Test: $tt$"
"We are here now"
"why no work"
"?"