diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index 200f353e6..b1fb3cbed 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -379,7 +379,7 @@ ASSERT_SIZE (MarkRecord, 4); struct MarkArray { - inline bool apply (APPLY_ARG_DEF, + inline bool apply (hb_apply_context_t *context, unsigned int mark_index, unsigned int glyph_index, const AnchorMatrix &anchors, unsigned int class_count, unsigned int glyph_pos) const @@ -426,7 +426,7 @@ struct SinglePosFormat1 friend struct SinglePos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int index = (this+coverage) (IN_CURGLYPH ()); @@ -464,7 +464,7 @@ struct SinglePosFormat2 friend struct SinglePos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int index = (this+coverage) (IN_CURGLYPH ()); @@ -507,12 +507,12 @@ struct SinglePos friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); - case 2: return u.format2->apply (APPLY_ARG); + case 1: return u.format1->apply (context); + case 2: return u.format2->apply (context); default:return false; } } @@ -574,7 +574,7 @@ struct PairPosFormat1 friend struct PairPos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int end = MIN (context->buffer->in_length, context->buffer->in_pos + context->context_length); @@ -667,7 +667,7 @@ struct PairPosFormat2 friend struct PairPos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int end = MIN (context->buffer->in_length, context->buffer->in_pos + context->context_length); @@ -757,12 +757,12 @@ struct PairPos friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); - case 2: return u.format2->apply (APPLY_ARG); + case 1: return u.format1->apply (context); + case 2: return u.format2->apply (context); default:return false; } } @@ -812,7 +812,7 @@ struct CursivePosFormat1 friend struct CursivePos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); /* Now comes the messiest part of the whole OpenType @@ -1009,11 +1009,11 @@ struct CursivePos friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -1045,7 +1045,7 @@ struct MarkBasePosFormat1 friend struct MarkBasePos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ()); @@ -1072,7 +1072,7 @@ struct MarkBasePosFormat1 if (base_index == NOT_COVERED) return false; - return (this+markArray).apply (APPLY_ARG, mark_index, base_index, this+baseArray, classCount, j); + return (this+markArray).apply (context, mark_index, base_index, this+baseArray, classCount, j); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -1107,11 +1107,11 @@ struct MarkBasePos friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -1148,7 +1148,7 @@ struct MarkLigPosFormat1 friend struct MarkLigPos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ()); @@ -1196,7 +1196,7 @@ struct MarkLigPosFormat1 else comp_index = comp_count - 1; - return (this+markArray).apply (APPLY_ARG, mark_index, comp_index, lig_attach, classCount, j); + return (this+markArray).apply (context, mark_index, comp_index, lig_attach, classCount, j); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -1232,11 +1232,11 @@ struct MarkLigPos friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -1268,7 +1268,7 @@ struct MarkMarkPosFormat1 friend struct MarkMarkPos; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); unsigned int mark1_index = (this+mark1Coverage) (IN_CURGLYPH ()); @@ -1299,7 +1299,7 @@ struct MarkMarkPosFormat1 if (mark2_index == NOT_COVERED) return false; - return (this+mark1Array).apply (APPLY_ARG, mark1_index, mark2_index, this+mark2Array, classCount, j); + return (this+mark1Array).apply (context, mark1_index, mark2_index, this+mark2Array, classCount, j); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -1336,11 +1336,11 @@ struct MarkMarkPos friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -1362,17 +1362,17 @@ struct MarkMarkPos }; -static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index); +static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index); struct ContextPos : Context { friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); - return Context::apply (APPLY_ARG, position_lookup); + return Context::apply (context, position_lookup); } }; @@ -1381,10 +1381,10 @@ struct ChainContextPos : ChainContext friend struct PosLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); - return ChainContext::apply (APPLY_ARG, position_lookup); + return ChainContext::apply (context, position_lookup); } }; @@ -1401,7 +1401,7 @@ struct ExtensionPos : Extension return StructAtOffset (*this, offset); } - inline bool apply (APPLY_ARG_DEF) const; + inline bool apply (hb_apply_context_t *context) const; inline bool sanitize (hb_sanitize_context_t *context); }; @@ -1429,19 +1429,19 @@ struct PosLookupSubTable Extension = 9 }; - inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const + inline bool apply (hb_apply_context_t *context, unsigned int lookup_type) const { TRACE_APPLY (); switch (lookup_type) { - case Single: return u.single->apply (APPLY_ARG); - case Pair: return u.pair->apply (APPLY_ARG); - case Cursive: return u.cursive->apply (APPLY_ARG); - case MarkBase: return u.markBase->apply (APPLY_ARG); - case MarkLig: return u.markLig->apply (APPLY_ARG); - case MarkMark: return u.markMark->apply (APPLY_ARG); - case Context: return u.context->apply (APPLY_ARG); - case ChainContext: return u.chainContext->apply (APPLY_ARG); - case Extension: return u.extension->apply (APPLY_ARG); + case Single: return u.single->apply (context); + case Pair: return u.pair->apply (context); + case Cursive: return u.cursive->apply (context); + case MarkBase: return u.markBase->apply (context); + case MarkLig: return u.markLig->apply (context); + case MarkMark: return u.markMark->apply (context); + case Context: return u.context->apply (context); + case ChainContext: return u.chainContext->apply (context); + case Extension: return u.extension->apply (context); default:return false; } } @@ -1502,7 +1502,7 @@ struct PosLookup : Lookup return false; for (unsigned int i = 0; i < get_subtable_count (); i++) - if (get_subtable (i).apply (APPLY_ARG, lookup_type)) + if (get_subtable (i).apply (context, lookup_type)) return true; return false; @@ -1585,10 +1585,10 @@ ASSERT_SIZE (GPOS, 10); /* Out-of-class implementation for methods recursing */ -inline bool ExtensionPos::apply (APPLY_ARG_DEF) const +inline bool ExtensionPos::apply (hb_apply_context_t *context) const { TRACE_APPLY (); - return get_subtable ().apply (APPLY_ARG, get_type ()); + return get_subtable ().apply (context, get_type ()); } inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context) @@ -1600,7 +1600,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context) return SANITIZE (StructAtOffset (*this, offset)); } -static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index) +static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index) { const GPOS &gpos = *(context->layout->face->ot_layout.gpos); const PosLookup &l = gpos.get_lookup (lookup_index); diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index 19297c483..5cea951f7 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -40,7 +40,7 @@ struct SingleSubstFormat1 private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); hb_codepoint_t glyph_id = IN_CURGLYPH (); @@ -80,7 +80,7 @@ struct SingleSubstFormat2 private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); hb_codepoint_t glyph_id = IN_CURGLYPH (); @@ -124,12 +124,12 @@ struct SingleSubst private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); - case 2: return u.format2->apply (APPLY_ARG); + case 1: return u.format1->apply (context); + case 2: return u.format2->apply (context); default:return false; } } @@ -158,7 +158,7 @@ struct Sequence friend struct MultipleSubstFormat1; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); if (unlikely (!substitute.len)) @@ -201,7 +201,7 @@ struct MultipleSubstFormat1 private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); @@ -209,7 +209,7 @@ struct MultipleSubstFormat1 if (likely (index == NOT_COVERED)) return false; - return (this+sequence[index]).apply (APPLY_ARG); + return (this+sequence[index]).apply (context); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -235,11 +235,11 @@ struct MultipleSubst private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -271,7 +271,7 @@ struct AlternateSubstFormat1 private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); hb_codepoint_t glyph_id = IN_CURGLYPH (); @@ -331,11 +331,11 @@ struct AlternateSubst private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -362,7 +362,7 @@ struct Ligature friend struct LigatureSet; private: - inline bool apply (APPLY_ARG_DEF, bool is_mark) const + inline bool apply (hb_apply_context_t *context, bool is_mark) const { TRACE_APPLY (); unsigned int i, j; @@ -445,14 +445,14 @@ struct LigatureSet friend struct LigatureSubstFormat1; private: - inline bool apply (APPLY_ARG_DEF, bool is_mark) const + inline bool apply (hb_apply_context_t *context, bool is_mark) const { TRACE_APPLY (); unsigned int num_ligs = ligature.len; for (unsigned int i = 0; i < num_ligs; i++) { const Ligature &lig = this+ligature[i]; - if (lig.apply (APPLY_ARG, is_mark)) + if (lig.apply (context, is_mark)) return true; } @@ -477,7 +477,7 @@ struct LigatureSubstFormat1 friend struct LigatureSubst; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); hb_codepoint_t glyph_id = IN_CURGLYPH (); @@ -489,7 +489,7 @@ struct LigatureSubstFormat1 return false; const LigatureSet &lig_set = this+ligatureSet[index]; - return lig_set.apply (APPLY_ARG, first_is_mark); + return lig_set.apply (context, first_is_mark); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -514,11 +514,11 @@ struct LigatureSubst friend struct SubstLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -541,17 +541,17 @@ struct LigatureSubst -static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index); +static inline bool substitute_lookup (hb_apply_context_t *context, unsigned int lookup_index); struct ContextSubst : Context { friend struct SubstLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); - return Context::apply (APPLY_ARG, substitute_lookup); + return Context::apply (context, substitute_lookup); } }; @@ -560,10 +560,10 @@ struct ChainContextSubst : ChainContext friend struct SubstLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); - return ChainContext::apply (APPLY_ARG, substitute_lookup); + return ChainContext::apply (context, substitute_lookup); } }; @@ -581,7 +581,7 @@ struct ExtensionSubst : Extension return StructAtOffset (*this, offset); } - inline bool apply (APPLY_ARG_DEF) const; + inline bool apply (hb_apply_context_t *context) const; inline bool sanitize (hb_sanitize_context_t *context); @@ -594,7 +594,7 @@ struct ReverseChainSingleSubstFormat1 friend struct ReverseChainSingleSubst; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); if (unlikely (context->context_length != NO_CONTEXT)) @@ -607,10 +607,10 @@ struct ReverseChainSingleSubstFormat1 const OffsetArrayOf &lookahead = StructAfter > (backtrack); const ArrayOf &substitute = StructAfter > (lookahead); - if (match_backtrack (APPLY_ARG, + if (match_backtrack (context, backtrack.len, (USHORT *) backtrack.array(), match_coverage, CharP(this)) && - match_lookahead (APPLY_ARG, + match_lookahead (context, lookahead.len, (USHORT *) lookahead.array(), match_coverage, CharP(this), 1)) @@ -659,11 +659,11 @@ struct ReverseChainSingleSubst friend struct SubstLookupSubTable; private: - inline bool apply (APPLY_ARG_DEF) const + inline bool apply (hb_apply_context_t *context) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG); + case 1: return u.format1->apply (context); default:return false; } } @@ -705,18 +705,18 @@ struct SubstLookupSubTable ReverseChainSingle = 8 }; - inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const + inline bool apply (hb_apply_context_t *context, unsigned int lookup_type) const { TRACE_APPLY (); switch (lookup_type) { - case Single: return u.single->apply (APPLY_ARG); - case Multiple: return u.multiple->apply (APPLY_ARG); - case Alternate: return u.alternate->apply (APPLY_ARG); - case Ligature: return u.ligature->apply (APPLY_ARG); - case Context: return u.context->apply (APPLY_ARG); - case ChainContext: return u.chainContext->apply (APPLY_ARG); - case Extension: return u.extension->apply (APPLY_ARG); - case ReverseChainSingle: return u.reverseChainContextSingle->apply (APPLY_ARG); + case Single: return u.single->apply (context); + case Multiple: return u.multiple->apply (context); + case Alternate: return u.alternate->apply (context); + case Ligature: return u.ligature->apply (context); + case Context: return u.context->apply (context); + case ChainContext: return u.chainContext->apply (context); + case Extension: return u.extension->apply (context); + case ReverseChainSingle: return u.reverseChainContextSingle->apply (context); default:return false; } } @@ -802,7 +802,7 @@ struct SubstLookup : Lookup unsigned int count = get_subtable_count (); for (unsigned int i = 0; i < count; i++) - if (get_subtable (i).apply (APPLY_ARG, lookup_type)) + if (get_subtable (i).apply (context, lookup_type)) return true; return false; @@ -896,10 +896,10 @@ ASSERT_SIZE (GSUB, 10); /* Out-of-class implementation for methods recursing */ -inline bool ExtensionSubst::apply (APPLY_ARG_DEF) const +inline bool ExtensionSubst::apply (hb_apply_context_t *context) const { TRACE_APPLY (); - return get_subtable ().apply (APPLY_ARG, get_type ()); + return get_subtable ().apply (context, get_type ()); } inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *context) @@ -919,7 +919,7 @@ inline bool ExtensionSubst::is_reverse (void) const return SubstLookup::lookup_type_is_reverse (type); } -static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index) +static inline bool substitute_lookup (hb_apply_context_t *context, unsigned int lookup_index) { const GSUB &gsub = *(context->layout->face->ot_layout.gsub); const SubstLookup &l = gsub.get_lookup (lookup_index); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index ad4e404c1..6e3b6e5a2 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -40,11 +40,6 @@ trace.log ("APPLY", HB_FUNC, this); -#define APPLY_ARG_DEF \ - hb_apply_context_t *context -#define APPLY_ARG \ - context - struct hb_apply_context_t { hb_ot_layout_context_t *layout; @@ -64,7 +59,7 @@ struct hb_apply_context_t typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const char *data); -typedef bool (*apply_lookup_func_t) (APPLY_ARG_DEF, unsigned int lookup_index); +typedef bool (*apply_lookup_func_t) (hb_apply_context_t *context, unsigned int lookup_index); struct ContextFuncs { @@ -91,7 +86,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, } -static inline bool match_input (APPLY_ARG_DEF, +static inline bool match_input (hb_apply_context_t *context, unsigned int count, /* Including the first glyph (not matched) */ const USHORT input[], /* Array of input values--start with second glyph */ match_func_t match_func, @@ -121,7 +116,7 @@ static inline bool match_input (APPLY_ARG_DEF, return true; } -static inline bool match_backtrack (APPLY_ARG_DEF, +static inline bool match_backtrack (hb_apply_context_t *context, unsigned int count, const USHORT backtrack[], match_func_t match_func, @@ -146,7 +141,7 @@ static inline bool match_backtrack (APPLY_ARG_DEF, return true; } -static inline bool match_lookahead (APPLY_ARG_DEF, +static inline bool match_lookahead (hb_apply_context_t *context, unsigned int count, const USHORT lookahead[], match_func_t match_func, @@ -191,7 +186,7 @@ struct LookupRecord }; ASSERT_SIZE (LookupRecord, 4); -static inline bool apply_lookup (APPLY_ARG_DEF, +static inline bool apply_lookup (hb_apply_context_t *context, unsigned int count, /* Including the first glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */ @@ -223,7 +218,7 @@ static inline bool apply_lookup (APPLY_ARG_DEF, unsigned int old_pos = context->buffer->in_pos; /* Apply a lookup */ - bool done = apply_func (APPLY_ARG, lookupRecord->lookupListIndex); + bool done = apply_func (context, lookupRecord->lookupListIndex); lookupRecord++; lookupCount--; @@ -256,7 +251,7 @@ struct ContextLookupContext const char *match_data; }; -static inline bool context_lookup (APPLY_ARG_DEF, +static inline bool context_lookup (hb_apply_context_t *context, unsigned int inputCount, /* Including the first glyph (not matched) */ const USHORT input[], /* Array of input values--start with second glyph */ unsigned int lookupCount, @@ -264,14 +259,14 @@ static inline bool context_lookup (APPLY_ARG_DEF, ContextLookupContext &lookup_context) { unsigned int new_context_length; - if (!match_input (APPLY_ARG, + if (!match_input (context, inputCount, input, lookup_context.funcs.match, lookup_context.match_data, &new_context_length)) return false; unsigned int old_context_length; old_context_length = context->context_length; context->context_length = new_context_length; - bool ret = apply_lookup (APPLY_ARG, + bool ret = apply_lookup (context, inputCount, lookupCount, lookupRecord, lookup_context.funcs.apply); @@ -284,11 +279,11 @@ struct Rule friend struct RuleSet; private: - inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const + inline bool apply (hb_apply_context_t *context, ContextLookupContext &lookup_context) const { TRACE_APPLY (); const LookupRecord *lookupRecord = &StructAtOffset (input, input[0].get_size () * (inputCount ? inputCount - 1 : 0)); - return context_lookup (APPLY_ARG, + return context_lookup (context, inputCount, input, lookupCount, lookupRecord, lookup_context); @@ -317,13 +312,13 @@ ASSERT_SIZE_VAR2 (Rule, 4, USHORT, LookupRecord); struct RuleSet { - inline bool apply (APPLY_ARG_DEF, ContextLookupContext &lookup_context) const + inline bool apply (hb_apply_context_t *context, ContextLookupContext &lookup_context) const { TRACE_APPLY (); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) { - if ((this+rule[i]).apply (APPLY_ARG, lookup_context)) + if ((this+rule[i]).apply (context, lookup_context)) return true; } @@ -347,7 +342,7 @@ struct ContextFormat1 friend struct Context; private: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); unsigned int index = (this+coverage) (IN_CURGLYPH ()); @@ -359,7 +354,7 @@ struct ContextFormat1 {match_glyph, apply_func}, NULL }; - return rule_set.apply (APPLY_ARG, lookup_context); + return rule_set.apply (context, lookup_context); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -385,7 +380,7 @@ struct ContextFormat2 friend struct Context; private: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); unsigned int index = (this+coverage) (IN_CURGLYPH ()); @@ -402,7 +397,7 @@ struct ContextFormat2 {match_class, apply_func}, CharP(&class_def) }; - return rule_set.apply (APPLY_ARG, lookup_context); + return rule_set.apply (context, lookup_context); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -432,7 +427,7 @@ struct ContextFormat3 friend struct Context; private: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); unsigned int index = (this+coverage[0]) (IN_CURGLYPH ()); @@ -444,7 +439,7 @@ struct ContextFormat3 {match_coverage, apply_func}, CharP(this) }; - return context_lookup (APPLY_ARG, + return context_lookup (context, glyphCount, (const USHORT *) (coverage + 1), lookupCount, lookupRecord, lookup_context); @@ -477,13 +472,13 @@ ASSERT_SIZE_VAR2 (ContextFormat3, 6, OffsetTo, LookupRecord); struct Context { protected: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG, apply_func); - case 2: return u.format2->apply (APPLY_ARG, apply_func); - case 3: return u.format3->apply (APPLY_ARG, apply_func); + case 1: return u.format1->apply (context, apply_func); + case 2: return u.format2->apply (context, apply_func); + case 3: return u.format3->apply (context, apply_func); default:return false; } } @@ -517,7 +512,7 @@ struct ChainContextLookupContext const char *match_data[3]; }; -static inline bool chain_context_lookup (APPLY_ARG_DEF, +static inline bool chain_context_lookup (hb_apply_context_t *context, unsigned int backtrackCount, const USHORT backtrack[], unsigned int inputCount, /* Including the first glyph (not matched) */ @@ -535,14 +530,14 @@ static inline bool chain_context_lookup (APPLY_ARG_DEF, return false; unsigned int offset; - if (!(match_backtrack (APPLY_ARG, + if (!(match_backtrack (context, backtrackCount, backtrack, lookup_context.funcs.match, lookup_context.match_data[0]) && - match_input (APPLY_ARG, + match_input (context, inputCount, input, lookup_context.funcs.match, lookup_context.match_data[1], &offset) && - match_lookahead (APPLY_ARG, + match_lookahead (context, lookaheadCount, lookahead, lookup_context.funcs.match, lookup_context.match_data[2], offset))) return false; @@ -550,7 +545,7 @@ static inline bool chain_context_lookup (APPLY_ARG_DEF, unsigned int old_context_length; old_context_length = context->context_length; context->context_length = offset; - bool ret = apply_lookup (APPLY_ARG, + bool ret = apply_lookup (context, inputCount, lookupCount, lookupRecord, lookup_context.funcs.apply); @@ -563,13 +558,13 @@ struct ChainRule friend struct ChainRuleSet; private: - inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const + inline bool apply (hb_apply_context_t *context, ChainContextLookupContext &lookup_context) const { TRACE_APPLY (); const HeadlessArrayOf &input = StructAfter > (backtrack); const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); - return chain_context_lookup (APPLY_ARG, + return chain_context_lookup (context, backtrack.len, backtrack.array(), input.len, input.array(), lookahead.len, lookahead.array(), @@ -609,13 +604,13 @@ ASSERT_SIZE (ChainRule, 8); struct ChainRuleSet { - inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &lookup_context) const + inline bool apply (hb_apply_context_t *context, ChainContextLookupContext &lookup_context) const { TRACE_APPLY (); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) { - if ((this+rule[i]).apply (APPLY_ARG, lookup_context)) + if ((this+rule[i]).apply (context, lookup_context)) return true; } @@ -639,7 +634,7 @@ struct ChainContextFormat1 friend struct ChainContext; private: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); unsigned int index = (this+coverage) (IN_CURGLYPH ()); @@ -651,7 +646,7 @@ struct ChainContextFormat1 {match_glyph, apply_func}, {NULL, NULL, NULL} }; - return rule_set.apply (APPLY_ARG, lookup_context); + return rule_set.apply (context, lookup_context); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -676,7 +671,7 @@ struct ChainContextFormat2 friend struct ChainContext; private: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); unsigned int index = (this+coverage) (IN_CURGLYPH ()); @@ -698,7 +693,7 @@ struct ChainContextFormat2 CharP(&input_class_def), CharP(&lookahead_class_def)} }; - return rule_set.apply (APPLY_ARG, lookup_context); + return rule_set.apply (context, lookup_context); } inline bool sanitize (hb_sanitize_context_t *context) { @@ -739,7 +734,7 @@ struct ChainContextFormat3 private: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); const OffsetArrayOf &input = StructAfter > (backtrack); @@ -754,7 +749,7 @@ struct ChainContextFormat3 {match_coverage, apply_func}, {CharP(this), CharP(this), CharP(this)} }; - return chain_context_lookup (APPLY_ARG, + return chain_context_lookup (context, backtrack.len, (const USHORT *) backtrack.array(), input.len, (const USHORT *) input.array() + 1, lookahead.len, (const USHORT *) lookahead.array(), @@ -797,13 +792,13 @@ ASSERT_SIZE (ChainContextFormat3, 10); struct ChainContext { protected: - inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const + inline bool apply (hb_apply_context_t *context, apply_lookup_func_t apply_func) const { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1->apply (APPLY_ARG, apply_func); - case 2: return u.format2->apply (APPLY_ARG, apply_func); - case 3: return u.format3->apply (APPLY_ARG, apply_func); + case 1: return u.format1->apply (context, apply_func); + case 2: return u.format2->apply (context, apply_func); + case 3: return u.format3->apply (context, apply_func); default:return false; } }