Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. MVMCodepoint last_a_first_b[2] = {
  2. MVM_string_get_grapheme_at_nocheck(tc, a, a->body.num_graphs - 1),
  3. MVM_string_get_grapheme_at_nocheck(tc, b, 0)
  4. };
  5. MVMROOT(tc, a, {
  6. MVMROOT(tc, b, {
  7. /* Needing both to be CCC = 0 can probably be relaxed some, but be careful optimizing */
  8. if (0 <= last_a_first_b[0] && 0 <= last_a_first_b[1] /*&& MVM_unicode_relative_ccc(tc, last_a_first_b[0]) == 0*/ ) {
  9. renormalized_section = MVM_unicode_codepoints_c_array_to_nfg_string(tc, last_a_first_b, 2);
  10. consumed_a = 1; consumed_b = 1;
  11. }
  12. else {
  13. MVMCodepointIter last_a_ci, first_b_ci;
  14. int a_codes = MVM_string_grapheme_ci_init(tc, &last_a_ci, last_a_first_b[0]);
  15. int b_codes = MVM_string_grapheme_ci_init(tc, &first_b_ci, last_a_first_b[1]);
  16. MVMCodepoint thing[a_codes + b_codes];
  17. int i;
  18. for (i = 0; MVM_string_grapheme_ci_has_more(tc, &last_a_ci); i++) {
  19. thing[i] = MVM_string_grapheme_ci_get_codepoint(tc, &last_a_ci);
  20. //fprintf(stderr, "Got from a %ith char. got %i\n", i, thing[i]);
  21. }
  22. for (; MVM_string_grapheme_ci_has_more(tc, &first_b_ci); i++) {
  23. thing[i] = MVM_string_grapheme_ci_get_codepoint(tc, &first_b_ci);
  24. //fprintf(stderr, "Got from b %ith char. got %i\n", i, thing[i]);
  25. }
  26. renormalized_section = MVM_unicode_codepoints_c_array_to_nfg_string(tc, thing, a_codes + b_codes);
  27. consumed_a = 1; consumed_b = 1;
  28. }
  29. });
  30. });
  31. if (renormalized_section) {
  32. if (agraphs == consumed_a && bgraphs == consumed_b)
  33. return renormalized_section;
  34. renormalized_section_graphs = MVM_string_graphs(tc, renormalized_section);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement