Lines Matching refs:idx

378 	size_t idx;  member
1192 static void bc_vec_pushAt(BcVec *v, const void *data, size_t idx) in bc_vec_pushAt() argument
1194 if (idx == v->len) in bc_vec_pushAt()
1201 ptr = v->v + v->size * idx; in bc_vec_pushAt()
1203 memmove(ptr + v->size, ptr, v->size * (v->len++ - idx)); in bc_vec_pushAt()
1218 static void *bc_vec_item(const BcVec *v, size_t idx) in bc_vec_item() argument
1220 return v->v + v->size * idx; in bc_vec_item()
1223 static void *bc_vec_item_rev(const BcVec *v, size_t idx) in bc_vec_item_rev() argument
1225 return v->v + v->size * (v->len - idx - 1); in bc_vec_item_rev()
1240 static BcFunc* xc_program_func(size_t idx) in xc_program_func() argument
1242 return bc_vec_item(&G.prog.fns, idx); in xc_program_func()
1256 static char** xc_program_str(size_t idx) in xc_program_str() argument
1261 return bc_vec_item(&func->strs, idx); in xc_program_str()
1264 IF_DC(return bc_vec_item(&G.prog.strs, idx);) in xc_program_str()
1267 static char** xc_program_const(size_t idx) in xc_program_const() argument
1272 return bc_vec_item(&func->consts, idx); in xc_program_const()
1275 IF_DC(return bc_vec_item(&G.prog.consts, idx);) in xc_program_const()
1594 static void bc_num_split(BcNum *restrict n, size_t idx, BcNum *restrict a, in bc_num_split() argument
1597 if (idx < n->len) { in bc_num_split()
1598 b->len = n->len - idx; in bc_num_split()
1599 a->len = idx; in bc_num_split()
1602 memcpy(b->num, n->num + idx, b->len * sizeof(BcDig)); in bc_num_split()
1603 memcpy(a->num, n->num, idx * sizeof(BcDig)); in bc_num_split()
3617 static void bc_vec_pushIndex(BcVec *v, size_t idx) in bc_vec_pushIndex() argument
3622 dbg_lex("%s:%d pushing index %zd", __func__, __LINE__, idx); in bc_vec_pushIndex()
3623 if (idx < SMALL_INDEX_LIMIT) { in bc_vec_pushIndex()
3624 bc_vec_pushByte(v, idx); in bc_vec_pushIndex()
3628 mask = ((size_t)0xff) << (sizeof(idx) * 8 - 8); in bc_vec_pushIndex()
3629 amt = sizeof(idx); in bc_vec_pushIndex()
3631 if (idx & mask) break; in bc_vec_pushIndex()
3640 bc_vec_pushByte(v, (unsigned char)idx); in bc_vec_pushIndex()
3641 idx >>= 8; in bc_vec_pushIndex()
3642 } while (idx != 0); in bc_vec_pushIndex()
3645 static void xc_parse_pushIndex(size_t idx) in xc_parse_pushIndex() argument
3647 bc_vec_pushIndex(&G.prs.func->code, idx); in xc_parse_pushIndex()
3650 static void xc_parse_pushInst_and_Index(unsigned inst, size_t idx) in xc_parse_pushInst_and_Index() argument
3653 xc_parse_pushIndex(idx); in xc_parse_pushInst_and_Index()
3657 static void bc_parse_pushJUMP(size_t idx) in bc_parse_pushJUMP() argument
3659 xc_parse_pushInst_and_Index(BC_INST_JUMP, idx); in bc_parse_pushJUMP()
3662 static void bc_parse_pushJUMP_ZERO(size_t idx) in bc_parse_pushJUMP_ZERO() argument
3664 xc_parse_pushInst_and_Index(BC_INST_JUMP_ZERO, idx); in bc_parse_pushJUMP_ZERO()
3685 size_t idx = bc_vec_push(IS_BC ? &p->func->consts : &G.prog.consts, &num); in xc_parse_pushNUM() local
3687 size_t idx = bc_vec_push(&p->func->consts, &num); in xc_parse_pushNUM() local
3689 size_t idx = bc_vec_push(&G.prog.consts, &num); in xc_parse_pushNUM() local
3691 xc_parse_pushInst_and_Index(XC_INST_NUM, idx); in xc_parse_pushNUM()
3778 size_t idx; in bc_program_addFunc() local
3783 entry.idx = G.prog.fns.len; in bc_program_addFunc()
3785 inserted = bc_map_insert(&G.prog.fn_map, &entry, &idx); in bc_program_addFunc()
3788 entry_ptr = bc_vec_item(&G.prog.fn_map, idx); in bc_program_addFunc()
3789 idx = entry_ptr->idx; in bc_program_addFunc()
3794 BcFunc *func = xc_program_func(entry_ptr->idx); in bc_program_addFunc()
3801 return idx; in bc_program_addFunc()
3923 size_t idx; in zbc_parse_call() local
3935 idx = bc_map_find_exact(&G.prog.fn_map, &entry); in zbc_parse_call()
3937 if (idx == BC_VEC_INVALID_IDX) { in zbc_parse_call()
3940 idx = bc_map_find_exact(&G.prog.fn_map, &entry); in zbc_parse_call()
3944 entry_ptr = bc_vec_item(&G.prog.fn_map, idx); in zbc_parse_call()
3945 xc_parse_pushIndex(entry_ptr->idx); in zbc_parse_call()
4229 static void rewrite_label_to_current(size_t idx) in rewrite_label_to_current() argument
4232 size_t *label = bc_vec_item(&p->func->labels, idx); in rewrite_label_to_current()
4443 && type == (BcType) autoid->idx in zbc_func_insert()
4449 a.idx = type; in zbc_func_insert()
5292 e.idx = v->len; in xc_program_search()
5303 return bc_vec_item(v, ptr->idx); in xc_program_search()
5323 str = *xc_program_const(r->d.id.idx); in zxc_program_num()
5345 size_t idx = r->d.id.idx; in zxc_program_num() local
5351 if (v->len <= idx) in zxc_program_num()
5352 bc_array_expand(v, idx + 1); in zxc_program_num()
5353 *num = bc_vec_item(v, idx); in zxc_program_num()
5743 #define xc_program_print(inst, idx) \ argument
5746 static BC_STATUS xc_program_print(char inst, size_t idx) in xc_program_print() argument
5751 IF_NOT_DC(size_t idx = 0); in xc_program_print()
5753 if (!STACK_HAS_MORE_THAN(&G.prog.results, idx)) in xc_program_print()
5756 r = bc_vec_item_rev(&G.prog.results, idx); in xc_program_print()
5773 idx = (r->t == XC_RESULT_STR) ? r->d.id.idx : num->rdx; in xc_program_print()
5774 str = *xc_program_str(idx); in xc_program_print()
5869 n2.rdx = res.d.id.idx = r->d.id.idx; in zdc_program_assignStr()
5930 size_t vidx, idx; in zxc_program_popResultAndCopyToVar() local
5941 vidx = ((BcId*) bc_vec_item(&G.prog.arr_map, vidx))->idx; in zxc_program_popResultAndCopyToVar()
5942 idx = v->len - 1; in zxc_program_popResultAndCopyToVar()
5945 bc_vec_pushIndex(&r.d.v, idx); in zxc_program_popResultAndCopyToVar()
6080 r.d.id.idx = num->rdx; in xc_program_pushVar()
6118 r.d.id.idx = (size_t) temp; in zbc_program_pushArray()
6160 static BC_STATUS zbc_program_call(char *code, size_t *idx) in zbc_program_call() argument
6167 nparams = xc_program_index(code, idx); in zbc_program_call()
6168 ip.func = xc_program_index(code, idx); in zbc_program_call()
6187 arr = (a->idx == BC_TYPE_ARRAY || a->idx == BC_TYPE_REF); in zbc_program_call()
6194 s = zxc_program_popResultAndCopyToVar(a->name, (BcType) a->idx); in zbc_program_call()
6202 v = xc_program_search(a->name, (BcType) a->idx); in zbc_program_call()
6203 if (a->idx == BC_TYPE_VAR) { in zbc_program_call()
6258 v = xc_program_search(a->name, (BcType) a->idx); in zbc_program_return()
6324 size_t idx = opnd->t == XC_RESULT_STR ? opnd->d.id.idx : num->rdx; in zxc_program_builtin() local
6326 str = xc_program_str(idx); in zxc_program_builtin()
6433 size_t idx; in zdc_program_asciify() local
6465 idx = (r->t == XC_RESULT_STR) ? r->d.id.idx : num->rdx; in zdc_program_asciify()
6466 sp = *xc_program_str(idx); in zdc_program_asciify()
6471 for (idx = 0; idx < G.prog.strs.len; idx++) { in zdc_program_asciify()
6472 if (strs[idx][0] == c && strs[idx][1] == '\0') { in zdc_program_asciify()
6479 idx = bc_vec_push(&G.prog.strs, &str); in zdc_program_asciify()
6486 res.d.id.idx = idx; in zdc_program_asciify()
6501 size_t idx; in zdc_program_printStream() local
6514 idx = (r->t == XC_RESULT_STR) ? r->d.id.idx : n->rdx; in zdc_program_printStream()
6515 str = *xc_program_str(idx); in zdc_program_printStream()
6599 sidx = r->d.id.idx; in zdc_program_execStr()
6711 size_t idx = xc_program_index(code, &ip->inst_idx); in zxc_program_exec() local
6712 size_t *addr = bc_vec_item(&func->labels, idx); in zxc_program_exec()
6779 r.d.id.idx = xc_program_index(code, &ip->inst_idx); in zxc_program_exec()
6798 r.d.id.idx = xc_program_index(code, &ip->inst_idx); in zxc_program_exec()
6857 size_t idx; in zxc_program_exec() local
6859 for (idx = 0; idx < G.prog.results.len; ++idx) { in zxc_program_exec()
6860 s = zxc_program_print(XC_INST_PRINT, idx); in zxc_program_exec()