[OTLayout] Rename process() to dispatch()

This commit is contained in:
Behdad Esfahbod 2013-03-09 01:55:04 -05:00
parent 2761e8a632
commit 9c5a9ee967
4 changed files with 98 additions and 98 deletions

View File

@ -182,7 +182,7 @@ struct hb_sanitize_context_t
static const unsigned int max_debug_depth = HB_DEBUG_SANITIZE;
typedef bool return_t;
template <typename T>
inline return_t process (const T &obj) { return obj.sanitize (this); }
inline return_t dispatch (const T &obj) { return obj.sanitize (this); }
static return_t default_return_value (void) { return true; }
bool stop_sublookup_iteration (const return_t r HB_UNUSED) const { return false; }

View File

@ -519,12 +519,12 @@ struct SinglePosFormat2
struct SinglePos
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 2: return TRACE_RETURN (c->process (u.format2));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
case 2: return TRACE_RETURN (c->dispatch (u.format2));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -810,12 +810,12 @@ struct PairPosFormat2
struct PairPos
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 2: return TRACE_RETURN (c->process (u.format2));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
case 2: return TRACE_RETURN (c->dispatch (u.format2));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -976,11 +976,11 @@ struct CursivePosFormat1
struct CursivePos
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -1075,11 +1075,11 @@ struct MarkBasePosFormat1
struct MarkBasePos
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -1196,11 +1196,11 @@ struct MarkLigPosFormat1
struct MarkLigPos
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -1315,11 +1315,11 @@ struct MarkMarkPosFormat1
struct MarkMarkPos
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -1374,19 +1374,19 @@ struct PosLookupSubTable
};
template <typename context_t>
inline typename context_t::return_t process (context_t *c, unsigned int lookup_type) const
inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (lookup_type) {
case Single: return TRACE_RETURN (u.single.process (c));
case Pair: return TRACE_RETURN (u.pair.process (c));
case Cursive: return TRACE_RETURN (u.cursive.process (c));
case MarkBase: return TRACE_RETURN (u.markBase.process (c));
case MarkLig: return TRACE_RETURN (u.markLig.process (c));
case MarkMark: return TRACE_RETURN (u.markMark.process (c));
case Context: return TRACE_RETURN (u.context.process (c));
case ChainContext: return TRACE_RETURN (u.chainContext.process (c));
case Extension: return TRACE_RETURN (u.extension.process (c));
case Single: return TRACE_RETURN (u.single.dispatch (c));
case Pair: return TRACE_RETURN (u.pair.dispatch (c));
case Cursive: return TRACE_RETURN (u.cursive.dispatch (c));
case MarkBase: return TRACE_RETURN (u.markBase.dispatch (c));
case MarkLig: return TRACE_RETURN (u.markLig.dispatch (c));
case MarkMark: return TRACE_RETURN (u.markMark.dispatch (c));
case Context: return TRACE_RETURN (u.context.dispatch (c));
case ChainContext: return TRACE_RETURN (u.chainContext.dispatch (c));
case Extension: return TRACE_RETURN (u.extension.dispatch (c));
default: return TRACE_RETURN (c->default_return_value ());
}
}
@ -1435,26 +1435,26 @@ struct PosLookup : Lookup
{ return this+CastR<OffsetArrayOf<PosLookupSubTable> > (subTable)[i]; }
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
unsigned int lookup_type = get_type ();
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
typename context_t::return_t r = get_subtable (i).process (c, lookup_type);
typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
if (c->stop_sublookup_iteration (r))
return TRACE_RETURN (r);
}
return TRACE_RETURN (c->default_return_value ());
}
template <typename context_t>
static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
c->set_recurse_func (NULL);
return TRACE_RETURN (process (c));
return TRACE_RETURN (dispatch (c));
}
template <typename set_t>
@ -1464,7 +1464,7 @@ struct PosLookup : Lookup
const Coverage *last = NULL;
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
const Coverage *coverage = &get_subtable (i).process (&c, get_type ());
const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
if (coverage != last) {
coverage->add_coverage (glyphs);
last = coverage;
@ -1477,7 +1477,7 @@ struct PosLookup : Lookup
TRACE_APPLY (this);
if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props))
return TRACE_RETURN (false);
return TRACE_RETURN (process (c));
return TRACE_RETURN (dispatch (c));
}
static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
@ -1618,11 +1618,11 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
/* Out-of-class implementation for methods recursing */
template <typename context_t>
inline typename context_t::return_t PosLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
{
const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos);
const PosLookup &l = gpos.get_lookup (lookup_index);
return l.process (c);
return l.dispatch (c);
}
inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)

