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
|
include <error.h>
include <imhdr.h>
include <imset.h>
include <pmset.h>
include "ace.h"
pointer procedure overlay (ovrly, im)
char ovrly[ARB] #I Overlay name
pointer im #I Reference image
pointer ovr #O Overlay pointer
int i, j, nc, nl, val
long v[2]
pointer sp, fname, pm, buf
int nowhite(), andi()
bool pm_linenotempty()
pointer ods_pmmap(), imstati()
begin
call smark (sp)
call salloc (fname, SZ_FNAME, TY_CHAR)
if (nowhite (ovrly, Memc[fname], SZ_FNAME) == 0) {
call sfree (sp)
return (NULL)
}
if (Memc[fname] == '!') {
iferr (call imgstr (im, Memc[fname+1], Memc[fname], SZ_FNAME)) {
call sfree (sp)
return (NULL)
}
}
iferr (ovr = ods_pmmap (Memc[fname], im)) {
call sfree (sp)
call erract (EA_WARN)
return (NULL)
}
nc = IM_LEN(ovr,1)
nl = IM_LEN(ovr,2)
pm = imstati (ovr, IM_PMDES)
call salloc (buf, nc, TY_INT)
v[1] = 1
do i = 1, nl {
v[2] = i
if (!pm_linenotempty(pm, v))
next
call pmglpi (pm, v, Memi[buf], 0, nc, 0)
do j = 0, nc-1 {
val = Memi[buf+j]
if (val == 0)
next
else if (val < NUMSTART)
val = 1
else {
val = andi (val, MASK_BNDRY)
if (val != 0)
val = mod (andi (Memi[buf+j], MASK_NUM), 9) + 2
#val = 1
}
Memi[buf+j] = val
}
call pmplpi (pm, v, Memi[buf], 0, nc, PIX_SRC)
}
call sfree (sp)
return (ovr)
end
|