diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index 38a84c255..80857aec1 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -30,7 +30,7 @@ namespace CFF { using namespace OT; -typedef unsigned int OpCode; +typedef unsigned int op_code_t; /* === Dict operators === */ @@ -88,11 +88,11 @@ typedef unsigned int OpCode; /* Two byte escape operators 12, (0-41) */ #define OpCode_ESC_Base 256 -#define Make_OpCode_ESC(byte2) ((OpCode)(OpCode_ESC_Base + (byte2))) +#define Make_OpCode_ESC(byte2) ((op_code_t)(OpCode_ESC_Base + (byte2))) -inline OpCode Unmake_OpCode_ESC (OpCode op) { return (OpCode)(op - OpCode_ESC_Base); } -inline bool Is_OpCode_ESC (OpCode op) { return op >= OpCode_ESC_Base; } -inline unsigned int OpCode_Size (OpCode op) { return Is_OpCode_ESC (op) ? 2: 1; } +inline op_code_t Unmake_OpCode_ESC (op_code_t op) { return (op_code_t)(op - OpCode_ESC_Base); } +inline bool Is_OpCode_ESC (op_code_t op) { return op >= OpCode_ESC_Base; } +inline unsigned int OpCode_Size (op_code_t op) { return Is_OpCode_ESC (op) ? 2: 1; } #define OpCode_Copyright Make_OpCode_ESC(0) /* CFF Top */ #define OpCode_isFixedPitch Make_OpCode_ESC(1) /* CFF Top (false) */ @@ -263,7 +263,7 @@ struct UnsizedByteStr : UnsizedArrayOf { // encode 2-byte int (Dict/CharString) or 4-byte int (Dict) template - static bool serialize_int (hb_serialize_context_t *c, OpCode intOp, int value) + static bool serialize_int (hb_serialize_context_t *c, op_code_t intOp, int value) { TRACE_SERIALIZE (this); @@ -552,7 +552,7 @@ struct op_str_t void init () {} void fini () {} - OpCode op; + op_code_t op; byte_str_t str; }; @@ -581,7 +581,7 @@ struct parsed_values_t } void fini () { values.fini_deep (); } - void add_op (OpCode op, const byte_str_ref_t& str_ref = byte_str_ref_t ()) + void add_op (op_code_t op, const byte_str_ref_t& str_ref = byte_str_ref_t ()) { VAL *val = values.push (); val->op = op; @@ -589,7 +589,7 @@ struct parsed_values_t opStart = str_ref.offset; } - void add_op (OpCode op, const byte_str_ref_t& str_ref, const VAL &v) + void add_op (op_code_t op, const byte_str_ref_t& str_ref, const VAL &v) { VAL *val = values.push (v); val->op = op; @@ -597,7 +597,7 @@ struct parsed_values_t opStart = str_ref.offset; } - bool has_op (OpCode op) const + bool has_op (op_code_t op) const { for (unsigned int i = 0; i < get_count (); i++) if (get_value (i).op == op) return true; @@ -628,12 +628,12 @@ struct interp_env_t void set_error () { error = true; } - OpCode fetch_op () + op_code_t fetch_op () { - OpCode op = OpCode_Invalid; + op_code_t op = OpCode_Invalid; if (unlikely (!str_ref.avail ())) return OpCode_Invalid; - op = (OpCode)(unsigned char)str_ref[0]; + op = (op_code_t)(unsigned char)str_ref[0]; if (op == OpCode_escape) { if (unlikely (!str_ref.avail ())) return OpCode_Invalid; @@ -675,7 +675,7 @@ typedef interp_env_t<> num_interp_env_t; template struct opset_t { - static void process_op (OpCode op, interp_env_t& env) + static void process_op (op_code_t op, interp_env_t& env) { switch (op) { case OpCode_shortint: diff --git a/src/hb-cff-interp-cs-common.hh b/src/hb-cff-interp-cs-common.hh index 2d2e0c1b2..241c1ba96 100644 --- a/src/hb-cff-interp-cs-common.hh +++ b/src/hb-cff-interp-cs-common.hh @@ -33,7 +33,7 @@ namespace CFF { using namespace OT; -enum CSType { +enum cs_type_t { CSType_CharString, CSType_GlobalSubr, CSType_LocalSubr @@ -41,7 +41,7 @@ enum CSType { struct call_context_t { - void init (const byte_str_ref_t substr_=byte_str_ref_t (), CSType type_=CSType_CharString, unsigned int subr_num_=0) + void init (const byte_str_ref_t substr_=byte_str_ref_t (), cs_type_t type_=CSType_CharString, unsigned int subr_num_=0) { str_ref = substr_; type = type_; @@ -51,7 +51,7 @@ struct call_context_t void fini () {} byte_str_ref_t str_ref; - CSType type; + cs_type_t type; unsigned int subr_num; }; @@ -157,7 +157,7 @@ struct cs_interp_env_t : interp_env_t return true; } - void callSubr (const biased_subrs_t& biasedSubrs, CSType type) + void callSubr (const biased_subrs_t& biasedSubrs, cs_type_t type) { unsigned int subr_num; @@ -248,7 +248,7 @@ struct path_procs_null_t template > struct cs_opset_t : opset_t { - static void process_op (OpCode op, ENV &env, PARAM& param) + static void process_op (op_code_t op, ENV &env, PARAM& param) { switch (op) { @@ -370,19 +370,19 @@ struct cs_opset_t : opset_t } } - static void process_hstem (OpCode op, ENV &env, PARAM& param) + static void process_hstem (op_code_t op, ENV &env, PARAM& param) { env.hstem_count += env.argStack.get_count () / 2; OPSET::flush_args_and_op (op, env, param); } - static void process_vstem (OpCode op, ENV &env, PARAM& param) + static void process_vstem (op_code_t op, ENV &env, PARAM& param) { env.vstem_count += env.argStack.get_count () / 2; OPSET::flush_args_and_op (op, env, param); } - static void process_hintmask (OpCode op, ENV &env, PARAM& param) + static void process_hintmask (op_code_t op, ENV &env, PARAM& param) { env.determine_hintmask_size (); if (likely (env.str_ref.avail (env.hintmask_size))) @@ -392,15 +392,15 @@ struct cs_opset_t : opset_t } } - static void process_post_flex (OpCode op, ENV &env, PARAM& param) + static void process_post_flex (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args_and_op (op, env, param); } - static void check_width (OpCode op, ENV &env, PARAM& param) + static void check_width (op_code_t op, ENV &env, PARAM& param) {} - static void process_post_move (OpCode op, ENV &env, PARAM& param) + static void process_post_move (op_code_t op, ENV &env, PARAM& param) { if (!env.seen_moveto) { @@ -410,12 +410,12 @@ struct cs_opset_t : opset_t OPSET::flush_args_and_op (op, env, param); } - static void process_post_path (OpCode op, ENV &env, PARAM& param) + static void process_post_path (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args_and_op (op, env, param); } - static void flush_args_and_op (OpCode op, ENV &env, PARAM& param) + static void flush_args_and_op (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args (env, param); OPSET::flush_op (op, env, param); @@ -426,16 +426,16 @@ struct cs_opset_t : opset_t env.pop_n_args (env.argStack.get_count ()); } - static void flush_op (OpCode op, ENV &env, PARAM& param) + static void flush_op (op_code_t op, ENV &env, PARAM& param) { } - static void flush_hintmask (OpCode op, ENV &env, PARAM& param) + static void flush_hintmask (op_code_t op, ENV &env, PARAM& param) { OPSET::flush_args_and_op (op, env, param); } - static bool is_number_op (OpCode op) + static bool is_number_op (op_code_t op) { switch (op) { diff --git a/src/hb-cff-interp-dict-common.hh b/src/hb-cff-interp-dict-common.hh index d0ad8691b..9224bf556 100644 --- a/src/hb-cff-interp-dict-common.hh +++ b/src/hb-cff-interp-dict-common.hh @@ -77,7 +77,7 @@ struct top_dict_values_t : dict_values_t struct dict_opset_t : opset_t { - static void process_op (OpCode op, interp_env_t& env) + static void process_op (op_code_t op, interp_env_t& env) { switch (op) { case OpCode_longintdict: /* 5-byte integer */ @@ -220,7 +220,7 @@ struct dict_opset_t : opset_t return value; } - static bool is_hint_op (OpCode op) + static bool is_hint_op (op_code_t op) { switch (op) { @@ -248,7 +248,7 @@ struct dict_opset_t : opset_t template struct top_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, interp_env_t& env, top_dict_values_t & dictval) + static void process_op (op_code_t op, interp_env_t& env, top_dict_values_t & dictval) { switch (op) { case OpCode_CharStrings: diff --git a/src/hb-cff1-interp-cs.hh b/src/hb-cff1-interp-cs.hh index 4d74d6e1e..c7209ed80 100644 --- a/src/hb-cff1-interp-cs.hh +++ b/src/hb-cff1-interp-cs.hh @@ -87,7 +87,7 @@ struct cff1_cs_opset_t : cs_opset_t SUPER::fini (); } - OpCode fetch_op () + op_code_t fetch_op () { if (this->str_ref.avail ()) return SUPER::fetch_op (); @@ -196,7 +196,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t template > struct cff2_cs_opset_t : cs_opset_t { - static void process_op (OpCode op, cff2_cs_interp_env_t &env, PARAM& param) + static void process_op (op_code_t op, cff2_cs_interp_env_t &env, PARAM& param) { switch (op) { case OpCode_callsubr: diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh index 0c589fdbb..0cbafa01e 100644 --- a/src/hb-ot-cff-common.hh +++ b/src/hb-ot-cff-common.hh @@ -364,7 +364,7 @@ struct Dict : UnsizedByteStr } template - static bool serialize_int_op (hb_serialize_context_t *c, OpCode op, int value, OpCode intOp) + static bool serialize_int_op (hb_serialize_context_t *c, op_code_t op, int value, op_code_t intOp) { // XXX: not sure why but LLVM fails to compile the following 'unlikely' macro invocation if (/*unlikely*/ (!serialize_int (c, intOp, value))) @@ -384,18 +384,18 @@ struct Dict : UnsizedByteStr return_trace (true); } - static bool serialize_uint4_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_uint4_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_int_op (c, op, value, OpCode_longintdict); } - static bool serialize_uint2_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_uint2_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_int_op (c, op, value, OpCode_shortint); } - static bool serialize_offset4_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_offset4_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_uint4_op (c, op, value); } - static bool serialize_offset2_op (hb_serialize_context_t *c, OpCode op, int value) + static bool serialize_offset2_op (hb_serialize_context_t *c, op_code_t op, int value) { return serialize_uint2_op (c, op, value); } diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index 40b4e1b4a..3594a94c2 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -628,7 +628,7 @@ struct cff1_top_dict_interp_env_t : num_interp_env_t struct name_dict_values_t { - enum NameDictValIndex + enum name_dict_val_index_t { version, notice, @@ -657,7 +657,7 @@ struct name_dict_values_t unsigned int operator[] (unsigned int i) const { assert (i < ValCount); return values[i]; } - static enum NameDictValIndex name_op_to_index (OpCode op) + static enum name_dict_val_index_t name_op_to_index (op_code_t op) { switch (op) { default: // can't happen - just make some compiler happy @@ -722,7 +722,7 @@ struct cff1_top_dict_values_t : top_dict_values_t struct cff1_top_dict_opset_t : top_dict_opset_t { - static void process_op (OpCode op, cff1_top_dict_interp_env_t& env, cff1_top_dict_values_t& dictval) + static void process_op (op_code_t op, cff1_top_dict_interp_env_t& env, cff1_top_dict_values_t& dictval) { cff1_top_dict_val_t val; val.last_arg_offset = (env.last_offset-1) - dictval.opStart; /* offset to the last argument */ @@ -823,7 +823,7 @@ struct cff1_font_dict_values_t : dict_values_t struct cff1_font_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, num_interp_env_t& env, cff1_font_dict_values_t& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff1_font_dict_values_t& dictval) { switch (op) { case OpCode_FontName: @@ -883,7 +883,7 @@ typedef cff1_private_dict_values_base_t cff1_private_dict_values struct cff1_private_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, num_interp_env_t& env, cff1_private_dict_values_t& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_t& dictval) { num_dict_val_t val; val.init (); @@ -930,7 +930,7 @@ struct cff1_private_dict_opset_t : dict_opset_t struct cff1_private_dict_opset_subset : dict_opset_t { - static void process_op (OpCode op, num_interp_env_t& env, cff1_private_dict_values_subset_t& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff1_private_dict_values_subset_t& dictval) { switch (op) { case OpCode_BlueValues: diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index 5f6ce92cb..33aff389e 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -151,7 +151,7 @@ struct cff2_top_dict_values_t : top_dict_values_t<> unsigned int size = 0; for (unsigned int i = 0; i < get_count (); i++) { - OpCode op = get_value (i).op; + op_code_t op = get_value (i).op; switch (op) { case OpCode_vstore: @@ -172,7 +172,7 @@ struct cff2_top_dict_values_t : top_dict_values_t<> struct cff2_top_dict_opset_t : top_dict_opset_t<> { - static void process_op (OpCode op, num_interp_env_t& env, cff2_top_dict_values_t& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff2_top_dict_values_t& dictval) { switch (op) { case OpCode_FontMatrix: @@ -221,7 +221,7 @@ struct cff2_font_dict_values_t : dict_values_t struct cff2_font_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, num_interp_env_t& env, cff2_font_dict_values_t& dictval) + static void process_op (op_code_t op, num_interp_env_t& env, cff2_font_dict_values_t& dictval) { switch (op) { case OpCode_Private: @@ -304,7 +304,7 @@ struct cff2_priv_dict_interp_env_t : num_interp_env_t struct cff2_private_dict_opset_t : dict_opset_t { - static void process_op (OpCode op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_t& dictval) + static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_t& dictval) { num_dict_val_t val; val.init (); @@ -354,7 +354,7 @@ struct cff2_private_dict_opset_t : dict_opset_t struct cff2_private_dict_opset_subset_t : dict_opset_t { - static void process_op (OpCode op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_subset_t& dictval) + static void process_op (op_code_t op, cff2_priv_dict_interp_env_t& env, cff2_private_dict_values_subset_t& dictval) { switch (op) { case OpCode_BlueValues: diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index dd1487d5c..fe8ecf991 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -96,7 +96,7 @@ struct str_encoder_t } } - void encode_op (OpCode op) + void encode_op (op_code_t op) { if (Is_OpCode_ESC (op)) { @@ -403,13 +403,13 @@ struct parsed_cs_str_t : parsed_values_t has_prefix_ = false; } - void add_op (OpCode op, const byte_str_ref_t& str_ref) + void add_op (op_code_t op, const byte_str_ref_t& str_ref) { if (!is_parsed ()) SUPER::add_op (op, str_ref); } - void add_call_op (OpCode op, const byte_str_ref_t& str_ref, unsigned int subr_num) + void add_call_op (op_code_t op, const byte_str_ref_t& str_ref, unsigned int subr_num) { if (!is_parsed ()) { @@ -423,7 +423,7 @@ struct parsed_cs_str_t : parsed_values_t } } - void set_prefix (const number_t &num, OpCode op = OpCode_Invalid) + void set_prefix (const number_t &num, op_code_t op = OpCode_Invalid) { has_prefix_ = true; prefix_op_ = op; @@ -446,7 +446,7 @@ struct parsed_cs_str_t : parsed_values_t void set_vsindex_dropped () { vsindex_dropped = true; } bool has_prefix () const { return has_prefix_; } - OpCode prefix_op () const { return prefix_op_; } + op_code_t prefix_op () const { return prefix_op_; } const number_t &prefix_num () const { return prefix_num_; } protected: @@ -454,7 +454,7 @@ struct parsed_cs_str_t : parsed_values_t bool hint_dropped; bool vsindex_dropped; bool has_prefix_; - OpCode prefix_op_; + op_code_t prefix_op_; number_t prefix_num_; private: diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index aa6f7d318..697773446 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -130,7 +130,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t { - static void flush_args_and_op (OpCode op, cff1_cs_interp_env_t &env, flatten_param_t& param) + static void flush_args_and_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param) { if (env.arg_start > 0) flush_width (env, param); @@ -295,7 +295,7 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t { - static void process_op (OpCode op, cff1_cs_interp_env_t &env, subr_subset_param_t& param) + static void process_op (op_code_t op, cff1_cs_interp_env_t &env, subr_subset_param_t& param) { switch (op) { @@ -377,7 +377,7 @@ struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t struct cff2_cs_opset_flatten_t : cff2_cs_opset_t { - static void flush_args_and_op (OpCode op, cff2_cs_interp_env_t &env, flatten_param_t& param) + static void flush_args_and_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param) { switch (op) { @@ -157,7 +157,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t { - static void process_op (OpCode op, cff2_cs_interp_env_t &env, subr_subset_param_t& param) + static void process_op (op_code_t op, cff2_cs_interp_env_t &env, subr_subset_param_t& param) { switch (op) { @@ -208,7 +208,7 @@ struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t