[HB] Rename LOOKUP_ARGS to APPLY_ARGS

This commit is contained in:
Behdad Esfahbod 2009-05-18 18:22:44 -04:00
parent 2a8e6accdf
commit eb0dfc830e
3 changed files with 131 additions and 131 deletions

View File

@ -211,7 +211,7 @@ struct SinglePosFormat1 {
friend struct SinglePos; friend struct SinglePos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -234,7 +234,7 @@ struct SinglePosFormat2 {
friend struct SinglePos; friend struct SinglePos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -258,10 +258,10 @@ struct SinglePos {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
case 2: return u.format2->apply (LOOKUP_ARGS); case 2: return u.format2->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -297,7 +297,7 @@ struct PairPosFormat1 {
friend struct PairPos; friend struct PairPos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -324,7 +324,7 @@ struct PairPosFormat2 {
friend struct PairPos; friend struct PairPos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -364,10 +364,10 @@ struct PairPos {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
case 2: return u.format2->apply (LOOKUP_ARGS); case 2: return u.format2->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -402,7 +402,7 @@ struct CursivePosFormat1 {
friend struct CursivePos; friend struct CursivePos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -424,9 +424,9 @@ struct CursivePos {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -466,7 +466,7 @@ struct MarkBasePosFormat1 {
friend struct MarkBasePos; friend struct MarkBasePos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -492,9 +492,9 @@ struct MarkBasePos {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -551,7 +551,7 @@ struct MarkLigPosFormat1 {
friend struct MarkLigPos; friend struct MarkLigPos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -577,9 +577,9 @@ struct MarkLigPos {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -618,7 +618,7 @@ struct MarkMarkPosFormat1 {
friend struct MarkMarkPos; friend struct MarkMarkPos;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
/* TODO */ /* TODO */
return false; return false;
} }
@ -644,9 +644,9 @@ struct MarkMarkPos {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -660,20 +660,20 @@ struct MarkMarkPos {
ASSERT_SIZE (MarkMarkPos, 2); ASSERT_SIZE (MarkMarkPos, 2);
static inline bool position_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index); static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index);
struct ContextPos : Context { struct ContextPos : Context {
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
return Context::apply (LOOKUP_ARGS, position_lookup); return Context::apply (APPLY_ARG, position_lookup);
} }
}; };
ASSERT_SIZE (ContextPos, 2); ASSERT_SIZE (ContextPos, 2);
struct ChainContextPos : ChainContext { struct ChainContextPos : ChainContext {
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
return ChainContext::apply (LOOKUP_ARGS, position_lookup); return ChainContext::apply (APPLY_ARG, position_lookup);
} }
}; };
ASSERT_SIZE (ChainContextPos, 2); ASSERT_SIZE (ChainContextPos, 2);
@ -686,7 +686,7 @@ struct ExtensionPosFormat1 {
private: private:
inline unsigned int get_type (void) const { return extensionLookupType; } inline unsigned int get_type (void) const { return extensionLookupType; }
inline unsigned int get_offset (void) const { return (extensionOffset[0] << 16) + extensionOffset[1]; } inline unsigned int get_offset (void) const { return (extensionOffset[0] << 16) + extensionOffset[1]; }
inline bool apply (LOOKUP_ARGS_DEF) const; inline bool apply (APPLY_ARG_DEF) const;
private: private:
USHORT format; /* Format identifier. Set to 1. */ USHORT format; /* Format identifier. Set to 1. */
@ -714,9 +714,9 @@ struct ExtensionPos {
} }
} }
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -751,18 +751,18 @@ struct PosLookupSubTable {
friend struct PosLookup; friend struct PosLookup;
inline bool apply (LOOKUP_ARGS_DEF, unsigned int lookup_type) const { inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const {
switch (lookup_type) { switch (lookup_type) {
case GPOS_Single: return u.single->apply (LOOKUP_ARGS); case GPOS_Single: return u.single->apply (APPLY_ARG);
case GPOS_Pair: return u.pair->apply (LOOKUP_ARGS); case GPOS_Pair: return u.pair->apply (APPLY_ARG);
case GPOS_Cursive: return u.cursive->apply (LOOKUP_ARGS); case GPOS_Cursive: return u.cursive->apply (APPLY_ARG);
case GPOS_MarkBase: return u.markBase->apply (LOOKUP_ARGS); case GPOS_MarkBase: return u.markBase->apply (APPLY_ARG);
case GPOS_MarkLig: return u.markLig->apply (LOOKUP_ARGS); case GPOS_MarkLig: return u.markLig->apply (APPLY_ARG);
case GPOS_MarkMark: return u.markMark->apply (LOOKUP_ARGS); case GPOS_MarkMark: return u.markMark->apply (APPLY_ARG);
case GPOS_Context: return u.context->apply (LOOKUP_ARGS); case GPOS_Context: return u.context->apply (APPLY_ARG);
case GPOS_ChainContext: return u.chainContext->apply (LOOKUP_ARGS); case GPOS_ChainContext: return u.chainContext->apply (APPLY_ARG);
case GPOS_Extension: return u.extension->apply (LOOKUP_ARGS); case GPOS_Extension: return u.extension->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -817,7 +817,7 @@ struct PosLookup : Lookup {
unsigned int lookup_flag = get_flag (); unsigned int lookup_flag = get_flag ();
for (unsigned int i = 0; i < get_subtable_count (); i++) for (unsigned int i = 0; i < get_subtable_count (); i++)
if (get_subtable (i).apply (LOOKUP_ARGS, lookup_type)) if (get_subtable (i).apply (APPLY_ARG, lookup_type))
return true; return true;
return false; return false;
@ -896,16 +896,16 @@ ASSERT_SIZE (GPOS, 10);
/* Out-of-class implementation for methods recursing */ /* Out-of-class implementation for methods recursing */
inline bool ExtensionPosFormat1::apply (LOOKUP_ARGS_DEF) const { inline bool ExtensionPosFormat1::apply (APPLY_ARG_DEF) const {
unsigned int lookup_type = get_type (); unsigned int lookup_type = get_type ();
if (HB_UNLIKELY (lookup_type == GPOS_Extension)) if (HB_UNLIKELY (lookup_type == GPOS_Extension))
return false; return false;
return ((PosLookupSubTable&)*(((char *) this) + get_offset ())).apply (LOOKUP_ARGS, lookup_type); return ((PosLookupSubTable&)*(((char *) this) + get_offset ())).apply (APPLY_ARG, lookup_type);
} }
static inline bool position_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index) { static inline bool position_lookup (APPLY_ARG_DEF, unsigned int lookup_index) {
const GPOS &gpos = *(layout->gpos); const GPOS &gpos = *(layout->gpos);
const PosLookup &l = gpos.get_lookup (lookup_index); const PosLookup &l = gpos.get_lookup (lookup_index);

View File

@ -111,7 +111,7 @@ struct SingleSubst {
} }
} }
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
@ -152,7 +152,7 @@ struct Sequence {
_hb_ot_layout_set_glyph_property (layout, substitute[n], property); _hb_ot_layout_set_glyph_property (layout, substitute[n], property);
} }
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
if (HB_UNLIKELY (!substitute.len)) if (HB_UNLIKELY (!substitute.len))
return false; return false;
@ -186,13 +186,13 @@ struct MultipleSubstFormat1 {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
return false; return false;
return (this+sequence[index]).apply (LOOKUP_ARGS); return (this+sequence[index]).apply (APPLY_ARG);
} }
private: private:
@ -212,9 +212,9 @@ struct MultipleSubst {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -238,7 +238,7 @@ struct AlternateSubstFormat1 {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
@ -293,9 +293,9 @@ struct AlternateSubst {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -314,7 +314,7 @@ struct Ligature {
friend struct LigatureSet; friend struct LigatureSet;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, bool is_mark) const { inline bool apply (APPLY_ARG_DEF, bool is_mark) const {
unsigned int i, j; unsigned int i, j;
unsigned int count = component.len; unsigned int count = component.len;
@ -393,12 +393,12 @@ struct LigatureSet {
private: private:
inline bool apply (LOOKUP_ARGS_DEF, bool is_mark) const { inline bool apply (APPLY_ARG_DEF, bool is_mark) const {
unsigned int num_ligs = ligature.len; unsigned int num_ligs = ligature.len;
for (unsigned int i = 0; i < num_ligs; i++) { for (unsigned int i = 0; i < num_ligs; i++) {
const Ligature &lig = this+ligature[i]; const Ligature &lig = this+ligature[i];
if (lig.apply (LOOKUP_ARGS, is_mark)) if (lig.apply (APPLY_ARG, is_mark))
return true; return true;
} }
@ -418,7 +418,7 @@ struct LigatureSubstFormat1 {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
hb_codepoint_t glyph_id = IN_CURGLYPH (); hb_codepoint_t glyph_id = IN_CURGLYPH ();
@ -430,7 +430,7 @@ struct LigatureSubstFormat1 {
return false; return false;
const LigatureSet &lig_set = this+ligatureSet[index]; const LigatureSet &lig_set = this+ligatureSet[index];
return lig_set.apply (LOOKUP_ARGS, first_is_mark); return lig_set.apply (APPLY_ARG, first_is_mark);
} }
private: private:
@ -450,9 +450,9 @@ struct LigatureSubst {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -467,20 +467,20 @@ ASSERT_SIZE (LigatureSubst, 2);
static inline bool substitute_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index); static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index);
struct ContextSubst : Context { struct ContextSubst : Context {
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
return Context::apply (LOOKUP_ARGS, substitute_lookup); return Context::apply (APPLY_ARG, substitute_lookup);
} }
}; };
ASSERT_SIZE (ContextSubst, 2); ASSERT_SIZE (ContextSubst, 2);
struct ChainContextSubst : ChainContext { struct ChainContextSubst : ChainContext {
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
return ChainContext::apply (LOOKUP_ARGS, substitute_lookup); return ChainContext::apply (APPLY_ARG, substitute_lookup);
} }
}; };
ASSERT_SIZE (ChainContextSubst, 2); ASSERT_SIZE (ChainContextSubst, 2);
@ -493,7 +493,7 @@ struct ExtensionSubstFormat1 {
private: private:
inline unsigned int get_type (void) const { return extensionLookupType; } inline unsigned int get_type (void) const { return extensionLookupType; }
inline unsigned int get_offset (void) const { return (extensionOffset[0] << 16) + extensionOffset[1]; } inline unsigned int get_offset (void) const { return (extensionOffset[0] << 16) + extensionOffset[1]; }
inline bool apply (LOOKUP_ARGS_DEF) const; inline bool apply (APPLY_ARG_DEF) const;
private: private:
USHORT format; /* Format identifier. Set to 1. */ USHORT format; /* Format identifier. Set to 1. */
@ -521,9 +521,9 @@ struct ExtensionSubst {
} }
} }
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -542,7 +542,7 @@ struct ReverseChainSingleSubstFormat1 {
friend struct ReverseChainSingleSubst; friend struct ReverseChainSingleSubst;
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
if (HB_UNLIKELY (context_length != NO_CONTEXT)) if (HB_UNLIKELY (context_length != NO_CONTEXT))
return false; /* No chaining to this type */ return false; /* No chaining to this type */
@ -556,10 +556,10 @@ struct ReverseChainSingleSubstFormat1 {
const ArrayOf<GlyphID> &substitute = * (const ArrayOf<GlyphID> *) const ArrayOf<GlyphID> &substitute = * (const ArrayOf<GlyphID> *)
((const char *) &lookahead + lookahead.get_size ()); ((const char *) &lookahead + lookahead.get_size ());
if (match_backtrack (LOOKUP_ARGS, if (match_backtrack (APPLY_ARG,
backtrack.len, (USHORT *) backtrack.array, backtrack.len, (USHORT *) backtrack.array,
match_coverage, (char *) this) && match_coverage, (char *) this) &&
match_lookahead (LOOKUP_ARGS, match_lookahead (APPLY_ARG,
lookahead.len, (USHORT *) lookahead.array, lookahead.len, (USHORT *) lookahead.array,
match_coverage, (char *) this, match_coverage, (char *) this,
1)) 1))
@ -597,9 +597,9 @@ struct ReverseChainSingleSubst {
private: private:
inline bool apply (LOOKUP_ARGS_DEF) const { inline bool apply (APPLY_ARG_DEF) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS); case 1: return u.format1->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -633,17 +633,17 @@ struct SubstLookupSubTable {
friend struct SubstLookup; friend struct SubstLookup;
inline bool apply (LOOKUP_ARGS_DEF, unsigned int lookup_type) const { inline bool apply (APPLY_ARG_DEF, unsigned int lookup_type) const {
switch (lookup_type) { switch (lookup_type) {
case GSUB_Single: return u.single->apply (LOOKUP_ARGS); case GSUB_Single: return u.single->apply (APPLY_ARG);
case GSUB_Multiple: return u.multiple->apply (LOOKUP_ARGS); case GSUB_Multiple: return u.multiple->apply (APPLY_ARG);
case GSUB_Alternate: return u.alternate->apply (LOOKUP_ARGS); case GSUB_Alternate: return u.alternate->apply (APPLY_ARG);
case GSUB_Ligature: return u.ligature->apply (LOOKUP_ARGS); case GSUB_Ligature: return u.ligature->apply (APPLY_ARG);
case GSUB_Context: return u.context->apply (LOOKUP_ARGS); case GSUB_Context: return u.context->apply (APPLY_ARG);
case GSUB_ChainContext: return u.chainContext->apply (LOOKUP_ARGS); case GSUB_ChainContext: return u.chainContext->apply (APPLY_ARG);
case GSUB_Extension: return u.extension->apply (LOOKUP_ARGS); case GSUB_Extension: return u.extension->apply (APPLY_ARG);
case GSUB_ReverseChainSingle: return u.reverseChainContextSingle->apply (LOOKUP_ARGS); case GSUB_ReverseChainSingle: return u.reverseChainContextSingle->apply (APPLY_ARG);
default:return false; default:return false;
} }
} }
@ -704,7 +704,7 @@ struct SubstLookup : Lookup {
unsigned int lookup_flag = get_flag (); unsigned int lookup_flag = get_flag ();
for (unsigned int i = 0; i < get_subtable_count (); i++) for (unsigned int i = 0; i < get_subtable_count (); i++)
if (get_subtable (i).apply (LOOKUP_ARGS, lookup_type)) if (get_subtable (i).apply (APPLY_ARG, lookup_type))
return true; return true;
return false; return false;
@ -795,16 +795,16 @@ ASSERT_SIZE (GSUB, 10);
/* Out-of-class implementation for methods recursing */ /* Out-of-class implementation for methods recursing */
inline bool ExtensionSubstFormat1::apply (LOOKUP_ARGS_DEF) const { inline bool ExtensionSubstFormat1::apply (APPLY_ARG_DEF) const {
unsigned int lookup_type = get_type (); unsigned int lookup_type = get_type ();
if (HB_UNLIKELY (lookup_type == GSUB_Extension)) if (HB_UNLIKELY (lookup_type == GSUB_Extension))
return false; return false;
return ((SubstLookupSubTable&)*(((char *) this) + get_offset ())).apply (LOOKUP_ARGS, lookup_type); return ((SubstLookupSubTable&)*(((char *) this) + get_offset ())).apply (APPLY_ARG, lookup_type);
} }
static inline bool substitute_lookup (LOOKUP_ARGS_DEF, unsigned int lookup_index) { static inline bool substitute_lookup (APPLY_ARG_DEF, unsigned int lookup_index) {
const GSUB &gsub = *(layout->gsub); const GSUB &gsub = *(layout->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index); const SubstLookup &l = gsub.get_lookup (lookup_index);

View File

@ -31,14 +31,14 @@
#include "harfbuzz-buffer-private.h" /* XXX */ #include "harfbuzz-buffer-private.h" /* XXX */
#define LOOKUP_ARGS_DEF \ #define APPLY_ARG_DEF \
hb_ot_layout_t *layout, \ hb_ot_layout_t *layout, \
hb_buffer_t *buffer, \ hb_buffer_t *buffer, \
unsigned int context_length HB_GNUC_UNUSED, \ unsigned int context_length HB_GNUC_UNUSED, \
unsigned int nesting_level_left HB_GNUC_UNUSED, \ unsigned int nesting_level_left HB_GNUC_UNUSED, \
unsigned int lookup_flag, \ unsigned int lookup_flag, \
unsigned int property HB_GNUC_UNUSED /* propety of first glyph */ unsigned int property HB_GNUC_UNUSED /* propety of first glyph */
#define LOOKUP_ARGS \ #define APPLY_ARG \
layout, \ layout, \
buffer, \ buffer, \
context_length, \ context_length, \
@ -48,7 +48,7 @@
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, char *data); typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, char *data);
typedef bool (*apply_lookup_func_t) (LOOKUP_ARGS_DEF, unsigned int lookup_index); typedef bool (*apply_lookup_func_t) (APPLY_ARG_DEF, unsigned int lookup_index);
struct ContextFuncs { struct ContextFuncs {
match_func_t match; match_func_t match;
@ -71,7 +71,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value,
} }
static inline bool match_input (LOOKUP_ARGS_DEF, static inline bool match_input (APPLY_ARG_DEF,
unsigned int count, /* Including the first glyph (not matched) */ unsigned int count, /* Including the first glyph (not matched) */
const USHORT input[], /* Array of input values--start with second glyph */ const USHORT input[], /* Array of input values--start with second glyph */
match_func_t match_func, match_func_t match_func,
@ -99,7 +99,7 @@ static inline bool match_input (LOOKUP_ARGS_DEF,
return true; return true;
} }
static inline bool match_backtrack (LOOKUP_ARGS_DEF, static inline bool match_backtrack (APPLY_ARG_DEF,
unsigned int count, unsigned int count,
const USHORT backtrack[], const USHORT backtrack[],
match_func_t match_func, match_func_t match_func,
@ -122,7 +122,7 @@ static inline bool match_backtrack (LOOKUP_ARGS_DEF,
return true; return true;
} }
static inline bool match_lookahead (LOOKUP_ARGS_DEF, static inline bool match_lookahead (APPLY_ARG_DEF,
unsigned int count, unsigned int count,
const USHORT lookahead[], const USHORT lookahead[],
match_func_t match_func, match_func_t match_func,
@ -158,7 +158,7 @@ struct LookupRecord {
}; };
ASSERT_SIZE (LookupRecord, 4); ASSERT_SIZE (LookupRecord, 4);
static inline bool apply_lookup (LOOKUP_ARGS_DEF, static inline bool apply_lookup (APPLY_ARG_DEF,
unsigned int count, /* Including the first glyph */ unsigned int count, /* Including the first glyph */
unsigned int lookupCount, unsigned int lookupCount,
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */ const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
@ -183,7 +183,7 @@ static inline bool apply_lookup (LOOKUP_ARGS_DEF,
unsigned int old_pos = buffer->in_pos; unsigned int old_pos = buffer->in_pos;
/* Apply a lookup */ /* Apply a lookup */
bool done = apply_func (LOOKUP_ARGS, lookupRecord->lookupListIndex); bool done = apply_func (APPLY_ARG, lookupRecord->lookupListIndex);
lookupRecord++; lookupRecord++;
lookupCount--; lookupCount--;
@ -214,18 +214,18 @@ struct ContextLookupContext {
char *match_data; char *match_data;
}; };
static inline bool context_lookup (LOOKUP_ARGS_DEF, static inline bool context_lookup (APPLY_ARG_DEF,
unsigned int inputCount, /* Including the first glyph (not matched) */ unsigned int inputCount, /* Including the first glyph (not matched) */
const USHORT input[], /* Array of input values--start with second glyph */ const USHORT input[], /* Array of input values--start with second glyph */
unsigned int lookupCount, unsigned int lookupCount,
const LookupRecord lookupRecord[], const LookupRecord lookupRecord[],
ContextLookupContext &context) ContextLookupContext &context)
{ {
return match_input (LOOKUP_ARGS, return match_input (APPLY_ARG,
inputCount, input, inputCount, input,
context.funcs.match, context.match_data, context.funcs.match, context.match_data,
&context_length) && &context_length) &&
apply_lookup (LOOKUP_ARGS, apply_lookup (APPLY_ARG,
inputCount, inputCount,
lookupCount, lookupRecord, lookupCount, lookupRecord,
context.funcs.apply); context.funcs.apply);
@ -236,11 +236,11 @@ struct Rule {
friend struct RuleSet; friend struct RuleSet;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, ContextLookupContext &context) const { inline bool apply (APPLY_ARG_DEF, ContextLookupContext &context) const {
const LookupRecord *lookupRecord = (const LookupRecord *) const LookupRecord *lookupRecord = (const LookupRecord *)
((const char *) input + ((const char *) input +
sizeof (input[0]) * (inputCount ? inputCount - 1 : 0)); sizeof (input[0]) * (inputCount ? inputCount - 1 : 0));
return context_lookup (LOOKUP_ARGS, return context_lookup (APPLY_ARG,
inputCount, input, inputCount, input,
lookupCount, lookupRecord, lookupCount, lookupRecord,
context); context);
@ -260,11 +260,11 @@ ASSERT_SIZE (Rule, 4);
struct RuleSet { struct RuleSet {
inline bool apply (LOOKUP_ARGS_DEF, ContextLookupContext &context) const { inline bool apply (APPLY_ARG_DEF, ContextLookupContext &context) const {
unsigned int num_rules = rule.len; unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++) { for (unsigned int i = 0; i < num_rules; i++) {
if ((this+rule[i]).apply (LOOKUP_ARGS, context)) if ((this+rule[i]).apply (APPLY_ARG, context))
return true; return true;
} }
@ -283,7 +283,7 @@ struct ContextFormat1 {
friend struct Context; friend struct Context;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -294,7 +294,7 @@ struct ContextFormat1 {
{match_glyph, apply_func}, {match_glyph, apply_func},
NULL NULL
}; };
return rule_set.apply (LOOKUP_ARGS, context); return rule_set.apply (APPLY_ARG, context);
} }
private: private:
@ -314,7 +314,7 @@ struct ContextFormat2 {
friend struct Context; friend struct Context;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -330,7 +330,7 @@ struct ContextFormat2 {
{match_class, apply_func}, {match_class, apply_func},
(char *) &class_def (char *) &class_def
}; };
return rule_set.apply (LOOKUP_ARGS, context); return rule_set.apply (APPLY_ARG, context);
} }
private: private:
@ -353,7 +353,7 @@ struct ContextFormat3 {
friend struct Context; friend struct Context;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
unsigned int index = (this+coverage[0]) (IN_CURGLYPH ()); unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -366,7 +366,7 @@ struct ContextFormat3 {
{match_coverage, apply_func}, {match_coverage, apply_func},
(char *) this (char *) this
}; };
return context_lookup (LOOKUP_ARGS, return context_lookup (APPLY_ARG,
glyphCount, (const USHORT *) (coverage + 1), glyphCount, (const USHORT *) (coverage + 1),
lookupCount, lookupRecord, lookupCount, lookupRecord,
context); context);
@ -388,11 +388,11 @@ ASSERT_SIZE (ContextFormat3, 6);
struct Context { struct Context {
protected: protected:
bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS, apply_func); case 1: return u.format1->apply (APPLY_ARG, apply_func);
case 2: return u.format2->apply (LOOKUP_ARGS, apply_func); case 2: return u.format2->apply (APPLY_ARG, apply_func);
case 3: return u.format3->apply (LOOKUP_ARGS, apply_func); case 3: return u.format3->apply (APPLY_ARG, apply_func);
default:return false; default:return false;
} }
} }
@ -415,7 +415,7 @@ struct ChainContextLookupContext {
char *match_data[3]; char *match_data[3];
}; };
static inline bool chain_context_lookup (LOOKUP_ARGS_DEF, static inline bool chain_context_lookup (APPLY_ARG_DEF,
unsigned int backtrackCount, unsigned int backtrackCount,
const USHORT backtrack[], const USHORT backtrack[],
unsigned int inputCount, /* Including the first glyph (not matched) */ unsigned int inputCount, /* Including the first glyph (not matched) */
@ -433,19 +433,19 @@ static inline bool chain_context_lookup (LOOKUP_ARGS_DEF,
return false; return false;
unsigned int offset; unsigned int offset;
return match_backtrack (LOOKUP_ARGS, return match_backtrack (APPLY_ARG,
backtrackCount, backtrack, backtrackCount, backtrack,
context.funcs.match, context.match_data[0]) && context.funcs.match, context.match_data[0]) &&
match_input (LOOKUP_ARGS, match_input (APPLY_ARG,
inputCount, input, inputCount, input,
context.funcs.match, context.match_data[1], context.funcs.match, context.match_data[1],
&offset) && &offset) &&
match_lookahead (LOOKUP_ARGS, match_lookahead (APPLY_ARG,
lookaheadCount, lookahead, lookaheadCount, lookahead,
context.funcs.match, context.match_data[2], context.funcs.match, context.match_data[2],
offset) && offset) &&
(context_length = offset, true) && (context_length = offset, true) &&
apply_lookup (LOOKUP_ARGS, apply_lookup (APPLY_ARG,
inputCount, inputCount,
lookupCount, lookupRecord, lookupCount, lookupRecord,
context.funcs.apply); context.funcs.apply);
@ -456,14 +456,14 @@ struct ChainRule {
friend struct ChainRuleSet; friend struct ChainRuleSet;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, ChainContextLookupContext &context) const { inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &context) const {
const HeadlessArrayOf<USHORT> &input = * (const HeadlessArrayOf<USHORT> *) const HeadlessArrayOf<USHORT> &input = * (const HeadlessArrayOf<USHORT> *)
((const char *) &backtrack + backtrack.get_size ()); ((const char *) &backtrack + backtrack.get_size ());
const ArrayOf<USHORT> &lookahead = * (const ArrayOf<USHORT> *) const ArrayOf<USHORT> &lookahead = * (const ArrayOf<USHORT> *)
((const char *) &input + input.get_size ()); ((const char *) &input + input.get_size ());
const ArrayOf<LookupRecord> &lookup = * (const ArrayOf<LookupRecord> *) const ArrayOf<LookupRecord> &lookup = * (const ArrayOf<LookupRecord> *)
((const char *) &lookahead + lookahead.get_size ()); ((const char *) &lookahead + lookahead.get_size ());
return chain_context_lookup (LOOKUP_ARGS, return chain_context_lookup (APPLY_ARG,
backtrack.len, backtrack.array, backtrack.len, backtrack.array,
input.len, input.array + 1, input.len, input.array + 1,
lookahead.len, lookahead.array, lookahead.len, lookahead.array,
@ -492,11 +492,11 @@ ASSERT_SIZE (ChainRule, 8);
struct ChainRuleSet { struct ChainRuleSet {
inline bool apply (LOOKUP_ARGS_DEF, ChainContextLookupContext &context) const { inline bool apply (APPLY_ARG_DEF, ChainContextLookupContext &context) const {
unsigned int num_rules = rule.len; unsigned int num_rules = rule.len;
for (unsigned int i = 0; i < num_rules; i++) { for (unsigned int i = 0; i < num_rules; i++) {
if ((this+rule[i]).apply (LOOKUP_ARGS, context)) if ((this+rule[i]).apply (APPLY_ARG, context))
return true; return true;
} }
@ -515,7 +515,7 @@ struct ChainContextFormat1 {
friend struct ChainContext; friend struct ChainContext;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -526,7 +526,7 @@ struct ChainContextFormat1 {
{match_glyph, apply_func}, {match_glyph, apply_func},
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
return rule_set.apply (LOOKUP_ARGS, context); return rule_set.apply (APPLY_ARG, context);
} }
private: private:
USHORT format; /* Format identifier--format = 1 */ USHORT format; /* Format identifier--format = 1 */
@ -544,7 +544,7 @@ struct ChainContextFormat2 {
friend struct ChainContext; friend struct ChainContext;
private: private:
inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
unsigned int index = (this+coverage) (IN_CURGLYPH ()); unsigned int index = (this+coverage) (IN_CURGLYPH ());
if (HB_LIKELY (index == NOT_COVERED)) if (HB_LIKELY (index == NOT_COVERED))
@ -565,7 +565,7 @@ struct ChainContextFormat2 {
(char *) &input_class_def, (char *) &input_class_def,
(char *) &lookahead_class_def} (char *) &lookahead_class_def}
}; };
return rule_set.apply (LOOKUP_ARGS, context); return rule_set.apply (APPLY_ARG, context);
} }
private: private:
@ -597,10 +597,10 @@ struct ChainContextFormat3 {
private: private:
inline bool apply_coverage (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply_coverage (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
} }
inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { inline bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
const OffsetArrayOf<Coverage> &input = * (const OffsetArrayOf<Coverage> *) const OffsetArrayOf<Coverage> &input = * (const OffsetArrayOf<Coverage> *)
((const char *) &backtrack + backtrack.get_size ()); ((const char *) &backtrack + backtrack.get_size ());
@ -617,7 +617,7 @@ struct ChainContextFormat3 {
{match_coverage, apply_func}, {match_coverage, apply_func},
{(char *) this, (char *) this, (char *) this} {(char *) this, (char *) this, (char *) this}
}; };
return chain_context_lookup (LOOKUP_ARGS, return chain_context_lookup (APPLY_ARG,
backtrack.len, (USHORT *) backtrack.array, backtrack.len, (USHORT *) backtrack.array,
input.len, (USHORT *) input.array, input.len, (USHORT *) input.array,
lookahead.len, (USHORT *) lookahead.array, lookahead.len, (USHORT *) lookahead.array,
@ -649,11 +649,11 @@ ASSERT_SIZE (ChainContextFormat3, 10);
struct ChainContext { struct ChainContext {
protected: protected:
bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { bool apply (APPLY_ARG_DEF, apply_lookup_func_t apply_func) const {
switch (u.format) { switch (u.format) {
case 1: return u.format1->apply (LOOKUP_ARGS, apply_func); case 1: return u.format1->apply (APPLY_ARG, apply_func);
case 2: return u.format2->apply (LOOKUP_ARGS, apply_func); case 2: return u.format2->apply (APPLY_ARG, apply_func);
case 3: return u.format3->apply (LOOKUP_ARGS, apply_func); case 3: return u.format3->apply (APPLY_ARG, apply_func);
default:return false; default:return false;
} }
} }