uncamelized non-struct types OpCode etc

This commit is contained in:
Michiharu Ariza 2018-12-20 16:17:05 -08:00
parent 45e4bf0e8f
commit 58c876b1cc
11 changed files with 70 additions and 70 deletions

View File

@ -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 <HBUINT8>
{
// encode 2-byte int (Dict/CharString) or 4-byte int (Dict)
template <typename INTTYPE, int minVal, int maxVal>
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 <typename ARG=number_t>
struct opset_t
{
static void process_op (OpCode op, interp_env_t<ARG>& env)
static void process_op (op_code_t op, interp_env_t<ARG>& env)
{
switch (op) {
case OpCode_shortint:

View File

@ -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<ARG>
return true;
}
void callSubr (const biased_subrs_t<SUBRS>& biasedSubrs, CSType type)
void callSubr (const biased_subrs_t<SUBRS>& biasedSubrs, cs_type_t type)
{
unsigned int subr_num;
@ -248,7 +248,7 @@ struct path_procs_null_t
template <typename ARG, typename OPSET, typename ENV, typename PARAM, typename PATH=path_procs_null_t<ENV, PARAM> >
struct cs_opset_t : opset_t<ARG>
{
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<ARG>
}
}
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<ARG>
}
}
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<ARG>
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<ARG>
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)
{

View File

@ -77,7 +77,7 @@ struct top_dict_values_t : dict_values_t<OPSTR>
struct dict_opset_t : opset_t<number_t>
{
static void process_op (OpCode op, interp_env_t<number_t>& env)
static void process_op (op_code_t op, interp_env_t<number_t>& env)
{
switch (op) {
case OpCode_longintdict: /* 5-byte integer */
@ -220,7 +220,7 @@ struct dict_opset_t : opset_t<number_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<number_t>
template <typename VAL=op_str_t>
struct top_dict_opset_t : dict_opset_t
{
static void process_op (OpCode op, interp_env_t<number_t>& env, top_dict_values_t<VAL> & dictval)
static void process_op (op_code_t op, interp_env_t<number_t>& env, top_dict_values_t<VAL> & dictval)
{
switch (op) {
case OpCode_CharStrings:

View File

@ -87,7 +87,7 @@ struct cff1_cs_opset_t : cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM
/* PostScript-originated legacy opcodes (OpCode_add etc) are unsupported */
/* Type 1-originated deprecated opcodes, seac behavior of endchar and dotsection are supported */
static void process_op (OpCode op, cff1_cs_interp_env_t &env, PARAM& param)
static void process_op (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param)
{
switch (op) {
case OpCode_dotsection:
@ -109,7 +109,7 @@ struct cff1_cs_opset_t : cs_opset_t<number_t, OPSET, cff1_cs_interp_env_t, PARAM
}
}
static void check_width (OpCode op, cff1_cs_interp_env_t &env, PARAM& param)
static void check_width (op_code_t op, cff1_cs_interp_env_t &env, PARAM& param)
{
if (!env.processed_width)
{

View File

@ -100,7 +100,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
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<blend_arg_t, CFF2Subrs>
template <typename OPSET, typename PARAM, typename PATH=path_procs_null_t<cff2_cs_interp_env_t, PARAM> >
struct cff2_cs_opset_t : cs_opset_t<blend_arg_t, OPSET, cff2_cs_interp_env_t, PARAM, PATH>
{
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:

View File

@ -364,7 +364,7 @@ struct Dict : UnsizedByteStr
}
template <typename INTTYPE, int minVal, int maxVal>
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<INTTYPE, minVal, maxVal> (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<HBUINT32, 0, 0x7FFFFFFF> (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<HBUINT16, 0, 0x7FFF> (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);
}

View File

@ -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<cff1_top_dict_val_t>
struct cff1_top_dict_opset_t : top_dict_opset_t<cff1_top_dict_val_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<op_str_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<num_dict_val_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:

View File

@ -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<op_str_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:

View File

@ -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<parsed_cs_op_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<parsed_cs_op_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<parsed_cs_op_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<parsed_cs_op_t>
bool hint_dropped;
bool vsindex_dropped;
bool has_prefix_;
OpCode prefix_op_;
op_code_t prefix_op_;
number_t prefix_num_;
private:

View File

@ -130,7 +130,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
{
TRACE_SERIALIZE (this);
OpCode op = opstr.op;
op_code_t op = opstr.op;
switch (op)
{
case OpCode_charset:
@ -183,7 +183,7 @@ struct cff1_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<cff1_top_dic
unsigned int calculate_serialized_size (const cff1_top_dict_val_t &opstr) const
{
OpCode op = opstr.op;
op_code_t op = opstr.op;
switch (op)
{
case OpCode_charset:
@ -261,7 +261,7 @@ struct cff1_font_dict_op_serializer_t : cff_font_dict_op_serializer_t
struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatten_param_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<cff1_cs_opset_flatten_t, flatte
SUPER::flush_args (env, param);
}
static void flush_op (OpCode op, cff1_cs_interp_env_t &env, flatten_param_t& param)
static void flush_op (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
{
str_encoder_t encoder (param.flatStr);
encoder.encode_op (op);
@ -308,7 +308,7 @@ struct cff1_cs_opset_flatten_t : cff1_cs_opset_t<cff1_cs_opset_flatten_t, flatte
encoder.encode_num (env.width);
}
static void flush_hintmask (OpCode op, cff1_cs_interp_env_t &env, flatten_param_t& param)
static void flush_hintmask (op_code_t op, cff1_cs_interp_env_t &env, flatten_param_t& param)
{
SUPER::flush_hintmask (op, env, param);
if (!param.drop_hints)
@ -344,7 +344,7 @@ struct range_list_t : hb_vector_t<code_pair_t>
struct cff1_cs_opset_subr_subset_t : cff1_cs_opset_t<cff1_cs_opset_subr_subset_t, subr_subset_param_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<cff1_cs_opset_subr_subset_t
}
protected:
static void process_call_subr (OpCode op, CSType type,
static void process_call_subr (op_code_t op, cs_type_t type,
cff1_cs_interp_env_t &env, subr_subset_param_t& param,
cff1_biased_subrs_t& subrs, hb_set_t *closure)
{

View File

@ -77,7 +77,7 @@ struct cff2_top_dict_op_serializer_t : cff_top_dict_op_serializer_t<>
struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatten_param_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<cff2_cs_opset_flatten_t, flatte
encoder.encode_op (OpCode_blendcs);
}
static void flush_op (OpCode op, cff2_cs_interp_env_t &env, flatten_param_t& param)
static void flush_op (op_code_t op, cff2_cs_interp_env_t &env, flatten_param_t& param)
{
switch (op)
{
@ -177,7 +177,7 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t<cff2_cs_opset_flatten_t, flatte
struct cff2_cs_opset_subr_subset_t : cff2_cs_opset_t<cff2_cs_opset_subr_subset_t, subr_subset_param_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<cff2_cs_opset_subr_subset_t
}
protected:
static void process_call_subr (OpCode op, CSType type,
static void process_call_subr (op_code_t op, cs_type_t type,
cff2_cs_interp_env_t &env, subr_subset_param_t& param,
cff2_biased_subrs_t& subrs, hb_set_t *closure)
{