// read a sequence of bytecodes in a list left on the stack void read_sequence(Process & proc, std::istream & in) { char c; proc.stack.push(Object::nil()); // head proc.stack.push(Object::nil()); // tail while (1) { skip_seps(in); c = in.peek(); if (!in.eof() && c == bc_start) { read_bytecode(proc, in); Object::ref c2 = Object::to_ref(proc.create<Cons>()); if (proc.stack.top(3)==Object::nil()) // test the head proc.stack.top(3) = c2; // new head else scdr(proc.stack.top(2), c2); // cdr of the tail scar(c2, proc.stack.top()); proc.stack.pop(); proc.stack.top() = c2; // new tail } else break; } proc.stack.pop(); // remove tail and leave head }
/* Convert a closure */ void __arc_clos_env2heap(arc *c, value thr, value clos) { scdr(clos, __arc_env2heap(c, thr, cdr(clos))); }