Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MVMCodepoint last_a_first_b[2] = {
- MVM_string_get_grapheme_at_nocheck(tc, a, a->body.num_graphs - 1),
- MVM_string_get_grapheme_at_nocheck(tc, b, 0)
- };
- MVMROOT(tc, a, {
- MVMROOT(tc, b, {
- /* Needing both to be CCC = 0 can probably be relaxed some, but be careful optimizing */
- if (0 <= last_a_first_b[0] && 0 <= last_a_first_b[1] /*&& MVM_unicode_relative_ccc(tc, last_a_first_b[0]) == 0*/ ) {
- renormalized_section = MVM_unicode_codepoints_c_array_to_nfg_string(tc, last_a_first_b, 2);
- consumed_a = 1; consumed_b = 1;
- }
- else {
- MVMCodepointIter last_a_ci, first_b_ci;
- int a_codes = MVM_string_grapheme_ci_init(tc, &last_a_ci, last_a_first_b[0]);
- int b_codes = MVM_string_grapheme_ci_init(tc, &first_b_ci, last_a_first_b[1]);
- MVMCodepoint thing[a_codes + b_codes];
- int i;
- for (i = 0; MVM_string_grapheme_ci_has_more(tc, &last_a_ci); i++) {
- thing[i] = MVM_string_grapheme_ci_get_codepoint(tc, &last_a_ci);
- //fprintf(stderr, "Got from a %ith char. got %i\n", i, thing[i]);
- }
- for (; MVM_string_grapheme_ci_has_more(tc, &first_b_ci); i++) {
- thing[i] = MVM_string_grapheme_ci_get_codepoint(tc, &first_b_ci);
- //fprintf(stderr, "Got from b %ith char. got %i\n", i, thing[i]);
- }
- renormalized_section = MVM_unicode_codepoints_c_array_to_nfg_string(tc, thing, a_codes + b_codes);
- consumed_a = 1; consumed_b = 1;
- }
- });
- });
- if (renormalized_section) {
- if (agraphs == consumed_a && bgraphs == consumed_b)
- return renormalized_section;
- renormalized_section_graphs = MVM_string_graphs(tc, renormalized_section);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement