/* * NAME: kfun->compile_object() * DESCRIPTION: compile an object */ int kf_compile_object(frame *f, int nargs) { char file[STRINGSZ]; value *v; object *obj; string **strs; int i; v = &f->sp[nargs - 1]; if (path_string(file, v->u.string->text, v->u.string->len) == (char *) NULL) { return 1; } obj = o_find(file, OACC_MODIFY); if (obj != (object *) NULL) { if (!(obj->flags & O_MASTER)) { error("Cannot recompile cloned object"); } if (O_UPGRADING(obj)) { error("Object is already being upgraded"); } if (O_INHERITED(obj)) { error("Cannot recompile inherited object"); } } if (--nargs != 0) { strs = ALLOCA(string*, nargs); for (i = nargs, v = f->sp; i > 0; --i) { *strs++ = (v++)->u.string; } if (ec_push((ec_ftn) NULL)) { AFREE(strs - nargs); error((char *) NULL); } } else {
/* * NAME: data->get_varmap() * DESCRIPTION: get the variable mapping for an object */ static unsigned short *d_get_varmap(object **obj, Uint update, unsigned short *nvariables) { object *tmpl; unsigned short nvar, *vmap; tmpl = OBJ((*obj)->prev); if (O_UPGRADING(*obj)) { /* in the middle of an upgrade */ tmpl = OBJ(tmpl->prev); } vmap = o_control(tmpl)->vmap; nvar = tmpl->ctrl->vmapsize; if (tmpl->update != update) { unsigned short *m1, *m2, n; m1 = vmap; vmap = ALLOC(unsigned short, n = nvar); do { tmpl = OBJ(tmpl->prev); m2 = o_control(tmpl)->vmap; while (n > 0) { *vmap++ = (NEW_VAR(*m1)) ? *m1++ : m2[*m1++]; --n; } n = nvar; vmap -= n; m1 = vmap; } while (tmpl->update != update); }
/* * NAME: kfun->old_compile_object() * DESCRIPTION: compile an object */ int kf_old_compile_object(frame *f) { char file[STRINGSZ]; object *obj; if (path_string(file, f->sp->u.string->text, f->sp->u.string->len) == (char *) NULL) { return 1; } obj = o_find(file, OACC_MODIFY); if (obj != (object *) NULL) { if (!(obj->flags & O_MASTER)) { error("Cannot recompile cloned object"); } if (O_UPGRADING(obj)) { error("Object is already being upgraded"); } if (O_INHERITED(obj)) { error("Cannot recompile inherited object"); } } obj = c_compile(f, file, obj, (string **) NULL, 0, (OBJR(f->oindex)->flags & O_DRIVER) && strcmp(d_get_strconst(f->p_ctrl, f->func->inherit, f->func->index)->text, "inherit_program") == 0); str_del(f->sp->u.string); PUT_OBJVAL(f->sp, obj); return 0; }
/* * NAME: kfun->compile_object() * DESCRIPTION: compile an object */ int kf_compile_object(Frame *f, int nargs, kfunc *kf) { char file[STRINGSZ]; Value *v; Object *obj; String **strs; int i; bool iflag; UNREFERENCED_PARAMETER(kf); v = &f->sp[nargs - 1]; if (path_string(file, v->u.string->text, v->u.string->len) == (char *) NULL) { return 1; } obj = o_find(file, OACC_MODIFY); if (obj != (Object *) NULL) { if (!(obj->flags & O_MASTER)) { error("Cannot recompile cloned object"); } if (O_UPGRADING(obj)) { error("Object is already being upgraded"); } if (O_INHERITED(obj)) { error("Cannot recompile inherited object"); } } if (--nargs != 0) { strs = ALLOCA(String*, nargs); for (i = nargs, v = f->sp; i > 0; --i) { *strs++ = (v++)->u.string; } } else {