View File

@ -193,12 +193,12 @@ struct SingleSubstFormat2
struct SingleSubst
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 2: return TRACE_RETURN (c->process (u.format2));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
case 2: return TRACE_RETURN (c->dispatch (u.format2));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -386,11 +386,11 @@ struct MultipleSubstFormat1
struct MultipleSubst
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -537,11 +537,11 @@ struct AlternateSubstFormat1
struct AlternateSubst
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -842,11 +842,11 @@ struct LigatureSubstFormat1
struct LigatureSubst
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -1023,11 +1023,11 @@ struct ReverseChainSingleSubstFormat1
struct ReverseChainSingleSubst
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -1070,18 +1070,18 @@ struct SubstLookupSubTable
};
template <typename context_t>
inline typename context_t::return_t process (context_t *c, unsigned int lookup_type) const
inline typename context_t::return_t dispatch (context_t *c, unsigned int lookup_type) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (lookup_type) {
case Single: return TRACE_RETURN (u.single.process (c));
case Multiple: return TRACE_RETURN (u.multiple.process (c));
case Alternate: return TRACE_RETURN (u.alternate.process (c));
case Ligature: return TRACE_RETURN (u.ligature.process (c));
case Context: return TRACE_RETURN (u.context.process (c));
case ChainContext: return TRACE_RETURN (u.chainContext.process (c));
case Extension: return TRACE_RETURN (u.extension.process (c));
case ReverseChainSingle: return TRACE_RETURN (u.reverseChainContextSingle.process (c));
case Single: return TRACE_RETURN (u.single.dispatch (c));
case Multiple: return TRACE_RETURN (u.multiple.dispatch (c));
case Alternate: return TRACE_RETURN (u.alternate.dispatch (c));
case Ligature: return TRACE_RETURN (u.ligature.dispatch (c));
case Context: return TRACE_RETURN (u.context.dispatch (c));
case ChainContext: return TRACE_RETURN (u.chainContext.dispatch (c));
case Extension: return TRACE_RETURN (u.extension.dispatch (c));
case ReverseChainSingle: return TRACE_RETURN (u.reverseChainContextSingle.dispatch (c));
default: return TRACE_RETURN (c->default_return_value ());
}
}
@ -1139,33 +1139,33 @@ struct SubstLookup : Lookup
}
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
unsigned int lookup_type = get_type ();
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
typename context_t::return_t r = get_subtable (i).process (c, lookup_type);
typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type);
if (c->stop_sublookup_iteration (r))
return TRACE_RETURN (r);
}
return TRACE_RETURN (c->default_return_value ());
}
template <typename context_t>
static inline typename context_t::return_t process_recurse_func (context_t *c, unsigned int lookup_index);
static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index);
inline hb_closure_context_t::return_t closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
c->set_recurse_func (process_recurse_func<hb_closure_context_t>);
return TRACE_RETURN (process (c));
c->set_recurse_func (dispatch_recurse_func<hb_closure_context_t>);
return TRACE_RETURN (dispatch (c));
}
inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
c->set_recurse_func (process_recurse_func<hb_collect_glyphs_context_t>);
return TRACE_RETURN (process (c));
c->set_recurse_func (dispatch_recurse_func<hb_collect_glyphs_context_t>);
return TRACE_RETURN (dispatch (c));
}
template <typename set_t>
@ -1175,7 +1175,7 @@ struct SubstLookup : Lookup
const Coverage *last = NULL;
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
const Coverage *coverage = &get_subtable (i).process (&c, get_type ());
const Coverage *coverage = &get_subtable (i).dispatch (&c, get_type ());
if (coverage != last) {
coverage->add_coverage (glyphs);
last = coverage;
@ -1188,7 +1188,7 @@ struct SubstLookup : Lookup
TRACE_WOULD_APPLY (this);
if (unlikely (!c->len)) return TRACE_RETURN (false);
if (!digest->may_have (c->glyphs[0])) return TRACE_RETURN (false);
return TRACE_RETURN (process (c));
return TRACE_RETURN (dispatch (c));
}
inline bool apply_once (hb_apply_context_t *c) const
@ -1196,7 +1196,7 @@ struct SubstLookup : Lookup
TRACE_APPLY (this);
if (!c->check_glyph_property (&c->buffer->cur(), c->lookup_props))
return TRACE_RETURN (false);
return TRACE_RETURN (process (c));
return TRACE_RETURN (dispatch (c));
}
static bool apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index);
@ -1386,11 +1386,11 @@ inline bool ExtensionSubst::is_reverse (void) const
}
template <typename context_t>
inline typename context_t::return_t SubstLookup::process_recurse_func (context_t *c, unsigned int lookup_index)
inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
{
const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->gsub);
const SubstLookup &l = gsub.get_lookup (lookup_index);
return l.process (c);
return l.dispatch (c);
}
inline bool SubstLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index)

