1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/graphite2/src/inc/opcode_table.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,120 @@ 1.4 +/* GRAPHITE2 LICENSING 1.5 + 1.6 + Copyright 2010, SIL International 1.7 + All rights reserved. 1.8 + 1.9 + This library is free software; you can redistribute it and/or modify 1.10 + it under the terms of the GNU Lesser General Public License as published 1.11 + by the Free Software Foundation; either version 2.1 of License, or 1.12 + (at your option) any later version. 1.13 + 1.14 + This program is distributed in the hope that it will be useful, 1.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of 1.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.17 + Lesser General Public License for more details. 1.18 + 1.19 + You should also have received a copy of the GNU Lesser General Public 1.20 + License along with this library in the file named "LICENSE". 1.21 + If not, write to the Free Software Foundation, 51 Franklin Street, 1.22 + Suite 500, Boston, MA 02110-1335, USA or visit their web page on the 1.23 + internet at http://www.fsf.org/licenses/lgpl.html. 1.24 + 1.25 +Alternatively, the contents of this file may be used under the terms of the 1.26 +Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public 1.27 +License, as published by the Free Software Foundation, either version 2 1.28 +of the License or (at your option) any later version. 1.29 +*/ 1.30 +// This file will be pulled into and integrated into a machine implmentation 1.31 +// DO NOT build directly 1.32 +#pragma once 1.33 + 1.34 +#define do2(n) do_(n) ,do_(n) 1.35 +#define NILOP 0U 1.36 + 1.37 +// types or parameters are: (.. is inclusive) 1.38 +// number - any byte 1.39 +// output_class - 0 .. silf.m_nClass 1.40 +// input_class - 0 .. silf.m_nClass 1.41 +// sattrnum - 0 .. 29 (gr_slatJWidth) , 55 (gr_slatUserDefn) 1.42 +// attrid - 0 .. silf.numUser() where sattrnum == 55; 0..silf.m_iMaxComp where sattrnum == 15 otherwise 0 1.43 +// gattrnum - 0 .. face->getGlyphFaceCache->numAttrs() 1.44 +// gmetric - 0 .. 11 (kgmetDescent) 1.45 +// featidx - 0 .. face.numFeatures() 1.46 +// level - any byte 1.47 +static const opcode_t opcode_table[] = 1.48 +{ 1.49 + {{do2(nop)}, 0, "NOP"}, 1.50 + 1.51 + {{do2(push_byte)}, 1, "PUSH_BYTE"}, // number 1.52 + {{do2(push_byte_u)}, 1, "PUSH_BYTE_U"}, // number 1.53 + {{do2(push_short)}, 2, "PUSH_SHORT"}, // number number 1.54 + {{do2(push_short_u)}, 2, "PUSH_SHORT_U"}, // number number 1.55 + {{do2(push_long)}, 4, "PUSH_LONG"}, // number number number number 1.56 + 1.57 + {{do2(add)}, 0, "ADD"}, 1.58 + {{do2(sub)}, 0, "SUB"}, 1.59 + {{do2(mul)}, 0, "MUL"}, 1.60 + {{do2(div_)}, 0, "DIV"}, 1.61 + {{do2(min_)}, 0, "MIN"}, 1.62 + {{do2(max_)}, 0, "MAX"}, 1.63 + {{do2(neg)}, 0, "NEG"}, 1.64 + {{do2(trunc8)}, 0, "TRUNC8"}, 1.65 + {{do2(trunc16)}, 0, "TRUNC16"}, 1.66 + 1.67 + {{do2(cond)}, 0, "COND"}, 1.68 + {{do2(and_)}, 0, "AND"}, // 0x10 1.69 + {{do2(or_)}, 0, "OR"}, 1.70 + {{do2(not_)}, 0, "NOT"}, 1.71 + {{do2(equal)}, 0, "EQUAL"}, 1.72 + {{do2(not_eq_)}, 0, "NOT_EQ"}, 1.73 + {{do2(less)}, 0, "LESS"}, 1.74 + {{do2(gtr)}, 0, "GTR"}, 1.75 + {{do2(less_eq)}, 0, "LESS_EQ"}, 1.76 + {{do2(gtr_eq)}, 0, "GTR_EQ"}, // 0x18 1.77 + 1.78 + {{do_(next), NILOP}, 0, "NEXT"}, 1.79 + {{do_(next_n), NILOP}, 1, "NEXT_N"}, // number <= smap.end - map 1.80 + {{do_(next), NILOP}, 0, "COPY_NEXT"}, 1.81 + {{do_(put_glyph_8bit_obs), NILOP}, 1, "PUT_GLYPH_8BIT_OBS"}, // output_class 1.82 + {{do_(put_subs_8bit_obs), NILOP}, 3, "PUT_SUBS_8BIT_OBS"}, // slot input_class output_class 1.83 + {{do_(put_copy), NILOP}, 1, "PUT_COPY"}, // slot 1.84 + {{do_(insert), NILOP}, 0, "INSERT"}, 1.85 + {{do_(delete_), NILOP}, 0, "DELETE"}, // 0x20 1.86 + {{do_(assoc), NILOP}, VARARGS, "ASSOC"}, 1.87 + {{NILOP ,do_(cntxt_item)}, 2, "CNTXT_ITEM"}, // slot offset 1.88 + 1.89 + {{do_(attr_set), NILOP}, 1, "ATTR_SET"}, // sattrnum 1.90 + {{do_(attr_add), NILOP}, 1, "ATTR_ADD"}, // sattrnum 1.91 + {{do_(attr_sub), NILOP}, 1, "ATTR_SUB"}, // sattrnum 1.92 + {{do_(attr_set_slot), NILOP}, 1, "ATTR_SET_SLOT"}, // sattrnum 1.93 + {{do_(iattr_set_slot), NILOP}, 2, "IATTR_SET_SLOT"}, // sattrnum attrid 1.94 + {{do2(push_slot_attr)}, 2, "PUSH_SLOT_ATTR"}, // sattrnum slot 1.95 + {{do2(push_glyph_attr_obs)}, 2, "PUSH_GLYPH_ATTR_OBS"}, // gattrnum slot 1.96 + {{do2(push_glyph_metric)}, 3, "PUSH_GLYPH_METRIC"}, // gmetric slot level 1.97 + {{do2(push_feat)}, 2, "PUSH_FEAT"}, // featidx slot 1.98 + 1.99 + {{do2(push_att_to_gattr_obs)}, 2, "PUSH_ATT_TO_GATTR_OBS"}, // gattrnum slot 1.100 + {{do2(push_att_to_glyph_metric)}, 3, "PUSH_ATT_TO_GLYPH_METRIC"}, // gmetric slot level 1.101 + {{do2(push_islot_attr)}, 3, "PUSH_ISLOT_ATTR"}, // sattrnum slot attrid 1.102 + 1.103 + {{NILOP,NILOP}, 3, "PUSH_IGLYPH_ATTR"}, 1.104 + 1.105 + {{do2(pop_ret)}, 0, "POP_RET"}, // 0x30 1.106 + {{do2(ret_zero)}, 0, "RET_ZERO"}, 1.107 + {{do2(ret_true)}, 0, "RET_TRUE"}, 1.108 + 1.109 + {{do_(iattr_set), NILOP}, 2, "IATTR_SET"}, // sattrnum attrid 1.110 + {{do_(iattr_add), NILOP}, 2, "IATTR_ADD"}, // sattrnum attrid 1.111 + {{do_(iattr_sub), NILOP}, 2, "IATTR_SUB"}, // sattrnum attrid 1.112 + {{do2(push_proc_state)}, 1, "PUSH_PROC_STATE"}, // dummy 1.113 + {{do2(push_version)}, 0, "PUSH_VERSION"}, 1.114 + {{do_(put_subs), NILOP}, 5, "PUT_SUBS"}, // slot input_class input_class output_class output_class 1.115 + {{NILOP,NILOP}, 0, "PUT_SUBS2"}, 1.116 + {{NILOP,NILOP}, 0, "PUT_SUBS3"}, 1.117 + {{do_(put_glyph), NILOP}, 2, "PUT_GLYPH"}, // output_class output_class 1.118 + {{do2(push_glyph_attr)}, 3, "PUSH_GLYPH_ATTR"}, // gattrnum gattrnum slot 1.119 + {{do2(push_att_to_glyph_attr)}, 3, "PUSH_ATT_TO_GLYPH_ATTR"}, // gattrnum gattrnum slot 1.120 + // private opcodes for internal use only, comes after all other on disk opcodes. 1.121 + {{do_(temp_copy), NILOP}, 0, "TEMP_COPY"} 1.122 +}; 1.123 +