Minor
This commit is contained in:
parent
c779d82b2f
commit
dabe698fcb
|
@ -37,11 +37,6 @@
|
|||
namespace OT {
|
||||
|
||||
|
||||
/*
|
||||
* Void!
|
||||
*/
|
||||
typedef struct {} void_t;
|
||||
|
||||
|
||||
/*
|
||||
* Casts
|
||||
|
|
|
@ -50,7 +50,7 @@ struct hb_closure_context_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 void_t (); }
|
||||
static const return_t default_return_value (void) { return return_t (); }
|
||||
static return_t default_return_value (void) { return return_t (); }
|
||||
bool stop_sublookup_iteration (const return_t r) const { return false; }
|
||||
return_t recurse (unsigned int lookup_index)
|
||||
{
|
||||
|
@ -82,7 +82,6 @@ struct hb_closure_context_t
|
|||
|
||||
|
||||
|
||||
/* TODO Add TRACE_RETURN annotation to gsub. */
|
||||
#ifndef HB_DEBUG_WOULD_APPLY
|
||||
#define HB_DEBUG_WOULD_APPLY (HB_DEBUG+0)
|
||||
#endif
|
||||
|
@ -119,7 +118,6 @@ struct hb_would_apply_context_t
|
|||
|
||||
|
||||
|
||||
/* TODO Add TRACE_RETURN annotation to gsub. */
|
||||
#ifndef HB_DEBUG_COLLECT_GLYPHS
|
||||
#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0)
|
||||
#endif
|
||||
|
@ -133,7 +131,7 @@ struct hb_collect_glyphs_context_t
|
|||
typedef void_t return_t;
|
||||
template <typename T>
|
||||
inline return_t process (const T &obj) { obj.collect_glyphs (this); return void_t (); }
|
||||
static const return_t default_return_value (void) { return return_t (); }
|
||||
static return_t default_return_value (void) { return return_t (); }
|
||||
bool stop_iteration (const return_t r) const { return false; }
|
||||
return_t recurse (unsigned int lookup_index)
|
||||
{
|
||||
|
@ -170,7 +168,7 @@ struct hb_get_coverage_context_t
|
|||
typedef const Coverage &return_t;
|
||||
template <typename T>
|
||||
inline return_t process (const T &obj) { return obj.get_coverage (); }
|
||||
static return_t default_return_value (void) { return Null(Coverage); }
|
||||
static const return_t default_return_value (void) { return Null(Coverage); }
|
||||
bool stop_sublookup_iteration (const return_t r) const { return true; /* Unused */ }
|
||||
return_t recurse (unsigned int lookup_index)
|
||||
{ return default_return_value (); }
|
||||
|
@ -194,7 +192,7 @@ struct hb_apply_context_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); }
|
||||
static const return_t default_return_value (void) { return false; }
|
||||
static return_t default_return_value (void) { return false; }
|
||||
bool stop_sublookup_iteration (const return_t r) const { return r; }
|
||||
return_t recurse (unsigned int lookup_index)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,10 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Void! */
|
||||
typedef struct {} void_t;
|
||||
|
||||
|
||||
/* Basics */
|
||||
|
||||
|
||||
|
@ -656,6 +660,24 @@ _hb_debug_msg<0> (const char *what HB_UNUSED,
|
|||
#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__)
|
||||
|
||||
|
||||
/*
|
||||
* Printer
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
struct hb_printer_t {};
|
||||
|
||||
template <>
|
||||
struct hb_printer_t<bool> {
|
||||
const char *print (bool v) { return v ? "true" : "false"; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hb_printer_t<void_t> {
|
||||
const char *print (void_t v) { return ""; }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Trace
|
||||
*/
|
||||
|
@ -687,14 +709,15 @@ struct hb_auto_trace_t {
|
|||
if (plevel) --*plevel;
|
||||
}
|
||||
|
||||
inline bool ret (bool v, unsigned int line = 0)
|
||||
template <typename T>
|
||||
inline T ret (T v, unsigned int line = 0)
|
||||
{
|
||||
if (unlikely (returned)) {
|
||||
fprintf (stderr, "OUCH, double calls to TRACE_RETURN. This is a bug, please report.\n");
|
||||
return v;
|
||||
}
|
||||
|
||||
_hb_debug_msg<max_level> (what, obj, NULL, true, plevel ? *plevel : 1, -1, "return %s (line %d)", v ? "true" : "false", line);
|
||||
_hb_debug_msg<max_level> (what, obj, NULL, true, plevel ? *plevel : 1, -1, "return %s (line %d)", hb_printer_t<bool>().print (v), line);
|
||||
if (plevel) --*plevel;
|
||||
plevel = NULL;
|
||||
returned = true;
|
||||
|
|
Loading…
Reference in New Issue