void mrecall(u16 n, const char *name, fncode fn) /* Effects: Generate code to recall variable n */ { struct string *mod; struct global_state *gstate = fnglobals(fn); int status = module_vstatus(gstate, n, &mod); if (!in_glist(n, definable) && !in_glist(n, readable) && !in_glist(n, writable)) { if (status == var_module) { /* Implicitly import protected modules */ if (module_status(gstate, mod->str) == module_protected) { if (immutablep(GVAR(gstate, n))) /* Use value */ { ins_constant(GVAR(gstate, n), fn); return; } } else if (!all_readable && imported(mod->str) == module_unloaded) log_error("read of global %s (module %s)", name, mod->str); } else if (!all_readable) log_error("read of global %s", name); } ins2(op_recall + global_var, n, fn); }
static value make_array(cstlist csts) { ulong size = 0; for (cstlist scan = csts; scan; scan = scan->next) size++; struct vector *v = alloc_vector(size); GCPRO1(v); for (cstlist scan = csts; scan; scan = scan->next) { value val = make_constant(scan->cst); assert(immutablep(val)); v->data[--size] = val; } UNGCPRO(); assert(size == 0); v->o.flags |= OBJ_IMMUTABLE | OBJ_READONLY; return v; }
static value make_list(cstlist csts) { if (csts == NULL) return NULL; /* the first entry has the list tail */ struct list *l = csts->cst ? make_constant(csts->cst) : NULL; csts = csts->next; GCPRO1(l); /* Remember that csts is in reverse order ... */ while (csts) { value tmp = make_constant(csts->cst); assert(immutablep(tmp)); l = alloc_list(tmp, l); l->o.flags |= OBJ_READONLY | OBJ_IMMUTABLE; csts = csts->next; } UNGCPRO(); return l; }