-
Notifications
You must be signed in to change notification settings - Fork 9
/
ayavm.h
112 lines (83 loc) · 2.26 KB
/
ayavm.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
// AYA version 5
//
// AYAの1インスタンスを保持するクラスAYAVM
// written by the Maintenance Shop/C.Ponapalt 2006
//
// CAyaVMをたくさん作ると複数のAYAを1つのプロセス/スレッド/モジュール内で走らせることができます。
//
#ifndef AYAVM_H
#define AYAVM_H
#include <vector>
#include <map>
#include <memory>
#include "log.h"
#include "mt19937ar.h"
#include "globaldef.h"
class CBasis;
class CFunction;
class CFunctionDef;
class CCallLimit;
class CSystemFunction;
class CGlobalVariable;
class CFile;
class CLib;
class CParser0;
class CParser1;
class CDefine;
class CAyaVM;
class CAyaVM
{
private:
std_shared_ptr<CBasis> m_basis;
std_shared_ptr<CFunctionDef> m_function_parse;
std_shared_ptr<CFunctionDef> m_function_exec;
std_shared_ptr<CFunctionDef> m_function_destruct;
std_shared_ptr< std::vector<CDefine> > m_gdefines;
std_shared_ptr<CCallLimit> m_call_limit;
std_shared_ptr<CSystemFunction> m_sysfunction;
std_shared_ptr<CGlobalVariable> m_variable;
std_shared_ptr<CFile> m_files;
std_shared_ptr<CLib> m_libs;
std_shared_ptr<CParser0> m_parser0;
std_shared_ptr<CParser1> m_parser1;
CLog m_logger;
MersenneTwister64 rs_sysfunc64;
MersenneTwister64 rs_internal64;
public:
CAyaVM();
CAyaVM(CAyaVM &vm);
virtual ~CAyaVM() {}
CAyaVM* get_a_deep_copy();
void load(void);
void unload(void);
void request_before(void);
void request_after(void);
void func_parse_to_exec(void);
void func_parse_destruct(void);
void func_parse_new(void);
size_t genrand_uint(size_t n);
yaya::int_t genrand_sysfunc_ll(yaya::int_t n);
void genrand_sysfunc_srand_ll(yaya::int_t n);
void genrand_sysfunc_srand_array(const std::uint64_t a[],const int n);
// 主制御
CBasis& basis();
// 関数/システム関数/グローバル変数
CFunctionDef& function_parse(); //パース用
CFunctionDef& function_exec(); //実行用
std::vector<CDefine>& gdefines();
CCallLimit& call_limit();
CSystemFunction& sysfunction();
CGlobalVariable& variable();
// ファイルと外部ライブラリ
CFile& files();
CLib& libs();
// ロガー
inline CLog& logger() {
return m_logger;
}
// パーサ
CParser0& parser0();
CParser1& parser1();
};
#endif //AYAVM_H