PROJECT
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
<debuglevel>0</debuglevel>
|
||||
<debugids />
|
||||
<versionlevel>0</versionlevel>
|
||||
<versionids>NDirectMode</versionids>
|
||||
<versionids />
|
||||
<dump_source>0</dump_source>
|
||||
<mapverbosity>0</mapverbosity>
|
||||
<createImplib>0</createImplib>
|
||||
|
||||
@@ -1381,6 +1381,24 @@ class BuiltinFunction
|
||||
flag.setDefaultValue(0);
|
||||
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;
|
||||
static BuiltinFunctions[wstring] builtinFunctions;
|
||||
static wstring getBasicName(BFD)(const wstring def)
|
||||
@@ -1872,9 +1890,18 @@ template AddFuncArg(int L, int N, int M, int O, BFD, P...)
|
||||
}
|
||||
else static if(is(P[0] == wstring))
|
||||
{
|
||||
enum add = 1;
|
||||
enum outadd = 0;
|
||||
const string arg = "arg[" ~ I.to!string ~ "].castString";
|
||||
static if(storage & ParameterStorageClass.out_)
|
||||
{
|
||||
enum add = 0;
|
||||
enum outadd = 1;
|
||||
const string arg = "ret[" ~ O.to!string ~ "].stringValue";
|
||||
}
|
||||
else
|
||||
{
|
||||
enum add = 1;
|
||||
enum outadd = 0;
|
||||
const string arg = "arg[" ~ I.to!string ~ "].castString";
|
||||
}
|
||||
}
|
||||
else static if(is(P[0] == DefaultValue!int))
|
||||
{
|
||||
@@ -1995,6 +2022,10 @@ template OutArgsInit(BFD, int I = 0, int J = 0)
|
||||
{
|
||||
enum ret2 = "ValueType.Void;";
|
||||
}
|
||||
else static if(is(param[I] == wstring))
|
||||
{
|
||||
enum ret2 = "ValueType.String;";
|
||||
}
|
||||
else
|
||||
{
|
||||
static assert(false, "invalid type " ~ param[I].stringof);
|
||||
|
||||
@@ -114,4 +114,12 @@ class CantUseFromDirectMode : SmileBasicError
|
||||
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");
|
||||
}
|
||||
Slot[] slot;
|
||||
bool isRunningDirectMode = false;
|
||||
void run()
|
||||
{
|
||||
slot = new Slot[5];
|
||||
@@ -1133,7 +1134,6 @@ class PetitComputer
|
||||
Parser parser;
|
||||
otya.smilebasic.vm.VM vm;
|
||||
bool directMode = false;
|
||||
bool isRunningDirectMode = false;
|
||||
int oldpc;
|
||||
void runSlot(int lot)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user