diff --git a/src/Makefile.sources b/src/Makefile.sources index f7d458704..8bb291206 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -118,7 +118,6 @@ HB_BASE_sources = \ hb-ot-shape-complex-indic.hh \ hb-ot-shape-complex-khmer.cc \ hb-ot-shape-complex-khmer.hh \ - hb-ot-shape-complex-machine-index.hh \ hb-ot-shape-complex-myanmar.cc \ hb-ot-shape-complex-myanmar.hh \ hb-ot-shape-complex-thai.cc \ diff --git a/src/hb-ot-shape-complex-machine-index.hh b/src/hb-ot-shape-complex-machine-index.hh deleted file mode 100644 index 9ec1f3eb7..000000000 --- a/src/hb-ot-shape-complex-machine-index.hh +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright © 2019,2020 David Corbett - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#ifndef HB_OT_SHAPE_COMPLEX_MACHINE_INDEX_HH -#define HB_OT_SHAPE_COMPLEX_MACHINE_INDEX_HH - -#include "hb.hh" - - -template -struct machine_index_t : - hb_iter_with_fallback_t, - typename Iter::item_t> -{ - machine_index_t (const Iter& it) : it (it) {} - machine_index_t (const machine_index_t& o) : it (o.it) {} - - static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator; - static constexpr bool is_sorted_iterator = Iter::is_sorted_iterator; - - typename Iter::item_t __item__ () const { return *it; } - typename Iter::item_t __item_at__ (unsigned i) const { return it[i]; } - unsigned __len__ () const { return it.len (); } - void __next__ () { ++it; } - void __forward__ (unsigned n) { it += n; } - void __prev__ () { --it; } - void __rewind__ (unsigned n) { it -= n; } - void operator = (unsigned n) - { unsigned index = (*it).first; if (index < n) it += n - index; else if (index > n) it -= index - n; } - void operator = (const machine_index_t& o) { *this = (*o.it).first; } - bool operator == (const machine_index_t& o) const { return (*it).first == (*o.it).first; } - bool operator != (const machine_index_t& o) const { return !(*this == o); } - - private: - Iter it; -}; -struct -{ - template - machine_index_t> - operator () (Iter&& it) const - { return machine_index_t> (hb_iter (it)); } -} -HB_FUNCOBJ (machine_index); - - -#endif /* HB_OT_SHAPE_COMPLEX_MACHINE_INDEX_HH */ diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh index 144e7d3a4..52a2ba91f 100644 --- a/src/hb-ot-shape-complex-use-machine.hh +++ b/src/hb-ot-shape-complex-use-machine.hh @@ -32,10 +32,9 @@ #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #include "hb.hh" -#include "hb-ot-shape-complex-machine-index.hh" -#line 39 "hb-ot-shape-complex-use-machine.hh" +#line 38 "hb-ot-shape-complex-use-machine.hh" static const unsigned char _use_syllable_machine_trans_keys[] = { 1u, 1u, 1u, 1u, 0u, 51u, 11u, 48u, 11u, 48u, 1u, 1u, 22u, 48u, 23u, 48u, 24u, 47u, 25u, 47u, 26u, 47u, 45u, 46u, 46u, 46u, 24u, 48u, 24u, 48u, 24u, 48u, @@ -304,11 +303,11 @@ static const int use_syllable_machine_error = -1; static const int use_syllable_machine_en_main = 2; -#line 39 "hb-ot-shape-complex-use-machine.rl" +#line 38 "hb-ot-shape-complex-use-machine.rl" -#line 154 "hb-ot-shape-complex-use-machine.rl" +#line 153 "hb-ot-shape-complex-use-machine.rl" #define found_syllable(syllable_type) \ @@ -351,7 +350,7 @@ find_syllables_use (hb_buffer_t *buffer) unsigned int act HB_UNUSED; int cs; -#line 355 "hb-ot-shape-complex-use-machine.hh" +#line 354 "hb-ot-shape-complex-use-machine.hh" { cs = use_syllable_machine_start; ts = 0; @@ -359,12 +358,12 @@ find_syllables_use (hb_buffer_t *buffer) act = 0; } -#line 198 "hb-ot-shape-complex-use-machine.rl" +#line 197 "hb-ot-shape-complex-use-machine.rl" unsigned int syllable_serial = 1; -#line 368 "hb-ot-shape-complex-use-machine.hh" +#line 367 "hb-ot-shape-complex-use-machine.hh" { int _slen; int _trans; @@ -378,7 +377,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 382 "hb-ot-shape-complex-use-machine.hh" +#line 381 "hb-ot-shape-complex-use-machine.hh" } _keys = _use_syllable_machine_trans_keys + (cs<<1); @@ -401,62 +400,62 @@ _eof_trans: {te = p+1;} break; case 5: -#line 141 "hb-ot-shape-complex-use-machine.rl" +#line 140 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (independent_cluster); }} break; case 9: -#line 144 "hb-ot-shape-complex-use-machine.rl" +#line 143 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (standard_cluster); }} break; case 7: -#line 149 "hb-ot-shape-complex-use-machine.rl" +#line 148 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (broken_cluster); }} break; case 6: -#line 150 "hb-ot-shape-complex-use-machine.rl" +#line 149 "hb-ot-shape-complex-use-machine.rl" {te = p+1;{ found_syllable (non_cluster); }} break; case 10: -#line 142 "hb-ot-shape-complex-use-machine.rl" +#line 141 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (virama_terminated_cluster); }} break; case 11: -#line 143 "hb-ot-shape-complex-use-machine.rl" +#line 142 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (sakot_terminated_cluster); }} break; case 8: -#line 144 "hb-ot-shape-complex-use-machine.rl" +#line 143 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (standard_cluster); }} break; case 13: -#line 145 "hb-ot-shape-complex-use-machine.rl" +#line 144 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }} break; case 12: -#line 146 "hb-ot-shape-complex-use-machine.rl" +#line 145 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (numeral_cluster); }} break; case 14: -#line 147 "hb-ot-shape-complex-use-machine.rl" +#line 146 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (symbol_cluster); }} break; case 17: -#line 148 "hb-ot-shape-complex-use-machine.rl" +#line 147 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (hieroglyph_cluster); }} break; case 15: -#line 149 "hb-ot-shape-complex-use-machine.rl" +#line 148 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (broken_cluster); }} break; case 16: -#line 150 "hb-ot-shape-complex-use-machine.rl" +#line 149 "hb-ot-shape-complex-use-machine.rl" {te = p;p--;{ found_syllable (non_cluster); }} break; case 1: -#line 149 "hb-ot-shape-complex-use-machine.rl" +#line 148 "hb-ot-shape-complex-use-machine.rl" {{p = ((te))-1;}{ found_syllable (broken_cluster); }} break; -#line 460 "hb-ot-shape-complex-use-machine.hh" +#line 459 "hb-ot-shape-complex-use-machine.hh" } _again: @@ -465,7 +464,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 469 "hb-ot-shape-complex-use-machine.hh" +#line 468 "hb-ot-shape-complex-use-machine.hh" } if ( ++p != pe ) @@ -481,7 +480,7 @@ _again: } -#line 203 "hb-ot-shape-complex-use-machine.rl" +#line 202 "hb-ot-shape-complex-use-machine.rl" } diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl index 364ba0d1b..aa86ac536 100644 --- a/src/hb-ot-shape-complex-use-machine.rl +++ b/src/hb-ot-shape-complex-use-machine.rl @@ -30,7 +30,6 @@ #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #include "hb.hh" -#include "hb-ot-shape-complex-machine-index.hh" %%{ machine use_syllable_machine; diff --git a/src/hb-ot-shape-complex-use.hh b/src/hb-ot-shape-complex-use.hh index 788fb6b6a..08bcfd47d 100644 --- a/src/hb-ot-shape-complex-use.hh +++ b/src/hb-ot-shape-complex-use.hh @@ -93,4 +93,43 @@ enum use_category_t { HB_INTERNAL USE_TABLE_ELEMENT_TYPE hb_use_get_category (hb_codepoint_t u); + +template +struct machine_index_t : + hb_iter_with_fallback_t, + typename Iter::item_t> +{ + machine_index_t (const Iter& it) : it (it) {} + machine_index_t (const machine_index_t& o) : it (o.it) {} + + static constexpr bool is_random_access_iterator = Iter::is_random_access_iterator; + static constexpr bool is_sorted_iterator = Iter::is_sorted_iterator; + + typename Iter::item_t __item__ () const { return *it; } + typename Iter::item_t __item_at__ (unsigned i) const { return it[i]; } + unsigned __len__ () const { return it.len (); } + void __next__ () { ++it; } + void __forward__ (unsigned n) { it += n; } + void __prev__ () { --it; } + void __rewind__ (unsigned n) { it -= n; } + void operator = (unsigned n) + { unsigned index = (*it).first; if (index < n) it += n - index; else if (index > n) it -= index - n; } + void operator = (const machine_index_t& o) { *this = (*o.it).first; } + bool operator == (const machine_index_t& o) const { return (*it).first == (*o.it).first; } + bool operator != (const machine_index_t& o) const { return !(*this == o); } + + private: + Iter it; +}; +struct +{ + template + machine_index_t> + operator () (Iter&& it) const + { return machine_index_t> (hb_iter (it)); } +} +HB_FUNCOBJ (machine_index); + + #endif /* HB_OT_SHAPE_COMPLEX_USE_HH */