diff --git a/SMILEBASIC/SMILEBASIC.visualdproj b/SMILEBASIC/SMILEBASIC.visualdproj
index af0f869..7155be3 100644
--- a/SMILEBASIC/SMILEBASIC.visualdproj
+++ b/SMILEBASIC/SMILEBASIC.visualdproj
@@ -212,6 +212,7 @@
+
diff --git a/SMILEBASIC/TEST.txt b/SMILEBASIC/TEST.txt
new file mode 100644
index 0000000..4092d13
--- /dev/null
+++ b/SMILEBASIC/TEST.txt
@@ -0,0 +1,28 @@
+ASSERT__ 1, "TRUE"
+A$="A"
+ASSERT__ A$=="A", "A$==A"
+A$=A$+"B"
+ASSERT__ A$=="AB", "A$==AA"
+A=0
+INC A
+ASSERT__ A==1, "A==1"
+INC A, 3
+ASSERT__ A==4, "A==4"
+DEC A, 3
+ASSERT__ A==1, "A==1"
+DEC A
+ASSERT__ A==0, "A==0"
+INCTEST 0
+DEF INCTEST A
+ INC A
+ ASSERT__ A==1, "A==1"
+ INC A, 3
+ ASSERT__ A==4, "A==4"
+ DEC A, 3
+ ASSERT__ A==1, "A==1"
+ DEC A
+ ASSERT__ A==0, "A==0"
+END
+LOCATE 10,
+COLOR 1,15
+PRINT "テスト正常終了"
\ No newline at end of file
diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d
index e0f8479..0ba6147 100644
--- a/SMILEBASIC/builtinfunctions.d
+++ b/SMILEBASIC/builtinfunctions.d
@@ -94,6 +94,14 @@ class BuiltinFunction
{
p.cls;
}
+ static void ASSERT__(PetitComputer p, int cond, wstring message)
+ {
+ if(!cond)
+ {
+ p.printConsole("Assertion failed: ", message, "\n");
+ }
+ assert(cond, message.to!string);
+ }
//alias void function(PetitComputer, Value[], Value[]) BuiltinFunc;
static BuiltinFunction[wstring] builtinFunctions;
static this()
@@ -202,6 +210,10 @@ template GetFunctionParamType(T, string N)
{
const string arg = "ValueType.Integer, false";
}
+ else static if(is(P[0] == wstring))
+ {
+ const string arg = "ValueType.String, false";
+ }
else static if(is(P[0] == DefaultValue!int))
{
const string arg = "ValueType.Integer, true";
@@ -250,6 +262,11 @@ template AddFuncArg(int L, int N, int M, P...)
enum add = 1;
const string arg = "arg[" ~ I.to!string ~ "].castInteger";
}
+ else static if(is(P[0] == wstring))
+ {
+ enum add = 1;
+ const string arg = "arg[" ~ I.to!string ~ "].castString";
+ }
else static if(is(P[0] == DefaultValue!int))
{
enum add = 1;
diff --git a/SMILEBASIC/parser.d b/SMILEBASIC/parser.d
index a27245e..032805e 100644
--- a/SMILEBASIC/parser.d
+++ b/SMILEBASIC/parser.d
@@ -537,6 +537,7 @@ class Parser
}
isFuncReturnExpr = node.returnExpr;//面倒くさい
node.functionBody = functionStatements();
+ lex.popFront();
isFuncReturnExpr = false;
return node;
}
diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d
index 637086c..55c049d 100644
--- a/SMILEBASIC/petitcomputer.d
+++ b/SMILEBASIC/petitcomputer.d
@@ -347,7 +347,7 @@ class PetitComputer
}
}+/
//とりあえず
- auto parser = new Parser(/*readText("FIZZBUZZ.TXT").to!wstring*//*"
+ auto parser = new Parser(readText("TEST.TXT").to!wstring/*readText("FIZZBUZZ.TXT").to!wstring*//*"
?ABS(-1)
LOCATE 0,10
COLOR 5
@@ -357,10 +357,10 @@ NEXT
DEF FACT(N)
IF N<=1 THEN RETURN 1
RETURN N*FACT(N-1)
-END"*/
+END"*//*
`CLS : CL=0 : Z=0
WHILE 1
-INC Z
+INC Z,2
?Z,
WEND
WHILE 1
@@ -370,7 +370,7 @@ WHILE 1
PRINT "★ 梅雨で雨が多い季節ですね ★"
NEXT
CL=(CL+1) MOD 16 : VSYNC 2
-WEND`/*
+WEND`*//*
`CLS : CL=0
WHILE 1
FOR I=0 TO 15
@@ -452,7 +452,7 @@ GOTO @LOOP`*/
auto back = console[y][x].backColor;
auto fore = consoleColor[console[y][x].foreColor];
auto texture = GRPFColor[back].texture;
- //SDL_RenderCopy(renderer, texture, &fontTable[console[y][x].charater], &rect);
+ SDL_RenderCopy(renderer, texture, &fontTable[console[y][x].charater], &rect);
SDL_SetTextureColorMod(GRPF.texture, fore >> 16 & 0xFF, fore >> 8 & 0xFF, fore & 0xFF);
SDL_SetTextureAlphaMod(GRPF.texture, fore >> 24 & 0xFF);
SDL_RenderCopy(renderer, GRPF.texture, &fontTable[console[y][x].charater], &rect);
diff --git a/SMILEBASIC/type.d b/SMILEBASIC/type.d
index 380c9bc..466865a 100644
--- a/SMILEBASIC/type.d
+++ b/SMILEBASIC/type.d
@@ -90,6 +90,10 @@ struct Value
{
return this.type == ValueType.Integer ? this.integerValue : (this.type == ValueType.Double ? this.doubleValue : 0);
}
+ wstring castString()
+ {
+ return this.type == ValueType.String ? this.stringValue : "";
+ }
string toString()
{
import std.conv;