組み込み関数呼び出しの修正,PRINTの解析の修正,PRINTにmutex使うようにした
This commit is contained in:
@@ -885,6 +885,6 @@ class CallBuiltinFunction : Code
|
||||
result = vm.stack[vm.stacki - argcount..vm.stacki - argcount + outcount];//雑;
|
||||
}
|
||||
func.func(vm.petitcomputer, arg, result);
|
||||
vm.stacki -= func.argments.length;
|
||||
vm.stacki -= func.argments.length - outcount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1055,7 +1055,7 @@ class Parser
|
||||
//3号から厳密になって必ずいる
|
||||
if(token.type == TokenType.Colon || token.type == TokenType.NewLine)
|
||||
{
|
||||
print.addLine();
|
||||
if(addline) print.addLine();
|
||||
break;
|
||||
}
|
||||
addline = true;
|
||||
@@ -1091,12 +1091,14 @@ class Parser
|
||||
if(token.type == TokenType.Semicolon)
|
||||
{
|
||||
addline = false;
|
||||
token = lex.front();
|
||||
continue;
|
||||
}
|
||||
if(token.type == TokenType.Comma)
|
||||
{
|
||||
print.addTab();
|
||||
addline = false;
|
||||
token = lex.front();
|
||||
continue;
|
||||
}
|
||||
token = lex.front();
|
||||
|
||||
@@ -7,6 +7,7 @@ import std.stdio;
|
||||
import std.conv;
|
||||
import std.string;
|
||||
import std.c.stdio;
|
||||
import core.sync.mutex;
|
||||
import otya.smilebasic.parser;
|
||||
class GraphicPage
|
||||
{
|
||||
@@ -358,6 +359,10 @@ DEF FACT(N)
|
||||
RETURN N*FACT(N-1)
|
||||
END"*/
|
||||
`CLS : CL=0 : Z=0
|
||||
WHILE 1
|
||||
Z=Z+1
|
||||
?Z;
|
||||
WEND
|
||||
WHILE 1
|
||||
INC Z : IF Z>200 THEN Z=0
|
||||
FOR I=0 TO 15
|
||||
@@ -373,7 +378,7 @@ FOR I=0 TO 15
|
||||
PRINT "Ё プチコン3ゴウ Ж"
|
||||
NEXT
|
||||
CL=(CL+1) MOD 16 : VSYNC 1
|
||||
WEND`*/
|
||||
WEND`
|
||||
/*
|
||||
`CLS : CL=0
|
||||
@LOOP
|
||||
@@ -387,6 +392,7 @@ GOTO @LOOP`*/
|
||||
auto vm = parser.compile();
|
||||
bool running = true;
|
||||
vm.init(this);
|
||||
consolem = new Mutex();
|
||||
core.thread.Thread thread = new core.thread.Thread(&render);
|
||||
thread.start();
|
||||
auto startTicks = SDL_GetTicks();
|
||||
@@ -434,8 +440,11 @@ GOTO @LOOP`*/
|
||||
int CSRY;
|
||||
int CSRZ;
|
||||
int consoleForeColor, consoleBackColor;
|
||||
Mutex consolem;
|
||||
void renderConsole()
|
||||
{
|
||||
consolem.lock();
|
||||
scope(exit) consolem.unlock();
|
||||
for(int y = 0; y < consoleHeight; y++)
|
||||
for(int x = 0; x < consoleWidth; x++)
|
||||
{
|
||||
@@ -474,6 +483,9 @@ GOTO @LOOP`*/
|
||||
}
|
||||
void printConsoleString(wstring text)
|
||||
{
|
||||
consolem.lock();
|
||||
scope(exit) consolem.unlock();
|
||||
//write(text);
|
||||
foreach(wchar c; text)
|
||||
{
|
||||
if(CSRY >= consoleHeight)
|
||||
@@ -501,7 +513,7 @@ GOTO @LOOP`*/
|
||||
}
|
||||
console[consoleHeight - 1] = tmp;
|
||||
tmp[] = ConsoleCharacter(0, consoleForeColor, consoleBackColor);
|
||||
assert(console[0] != console[2]);
|
||||
//assert(console[0] != console[2]);
|
||||
CSRY = consoleHeight - 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user