Assembler* AsmNew() { Assembler *a=ObjNew(Assembler, 1); a->codes = ArrayNew(10); a->symTable = HashTableNew(127); a->opTable = OpTableNew(); return a; }
AsmCode* AsmCodeNew(char *line) { AsmCode* code = ObjNew(AsmCode,1); char head[MAX_LEN]; strCut(line, "/", head, NULL); Array* tokens = split(head, " \t+[],", REMOVE_SPLITER); if (tokens->count == 0) { ArrayFree(tokens, strFree); ObjFree(code); return NULL; } code->line = strNew(head); strTrim(code->line, code->line, SPACE); code->tokens = tokens; int tokenIdx = 0; if (strTail(tokens->item[0], ":")) { code->label = ArrayGet(tokens, tokenIdx++); strTrim(code->label, code->label, ":"); } else code->label = NULL; code->op = ArrayGet(tokens, tokenIdx++); code->opCode = OP_NULL; code->argStart = tokenIdx; code->arg[0] = ArrayGet(tokens, tokenIdx++); code->arg[1] = ArrayGet(tokens, tokenIdx++); code->arg[2] = ArrayGet(tokens, tokenIdx++); // AsmCodePrintln(code); return code; }
struct objcore * HSH_Private(struct worker *wrk) { struct objcore *oc; CHECK_OBJ_NOTNULL(private_oh, OBJHEAD_MAGIC); oc = ObjNew(wrk); AN(oc); oc->refcnt = 1; oc->objhead = private_oh; oc->flags |= OC_F_PRIVATE; Lck_Lock(&private_oh->mtx); VTAILQ_INSERT_TAIL(&private_oh->objcs, oc, hsh_list); private_oh->refcnt++; Lck_Unlock(&private_oh->mtx); return (oc); }
/* Precreate an objhead and object for later use */ static void hsh_prealloc(struct worker *wrk) { CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); if (wrk->nobjcore == NULL) wrk->nobjcore = ObjNew(wrk); CHECK_OBJ_NOTNULL(wrk->nobjcore, OBJCORE_MAGIC); if (wrk->nobjhead == NULL) { wrk->nobjhead = hsh_newobjhead(); wrk->stats->n_objecthead++; } CHECK_OBJ_NOTNULL(wrk->nobjhead, OBJHEAD_MAGIC); if (hash->prep != NULL) hash->prep(wrk); }
Interpreter *InterNew() { Interpreter *o = ObjNew(Interpreter, 1); return o; }
/* ObjectInstance */ struct ObjectInstance *ScnNewObjectInstance(struct Scene *scene, const struct Accelerator *acc) { return (struct ObjectInstance *) push_entry(scene->ObjectInstanceList, ObjNew(acc)); }