at *with_object(at *p, at *f, at *q, int howfar) { assert(howfar>=0); MM_ENTER; at *ans = NIL; if (OBJECTP(p)) { object_t *obj = Mptr(p); class_t *cl = Class(obj->backptr); if (howfar > cl->num_slots) howfar = cl->num_slots; /* push object environment */ for (int i = 0; i<howfar; i++) { Symbol(cl->slots[i]) = symbol_push(Symbol(cl->slots[i]), 0 , &(obj->slots[i])); if (i < cl->num_cslots) MARKVAR_SYMBOL(Symbol(cl->slots[i])); } SYMBOL_PUSH(at_this, p); LOCK_SYMBOL(Symbol(at_this)); ans = apply(f, q); /* pop object environment */ SYMBOL_POP(at_this); for (int i = 0; i<howfar; i++) SYMBOL_POP(cl->slots[i]); } else { if (p == NIL) printf("*** Warning\007 (with-object () ...)\n"); SYMBOL_PUSH(at_this, p); ans = apply(f, q); SYMBOL_POP(at_this); } MM_RETURN(ans); }
static void freadsym (FILE *stream, file *f, int chosen) { symbol *sym; { const char *name = tfgets (stream); sym = symbol_hash_lookup (name, true); } if (sym->file == NULL) { /* We didn't have this symbol already, so we choose this file. */ symbol_push (sym); sym->file = f; sym->chosen = chosen; } else if (chosen) { /* We want this file; cast aside any pretender. */ if (sym->chosen && sym->file != f) { if (sym->chosen == 1) file_push (sym->file); else { file_push (f); f = sym->file; chosen = sym->chosen; } } sym->file = f; sym->chosen = chosen; } }