-
Notifications
You must be signed in to change notification settings - Fork 0
/
funinterface.h
65 lines (58 loc) · 1.41 KB
/
funinterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include "nodetype.h"
#include <cmath>
#define TypeCheck(name) static bool name(vector<BasicNode*>&sonNode)
#define _TypeCheck(name) bool BuiltinFunc::name(vector<BasicNode*>&sonNode)
#define FunBody(name) static BasicNode* name(vector<BasicNode*>&sonNode)
#define _FunBody(name) BasicNode* BuiltinFunc::name(vector<BasicNode*>&sonNode)
class BuiltinFunc
{
private:
static double getNum(BasicNode* node);
public:
//判断函数参数个数是否合法
TypeCheck(hasOneSonNode);
TypeCheck(hasTwoSonNodes);
TypeCheck(assignmentCheck);
TypeCheck(onestr);
TypeCheck(oneMat);
TypeCheck(twoVec);
TypeCheck(twoMat);
TypeCheck(vecNum);
TypeCheck(matNum);
TypeCheck(matNum2);
TypeCheck(matNum3);
TypeCheck(matVec);
TypeCheck(pmatVecNum);
//内置函数
FunBody(add);
FunBody(sub);
FunBody(mul);
FunBody(div);
FunBody(pow);
FunBody(sin);
FunBody(cos);
FunBody(log);
FunBody(ln);
FunBody(puts);
FunBody(assignment);
FunBody(vecDot);
FunBody(matDot);
FunBody(vecAdd);
FunBody(matAdd);
FunBody(vecSub);
FunBody(matSub);
FunBody(vecMul);
FunBody(matMul);
FunBody(getRVector);
FunBody(getCVector);
FunBody(setRVector);
FunBody(setCVector);
FunBody(det);
FunBody(inv);
FunBody(adjoint);
FunBody(linerSolve);
FunBody(rsub);
FunBody(rmul);
FunBody(rswap);
};