PROJECT
This commit is contained in:
@@ -72,7 +72,7 @@
|
|||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>NDirectMode</versionids>
|
<versionids />
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
|||||||
@@ -1381,6 +1381,24 @@ class BuiltinFunction
|
|||||||
flag.setDefaultValue(0);
|
flag.setDefaultValue(0);
|
||||||
throw new IllegalFunctionCall("NOTIMPL:LOAD");
|
throw new IllegalFunctionCall("NOTIMPL:LOAD");
|
||||||
}
|
}
|
||||||
|
static void PROJECT(PetitComputer p, wstring name)
|
||||||
|
{
|
||||||
|
//DirectMode only
|
||||||
|
if(p.isRunningDirectMode)
|
||||||
|
{
|
||||||
|
if(!p.project.isValidProjectName(name))
|
||||||
|
{
|
||||||
|
throw new IllegalFunctionCall("PROJECT");
|
||||||
|
}
|
||||||
|
p.currentProject = name;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new CantUseInProgram("PROJECT");
|
||||||
|
}
|
||||||
|
static void PROJECT(PetitComputer p, out wstring name)
|
||||||
|
{
|
||||||
|
name = p.currentProject;
|
||||||
|
}
|
||||||
//alias void function(PetitComputer, Value[], Value[]) BuiltinFunc;
|
//alias void function(PetitComputer, Value[], Value[]) BuiltinFunc;
|
||||||
static BuiltinFunctions[wstring] builtinFunctions;
|
static BuiltinFunctions[wstring] builtinFunctions;
|
||||||
static wstring getBasicName(BFD)(const wstring def)
|
static wstring getBasicName(BFD)(const wstring def)
|
||||||
@@ -1871,11 +1889,20 @@ template AddFuncArg(int L, int N, int M, int O, BFD, P...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else static if(is(P[0] == wstring))
|
else static if(is(P[0] == wstring))
|
||||||
|
{
|
||||||
|
static if(storage & ParameterStorageClass.out_)
|
||||||
|
{
|
||||||
|
enum add = 0;
|
||||||
|
enum outadd = 1;
|
||||||
|
const string arg = "ret[" ~ O.to!string ~ "].stringValue";
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
enum add = 1;
|
enum add = 1;
|
||||||
enum outadd = 0;
|
enum outadd = 0;
|
||||||
const string arg = "arg[" ~ I.to!string ~ "].castString";
|
const string arg = "arg[" ~ I.to!string ~ "].castString";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else static if(is(P[0] == DefaultValue!int))
|
else static if(is(P[0] == DefaultValue!int))
|
||||||
{
|
{
|
||||||
static if(storage & ParameterStorageClass.out_)
|
static if(storage & ParameterStorageClass.out_)
|
||||||
@@ -1995,6 +2022,10 @@ template OutArgsInit(BFD, int I = 0, int J = 0)
|
|||||||
{
|
{
|
||||||
enum ret2 = "ValueType.Void;";
|
enum ret2 = "ValueType.Void;";
|
||||||
}
|
}
|
||||||
|
else static if(is(param[I] == wstring))
|
||||||
|
{
|
||||||
|
enum ret2 = "ValueType.String;";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static assert(false, "invalid type " ~ param[I].stringof);
|
static assert(false, "invalid type " ~ param[I].stringof);
|
||||||
|
|||||||
@@ -114,4 +114,12 @@ class CantUseFromDirectMode : SmileBasicError
|
|||||||
super("Can't use from direct mode");
|
super("Can't use from direct mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class CantUseInProgram : SmileBasicError
|
||||||
|
{
|
||||||
|
this(wstring func)
|
||||||
|
{
|
||||||
|
this.errnum = 44;
|
||||||
|
super("Can't use in program");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1115,6 +1115,7 @@ class PetitComputer
|
|||||||
printConsole("OK\n");
|
printConsole("OK\n");
|
||||||
}
|
}
|
||||||
Slot[] slot;
|
Slot[] slot;
|
||||||
|
bool isRunningDirectMode = false;
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
slot = new Slot[5];
|
slot = new Slot[5];
|
||||||
@@ -1133,7 +1134,6 @@ class PetitComputer
|
|||||||
Parser parser;
|
Parser parser;
|
||||||
otya.smilebasic.vm.VM vm;
|
otya.smilebasic.vm.VM vm;
|
||||||
bool directMode = false;
|
bool directMode = false;
|
||||||
bool isRunningDirectMode = false;
|
|
||||||
int oldpc;
|
int oldpc;
|
||||||
void runSlot(int lot)
|
void runSlot(int lot)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user