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
|
-
|
-
|
!
-
|
-
|
|
!
| #module "mod_modval"
#defcfunc resmodv
if modverr{
modverr = 0: return 0
}else{
return 1
}
#define global ctype getmodv(%1,%2=0,%3=0) _getmodv(%1,%2,%3)
#defcfunc _getmodv var p1, int p2, int p3
if varuse(p1)=0: goto *failed
dup v1, p1
if vartype(v1)!vartype("struct"): goto *failed
dupptr flex, varptr(v1), 16
if (p2<0) | (p2>=flex.2/48): goto *failed
dupptr pval, flex.3 + 48 * p2, 48
switch( wpeek(pval, 0) )
case vartype("int")
if (p3<0) | (p3>=pval.6/4) | (pval.7=0): goto *failed
dupptr dat, pval.7, pval.6
return dat.p3
case vartype("double")
if (p3<0) | (p3>=pval.6/8) | (pval.7=0): goto *failed
dupptr dat, pval.7, pval.6, 3
return dat.p3
case vartype("str")
if (p3<0) | (p3>=pval.6/4): goto *failed
if p3 = 0{
dupptr dat, pval.7, 1, 2
}else{
dupptr master, pval.8, pval.6
dupptr dat, master.p3, 1, 2
}
return dat
swend
*failed
modverr = 1
return 0
#global
|