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
|
-
-
-
|
|
|
-
|
|
!
-
|
|
!
-
|
|
!
-
-
-
|
|
|
-
|
|
!
-
|
|
!
-
|
|
!
-
|
|
!
-
-
|
|
!
-
|
!
|
-
|
|
|
|
!
-
-
|
-
|
|
-
|
|
-
|
!
-
|
-
|
|
!
| #ifndef AllGetkey_mod
#module AllGetkey_mod
#const DEFLONG 1 #const DEFDBLTYPE 1 #const DEFDBLFLAG 65535
#define global AllGetkeyInit(%1, %2 = 0, %3 = 0, %4 = -2)\
_AllGetkeyInit %1, %2, %3, %4
#deffunc _AllGetkeyInit array a, int p1, int p2, int p3
if p1 > 0{
if p1 >= p2{
if p2 > 0{
if p2 - 1 > 0 : _allgetkeyinit a, 1 , p2 - 1, p3
if p1 + 1 < 254: _allgetkeyinit a, p1 + 1, 254 , p3
return
}else{
dbl = p1
long = p1
}
}else{
dbl = p1
long = p2
}
}else{
dbl = 1
long = 254
}
repeat long - dbl + 1, dbl
a(cnt) = p3
dbl(cnt) = DEFDBLFLAG
loop
return
#define global keyconfig(%1 = -1,%2 = 0, %3 = 0, %4 = -1)\
_keyconfig %1, %2, %3, %4
#deffunc _Keyconfig int p1, int p2, int p3, int p4
if p2 > 0{
if p2 >= p3{
if p3 > 0{
if p3 - 1 > 0 : _keyconfig p1, 1 , p3 - 1, p4
if p2 + 1 < 254: _keyconfig p1, p2 + 1, 254 , p4
return
}else{
dbl = p2
long = p2
}
}else{
dbl = p2
long = p3
}
}else{
dbl = 1
long = 254
}
repeat long - dbl + 1
long = 0
repeat sp
if t(cnt) = dbl{
sp-
break
}
long+
loop
if p1{
if p1 >= 0{
t(long) = dbl
long(dbl) = p1
}
if p4 >= 0{
dbltype(dbl) = p4 = 0
}
sp+
}else{
long(t(long)) = DEFLONG
dbl(t(long)) = DEFDBLFLAG
dbltype(t(long)) = DEFDBLTYPE
t(long) = t(sp)
}
dbl+
loop
return
#deffunc AllGetkey array a
repeat sp
long = t(cnt)
getkey dbl, long
if dbl{
if a(long) > 0{
a(long)+
}else: if dbl(long) - a(long) > long(long){
dbl(long) = 0
a(long) = 1
}else: if a(long){
dbl(long) = long(long) * dbltype(long)
a(long) = 0
}else{
a(long) = 2
}
}else: if a(long) <= 0{
a(long)-
}else{
dbl(long) += a(long)
a(long) = -1
}
loop
return
#deffunc allgetkey_default
repeat 254, 1
dbl(cnt) = DEFDBLFLAG
dbltype(cnt) = DEFDBLTYPE
long(cnt) = DEFLONG
t(cnt) = cnt
loop
sp = 254
return
#global
allgetkey_default
#endif
|