COS TAN RAD DEG PI追加
This commit is contained in:
@@ -29,6 +29,9 @@ ASSERT__ VAL("&HA")==10, "VAL"
|
||||
ASSERT__ VAL("&H-A")==0, "VAL"
|
||||
ASSERT__ VAL("&B10")==2, "VAL"
|
||||
ASSERT__ VAL("aa")==0, "VAL"
|
||||
|
||||
ASSERT__ RAD(180)==PI(), "RAD"
|
||||
ASSERT__ DEG(RAD(180)), "DEG"
|
||||
ASSERT__ SUBST$("0123456789",0,"B")=="B","SUBST$"
|
||||
ASSERT__ SUBST$("0123456789",0,4,"B")=="B456789","SUBST$"
|
||||
ASSERT__ SUBST$("",0,4,"B")=="B","SUBST$"
|
||||
|
||||
@@ -80,6 +80,26 @@ class BuiltinFunction
|
||||
{
|
||||
return sin(arg1);
|
||||
}
|
||||
static double COS(double arg1)
|
||||
{
|
||||
return cos(arg1);
|
||||
}
|
||||
static double TAN(double arg1)
|
||||
{
|
||||
return tan(arg1);
|
||||
}
|
||||
static double RAD(double arg1)
|
||||
{
|
||||
return arg1 * std.math.PI / 180;
|
||||
}
|
||||
static double DEG(double arg1)
|
||||
{
|
||||
return arg1 * 180 / std.math.PI;
|
||||
}
|
||||
static double PI()
|
||||
{
|
||||
return std.math.PI;
|
||||
}
|
||||
//static ABS = function double(double x) => abs(this.result == ValueType.Double ? 1 : 0);
|
||||
static void LOCATE(PetitComputer p, DefaultValue!int x, DefaultValue!int y, DefaultValue!(int, false) z)
|
||||
{
|
||||
@@ -752,6 +772,12 @@ template GetFunctionParamType(T, string N)
|
||||
template AddFuncArg(int L, int N, int M, int O, T, string NAME, P...)
|
||||
{
|
||||
enum I = L - N;
|
||||
static if(ParameterStorageClassTuple!(__traits(getMember, T, NAME)).length <= M)
|
||||
{
|
||||
const string AddFuncArg = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
enum storage = ParameterStorageClassTuple!(__traits(getMember, T, NAME))[M];
|
||||
static if(is(P[0] == double))
|
||||
{
|
||||
@@ -849,6 +875,7 @@ template AddFuncArg(int L, int N, int M, int O, T, string NAME, P...)
|
||||
const string AddFuncArg = arg ~ ", " ~ AddFuncArg!(L - !add, N + add, M + 1, O + outadd, T, NAME, P[1..$]);
|
||||
}
|
||||
}
|
||||
}
|
||||
template OutArgsInit(T, string N, int I = 0, int J = 0)
|
||||
{
|
||||
enum tuple = ParameterStorageClassTuple!(__traits(getMember, T, N))[I];
|
||||
@@ -886,8 +913,14 @@ template OutArgsInit(T, string N, int I = 0, int J = 0)
|
||||
}
|
||||
template GetArgumentCount(T, string N, int I = 0)
|
||||
{
|
||||
enum tuple = ParameterStorageClassTuple!(__traits(getMember, T, N))[I];
|
||||
alias param = ParameterTypeTuple!(__traits(getMember, T, N));
|
||||
static if(param.length <= I)
|
||||
{
|
||||
enum GetArgumentCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
enum tuple = ParameterStorageClassTuple!(__traits(getMember, T, N))[I];
|
||||
static if(is(param[I] == PetitComputer))
|
||||
{
|
||||
enum add = 0 + 1;
|
||||
@@ -912,6 +945,7 @@ template GetArgumentCount(T, string N, int I = 0)
|
||||
enum GetArgumentCount = add;
|
||||
}
|
||||
}
|
||||
}
|
||||
template IsVariadic(T, string N, int I = 0)
|
||||
{
|
||||
alias param = ParameterTypeTuple!(__traits(getMember, T, N));
|
||||
|
||||
Reference in New Issue
Block a user