Lines Matching refs:idx
23 static void re_string_construct_common (const char *str, Idx len,
43 re_string_allocate (re_string_t *pstr, const char *str, Idx len, Idx init_len,
47 Idx init_buf_len;
71 re_string_construct (re_string_t *pstr, const char *str, Idx len,
134 re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
142 size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
152 Idx *new_offsets = re_realloc (pstr->offsets, Idx, new_buf_len);
174 re_string_construct_common (const char *str, Idx len, re_string_t *pstr,
215 Idx byte_idx, end_idx, remain_len;
277 Idx src_idx, byte_idx, end_idx, remain_len;
406 pstr->offsets = re_malloc (Idx, pstr->bufs_len);
488 static Idx
490 re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
493 Idx rawbuf_idx;
502 Idx remain_len;
534 Idx char_idx, end_idx;
557 Idx buf_idx, end_idx;
576 re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
578 Idx offset;
580 idx, 0))
581 offset = idx - pstr->raw_mbs_idx;
599 offset = idx;
611 Idx low = 0, high = pstr->valid_len, mid;
646 pstr->len = pstr->raw_len - idx + offset;
647 pstr->stop = pstr->raw_stop - idx + offset;
694 /* No, skip all characters until IDX. */
695 Idx prev_valid_len = pstr->valid_len;
699 pstr->len = pstr->raw_len - idx + offset;
700 pstr->stop = pstr->raw_stop - idx + offset;
708 Idx wcs_idx;
738 Idx mlen = raw + pstr->len - p;
766 pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx;
802 pstr->raw_mbs_idx = idx;
837 re_string_peek_byte_case (const re_string_t *pstr, Idx idx)
840 Idx off;
844 return re_string_peek_byte (pstr, idx);
848 && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
849 return re_string_peek_byte (pstr, idx);
852 off = pstr->cur_idx + idx;
866 return re_string_peek_byte (pstr, idx);
882 Idx off;
922 /* Return the context at IDX in INPUT. */
926 re_string_context_at (const re_string_t *input, Idx idx, int eflags)
929 if (BE (! REG_VALID_INDEX (idx), 0))
933 if (BE (idx == input->len, 0))
940 Idx wc_idx = idx;
960 c = re_string_byte_at (input, idx);
972 re_node_set_alloc (re_node_set *set, Idx size)
976 set->elems = re_malloc (Idx, size);
984 re_node_set_init_1 (re_node_set *set, Idx elem)
988 set->elems = re_malloc (Idx, 1);
1000 re_node_set_init_2 (re_node_set *set, Idx elem1, Idx elem2)
1003 set->elems = re_malloc (Idx, 2);
1036 dest->elems = re_malloc (Idx, dest->alloc);
1042 memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
1058 Idx i1, i2, is, id, delta, sbase;
1066 Idx new_alloc = src1->nelem + src2->nelem + dest->alloc;
1067 Idx *new_elems = re_realloc (dest->elems, Idx, new_alloc);
1136 memcpy (dest->elems, dest->elems + sbase, delta * sizeof (Idx));
1149 Idx i1, i2, id;
1153 dest->elems = re_malloc (Idx, dest->alloc);
1181 (src1->nelem - i1) * sizeof (Idx));
1187 (src2->nelem - i2) * sizeof (Idx));
1201 Idx is, id, sbase, delta;
1206 Idx new_alloc = 2 * (src->nelem + dest->alloc);
1207 Idx *new_buffer = re_realloc (dest->elems, Idx, new_alloc);
1217 memcpy (dest->elems, src->elems, src->nelem * sizeof (Idx));
1239 memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (Idx));
1268 delta * sizeof (Idx));
1283 re_node_set_insert (re_node_set *set, Idx elem)
1285 Idx idx;
1301 Idx *new_elems;
1303 new_elems = re_realloc (set->elems, Idx, set->alloc);
1313 idx = 0;
1314 for (idx = set->nelem; idx > 0; idx--)
1315 set->elems[idx] = set->elems[idx - 1];
1319 for (idx = set->nelem; set->elems[idx - 1] > elem; idx--)
1320 set->elems[idx] = set->elems[idx - 1];
1324 set->elems[idx] = elem;
1335 re_node_set_insert_last (re_node_set *set, Idx elem)
1340 Idx *new_elems;
1342 new_elems = re_realloc (set->elems, Idx, set->alloc);
1360 Idx i;
1369 /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */
1371 static Idx
1373 re_node_set_contains (const re_node_set *set, Idx elem)
1375 __re_size_t idx, right, mid;
1380 idx = 0;
1382 while (idx < right)
1384 mid = (idx + right) / 2;
1386 idx = mid + 1;
1390 return set->elems[idx] == elem ? idx + 1 : 0;
1395 re_node_set_remove_at (re_node_set *set, Idx idx)
1397 if (idx < 0 || idx >= set->nelem)
1400 for (; idx < set->nelem; idx++)
1401 set->elems[idx] = set->elems[idx + 1];
1409 static Idx
1416 Idx *new_nexts, *new_indices;
1422 sizeof (Idx)));
1432 new_nexts = re_realloc (dfa->nexts, Idx, new_nodes_alloc);
1433 new_indices = re_realloc (dfa->org_indices, Idx, new_nodes_alloc);
1465 Idx i;
1488 Idx i;
1536 Idx i;
1575 Idx i;
1583 Idx elem = newstate->nodes.elems[i];
1592 Idx new_alloc = 2 * spot->num + 2;
1628 Idx i;
1678 Idx i, nctx_nodes = 0;