-
Notifications
You must be signed in to change notification settings - Fork 85
/
reascript_test.eel
204 lines (183 loc) · 5.35 KB
/
reascript_test.eel
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
ShowConsoleMsg("");
tr=GetTrack(0,0);
extension_api("SNM_AddTCPFXParm",tr,0,0);
extension_api("SNM_AddTCPFXParm",tr,0,1);
extension_api("SNM_AddTCPFXParm",tr,0,2);
// EEL: bool extension_api("SNM_SetProjectMarker", ReaProject proj, int num, bool isrgn, pos, rgnend, "name", int color)
// Lua: boolean reaper.SNM_SetProjectMarker(ReaProject proj, integer num, boolean isrgn, number pos, number rgnend, string name, integer color)
extension_api("SNM_SetProjectMarker", 0.0, 1.0, 1.0, 0.0, 2.0, "test NULL proj", 0);
// EEL: bool extension_api("SNM_GetFastString", #retval, WDL_FastString str)
// Lua: string reaper.SNM_GetFastString(WDL_FastString str)
ShowConsoleMsg("SNM_CreateFastString+SNM_GetFastString: ");
w = extension_api("SNM_CreateFastString","ok\n");
extension_api("SNM_GetFastString",aa,w);
ShowConsoleMsg(aa);
// { APIFUNC(SNM_test1), "int", "int*", "aOut", "", },
// EEL: int extension_api("SNM_test1", int &aOut)
// Lua: integer retval, number aOut reaper.SNM_test1()
ShowConsoleMsg("SNM_test1\n");
test1r=0;
test1p=12;
test1r = extension_api("SNM_test1",test1p);
(test1r == 666 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(test1p == 2 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
// { APIFUNC(SNM_test2), "double", "double*", "aOut", "", },
// EEL: double extension_api("SNM_test2", &aOut)
// Lua: number retval, number aOut reaper.SNM_test2()
ShowConsoleMsg("SNM_test2\n");
test2r=0.0;
test2p=0.0;
test2r = extension_api("SNM_test2",test2p);
(test2r == 666.777 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(test2p == 1.23456789 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
// { APIFUNC(SNM_test3), "bool", "int*,double*,bool*", "aOut,bOut,cOut", "", },
// EEL: bool extension_api("SNM_test3", int &aOut, &bOut, bool &cOut)
// Lua: boolean retval, number aOut, number bOut, boolean cOut reaper.SNM_test3()
ShowConsoleMsg("SNM_test3\n");
test3=0; testa=333; testb=333.444; testc=1.0;
test3 = extension_api("SNM_test3",testa,testb,testc);
(test3 == 1 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testa == 666 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testb == 666.888 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testc == 0.0 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
// { APIFUNC(SNM_test4), "void", "double", "a", "", },
// EEL: extension_api("SNM_test4", a)
// Lua: reaper.SNM_test4(number a)
ShowConsoleMsg("SNM_test4\n");
test4=123.456789;
extension_api("SNM_test4",test4);
// { APIFUNC(SNM_test5), "void", "const char*", "a", "", },
// EEL: extension_api("SNM_test5", "a")
// Lua: reaper.SNM_test5(string a)
ShowConsoleMsg("SNM_test5\n");
test5="SNM_test5";
extension_api("SNM_test5",test5);
// { APIFUNC(SNM_test6), "const char*", "char*", "a", "", }, // not an "Out" parm
// EEL: bool extension_api("SNM_test6", #retval, #a)
// Lua: string retval, string a SNM_test6(string a)
ShowConsoleMsg("SNM_test6\n");
#test6p="SNM_test6";
#test6r="SNM_test6";
extension_api("SNM_test6",#test6r,#test6p);
ShowConsoleMsg(#test6p);
(!strcmp(#test6p,"SNM_test6 new parm val") ) ? (
ShowConsoleMsg(": ok\n");
) : (
ShowConsoleMsg(": KO !\n");
);
ShowConsoleMsg(#test6r);
(!strcmp(#test6r,"SNM_test6 return val") ) ? (
ShowConsoleMsg(": ok\n");
) : (
ShowConsoleMsg(": KO !\n");
);
// == test3 somehow but opt params + return double on top
// { APIFUNC(SNM_test7), "double", "int,int*,double*,bool*", "i,aOut,bOutOptional,cOutOptional", "", },
// EEL: double extension_api("SNM_test7", int i, int &aOut, optional &bOutOptional, optional bool &cOutOptional)
// Lua: number retval, number aOut, optional number bOutOptional, optional boolean cOutOptional SNM_test7(integer i)
ShowConsoleMsg("SNM_test7 with all params (more than doc)\n");
test7=0.0; testa=333; testb=333.444; testc=1.0;
#ble="lkjlkj";
#bla="cs";
test7 = extension_api("SNM_test7",7,testa,testb,testc,#ble,#bla);
(test7 == 666.777 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testa == 666 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testb == 666.888 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testc == 0.0 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(!strcmp(#ble,"SNM_test7 new parm val") ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
ShowConsoleMsg("SNM_test7 with min params (like the doc)\n");
testa=12;
test72r = extension_api("SNM_test7",7,testa);
(test72r == 666.777 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(testa == 24 ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
ShowConsoleMsg("SNM_test8\n");
#buf1="buf1";
#buf2="buf22";
#buf3="buf33";
test8p=321.0;
extension_api("SNM_test8",#test8r,#buf1,#buf2,666,#buf3,test8p);
(!strcmp(#test8r,"SNM_test8") ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(!strcmp(#buf1,"SNM_test8 new parm val for buf1") ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(!strcmp(#buf2,"buf22") ) ? ( // this test is a bit silly (buf2 is const char*)
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(!strcmp(#buf3,"SNM_test8 new parm val for buf3") ) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);
(test8p==123456789.0) ? (
ShowConsoleMsg("ok\n");
) : (
ShowConsoleMsg("KO !\n");
);