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