View File

@ -38,7 +38,7 @@ namespace OT {
#define TRACE_PROCESS(this) \
#define TRACE_DISPATCH(this) \
hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t> trace \
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
"");
@ -60,7 +60,7 @@ struct hb_closure_context_t
typedef hb_void_t return_t;
typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
template <typename T>
inline return_t process (const T &obj) { obj.closure (this); return HB_VOID; }
inline return_t dispatch (const T &obj) { obj.closure (this); return HB_VOID; }
static return_t default_return_value (void) { return HB_VOID; }
bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
return_t recurse (unsigned int lookup_index)
@ -109,7 +109,7 @@ struct hb_would_apply_context_t
static const unsigned int max_debug_depth = HB_DEBUG_WOULD_APPLY;
typedef bool return_t;
template <typename T>
inline return_t process (const T &obj) { return obj.would_apply (this); }
inline return_t dispatch (const T &obj) { return obj.would_apply (this); }
static return_t default_return_value (void) { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; }
@ -148,7 +148,7 @@ struct hb_collect_glyphs_context_t
typedef hb_void_t return_t;
typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
template <typename T>
inline return_t process (const T &obj) { obj.collect_glyphs (this); return HB_VOID; }
inline return_t dispatch (const T &obj) { obj.collect_glyphs (this); return HB_VOID; }
static return_t default_return_value (void) { return HB_VOID; }
bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
return_t recurse (unsigned int lookup_index)
@ -214,7 +214,7 @@ struct hb_get_coverage_context_t
static const unsigned int max_debug_depth = 0;
typedef const Coverage &return_t;
template <typename T>
inline return_t process (const T &obj) { return obj.get_coverage (); }
inline return_t dispatch (const T &obj) { return obj.get_coverage (); }
static return_t default_return_value (void) { return Null(Coverage); }
hb_get_coverage_context_t (void) :
@ -241,7 +241,7 @@ struct hb_apply_context_t
typedef bool return_t;
typedef return_t (*recurse_func_t) (hb_apply_context_t *c, unsigned int lookup_index);
template <typename T>
inline return_t process (const T &obj) { return obj.apply (this); }
inline return_t dispatch (const T &obj) { return obj.apply (this); }
static return_t default_return_value (void) { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; }
return_t recurse (unsigned int lookup_index)
@ -1493,13 +1493,13 @@ struct ContextFormat3
struct Context
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 2: return TRACE_RETURN (c->process (u.format2));
case 3: return TRACE_RETURN (c->process (u.format3));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
case 2: return TRACE_RETURN (c->dispatch (u.format2));
case 3: return TRACE_RETURN (c->dispatch (u.format3));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -2109,13 +2109,13 @@ struct ChainContextFormat3
struct ChainContext
{
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
TRACE_PROCESS (this);
TRACE_DISPATCH (this);
switch (u.format) {
case 1: return TRACE_RETURN (c->process (u.format1));
case 2: return TRACE_RETURN (c->process (u.format2));
case 3: return TRACE_RETURN (c->process (u.format3));
case 1: return TRACE_RETURN (c->dispatch (u.format1));
case 2: return TRACE_RETURN (c->dispatch (u.format2));
case 3: return TRACE_RETURN (c->dispatch (u.format3));
default:return TRACE_RETURN (c->default_return_value ());
}
}
@ -2189,9 +2189,9 @@ struct Extension
}
template <typename context_t>
inline typename context_t::return_t process (context_t *c) const
inline typename context_t::return_t dispatch (context_t *c) const
{
return get_subtable<typename T::LookupSubTable> ().process (c, get_type ());
return get_subtable<typename T::LookupSubTable> ().dispatch (c, get_type ());
}
inline bool sanitize_self (hb_sanitize_context_t *c) {