10 * @brief object management routines
14 * Open new field for a record.
16 void openrc(word prot, virtaddr *virt, word *addr)
20 request(prototype[prot]->appetite, &t1, addr);
21 M[*addr + PROTNUM] = prot;
23 virt->mark = M[t1 + 1];
29 void slopen(word prot, virtaddr *sladr, word *ah, word *am)
33 virts = thisp->prochead + M[thisp->prochead] + VIRTSC;
34 /* preserve for compactifier */
35 storevirt(*sladr, virts);
36 t1 = prototype[prot]->appetite;
41 M[*am + PROTNUM] = prot;
44 /* prepare SL pointer */
45 M[t1 + SL] = M[virts];
46 M[t1 + SL + 1] = M[virts + 1];
48 t2 = M[display2 + M[c1 + PROTNUM]];
50 M[t1 + DL + 1] = M[t2 + 1];
54 void openobj(word prot, word *ah, word *am)
59 t1 = M[display2 + prototype[prot]->slprototype];
63 slopen(prot, &v1, ah, am);
67 * Reserve room for array
69 void newarry(word low, word up, word kind, virtaddr *virt, word *am)
90 /* illegal array bounds */
94 request(up - low + ap, &virt->addr, am);
97 virt->mark = M[virt->addr + 1];
103 void gkill(virtaddr *virt)
110 /* kill remote process */
111 if (isprocess(virt)) {
112 msg.control.type = KILLPR;
113 obj2mess( M, virt, &msg.control.receiver );
114 /* send remote kill request */
117 else if (virt->mark == M[virt->addr + 1]) {
120 t2 = M[t1 + PROTNUM];
121 if (t2 == AINT || t2 == AREAL || t2 == AVIRT) {
122 /* simple kill for array */
125 else if (t2 == FILEOBJECT) {
126 /* First close file if opened */
127 if (M[t1 + FSTAT] != UNKNOWN)
128 if (fclose(MF(t1 + FFILE)))
130 /* Delete file if temporary */
131 if (M[t1 + FTEMP] == LTRUE)
132 if (unlink(MN(t1 + FNAME)))
137 /* more than array or file */
139 ptr = prototype[ t2 ];
140 if (ptr->kind == RECORD)
147 if (M[t3 + STATSL] != 0)
149 /* next object in DL */
159 loadvirt(vt, t3 + DL);
161 virt->addr = vt.addr;
162 virt->mark = vt.mark;
164 } while (M[virt->addr + 1] == virt->mark);
171 * Copy object to a new object and locate it by fresh.
173 void copy(virtaddr *old, virtaddr *fresh)
175 word t1, t2, t3, virts;
179 /* fine copy for none */
180 if (M[ old->addr+1 ] != old->mark) {
182 /* note M[ 1 ] <> 0 */
189 /* assume it is a record */
191 t2 = M[t1 + PROTNUM];
192 /* if not array nor file */
193 if (t2 != AINT && t2 != AREAL && t2 != AVIRT &&
196 /* our assumption was wrong */
197 if (ptr->kind != RECORD) {
199 t3 = t1 + M[t1] + DL;
200 /* non-terminated object */
201 if (M[t3] != old->addr ||
202 M[t3 + 1] != old->mark) {
207 virts = thisp->prochead + M[thisp->prochead] + VIRTSC;
208 /* preserve for compactification */
209 storevirt(*old, virts);
211 request(M[ t1 ], &t2, &t3);
214 fresh->mark = M[fresh->addr + 1];
216 for (t2 = 1; t2 < M[t1]; t2++)
217 M[t3 + t2] = M[t1 + t2];
221 storevirt(*fresh, t3 + M[t3] + DL);
222 /* not in any SL chain */
223 M[t3 + M[t3] + STATSL] = 0;