| 1 |
#ifdef RCSID |
| 2 |
static char RCSid[] = |
| 3 |
"$Header: d:/cvsroot/tads/TADS2/VOCCOMP.C,v 1.2 1999/05/17 02:52:13 MJRoberts Exp $"; |
| 4 |
#endif |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#include "os.h" |
| 24 |
#include "voc.h" |
| 25 |
|
| 26 |
|
| 27 |
void vocdelinh(voccxdef *ctx) |
| 28 |
{ |
| 29 |
int i; |
| 30 |
vocdef *v; |
| 31 |
vocdef *prv; |
| 32 |
vocdef *nxt; |
| 33 |
vocdef **vp; |
| 34 |
vocwdef *vw; |
| 35 |
vocwdef *prvw; |
| 36 |
vocwdef *nxtw; |
| 37 |
uint idx; |
| 38 |
uint nxtidx; |
| 39 |
int deleted_vocdef; |
| 40 |
|
| 41 |
|
| 42 |
for (i = VOCHASHSIZ, vp = ctx->voccxhsh ; i ; ++vp, --i) |
| 43 |
{ |
| 44 |
|
| 45 |
for (prv = (vocdef *)0, v = *vp ; v ; v = nxt) |
| 46 |
{ |
| 47 |
nxt = v->vocnxt; |
| 48 |
deleted_vocdef = FALSE; |
| 49 |
|
| 50 |
|
| 51 |
for (prvw = 0, idx = v->vocwlst, vw = vocwget(ctx, idx) ; vw ; |
| 52 |
vw = nxtw, idx = nxtidx) |
| 53 |
{ |
| 54 |
|
| 55 |
nxtidx = vw->vocwnxt; |
| 56 |
nxtw = vocwget(ctx, nxtidx); |
| 57 |
|
| 58 |
|
| 59 |
if (vw->vocwflg & VOCFINH) |
| 60 |
{ |
| 61 |
|
| 62 |
if (prvw) |
| 63 |
prvw->vocwnxt = vw->vocwnxt; |
| 64 |
else |
| 65 |
v->vocwlst = vw->vocwnxt; |
| 66 |
|
| 67 |
|
| 68 |
vw->vocwnxt = ctx->voccxwfre; |
| 69 |
ctx->voccxwfre = idx; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
if (v->vocwlst == VOCCXW_NONE) |
| 76 |
{ |
| 77 |
|
| 78 |
if (prv) prv->vocnxt = v->vocnxt; |
| 79 |
else *vp = v->vocnxt; |
| 80 |
|
| 81 |
|
| 82 |
v->vocnxt = ctx->voccxfre; |
| 83 |
ctx->voccxfre = v; |
| 84 |
|
| 85 |
|
| 86 |
deleted_vocdef = TRUE; |
| 87 |
} |
| 88 |
} |
| 89 |
else |
| 90 |
prvw = vw; |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
if (!deleted_vocdef) |
| 95 |
prv = v; |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
void vociren(voccxdef *ctx, objnum oldnum, objnum newnum) |
| 102 |
{ |
| 103 |
int i; |
| 104 |
vocdef *v; |
| 105 |
vocdef **vp; |
| 106 |
vocwdef *vw; |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
vocialo(ctx, newnum); |
| 111 |
|
| 112 |
|
| 113 |
vocinh(ctx, newnum) = vocinh(ctx, oldnum); |
| 114 |
vocinh(ctx, oldnum) = 0; |
| 115 |
|
| 116 |
|
| 117 |
vocinh(ctx, newnum)->vociflg |= VOCIFCLASS; |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
for (i = VOCHASHSIZ, vp = ctx->voccxhsh ; i != 0 ; ++vp, --i) |
| 124 |
{ |
| 125 |
|
| 126 |
for (v = *vp ; v != 0 ; v = v->vocnxt) |
| 127 |
{ |
| 128 |
|
| 129 |
for (vw = vocwget(ctx, v->vocwlst) ; vw ; |
| 130 |
vw = vocwget(ctx, vw->vocwnxt)) |
| 131 |
{ |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
if (vw->vocwobj == oldnum) |
| 138 |
{ |
| 139 |
vw->vocwobj = newnum; |
| 140 |
vw->vocwflg |= VOCFCLASS; |
| 141 |
} |
| 142 |
} |
| 143 |
} |
| 144 |
} |
| 145 |
} |
| 146 |
|