michael@0: /* GRAPHITE2 LICENSING michael@0: michael@0: Copyright 2010, SIL International michael@0: All rights reserved. michael@0: michael@0: This library is free software; you can redistribute it and/or modify michael@0: it under the terms of the GNU Lesser General Public License as published michael@0: by the Free Software Foundation; either version 2.1 of License, or michael@0: (at your option) any later version. michael@0: michael@0: This program is distributed in the hope that it will be useful, michael@0: but WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: Lesser General Public License for more details. michael@0: michael@0: You should also have received a copy of the GNU Lesser General Public michael@0: License along with this library in the file named "LICENSE". michael@0: If not, write to the Free Software Foundation, 51 Franklin Street, michael@0: Suite 500, Boston, MA 02110-1335, USA or visit their web page on the michael@0: internet at http://www.fsf.org/licenses/lgpl.html. michael@0: michael@0: Alternatively, the contents of this file may be used under the terms of the michael@0: Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public michael@0: License, as published by the Free Software Foundation, either version 2 michael@0: of the License or (at your option) any later version. michael@0: */ michael@0: // This file will be pulled into and integrated into a machine implmentation michael@0: // DO NOT build directly michael@0: #pragma once michael@0: michael@0: #define do2(n) do_(n) ,do_(n) michael@0: #define NILOP 0U michael@0: michael@0: // types or parameters are: (.. is inclusive) michael@0: // number - any byte michael@0: // output_class - 0 .. silf.m_nClass michael@0: // input_class - 0 .. silf.m_nClass michael@0: // sattrnum - 0 .. 29 (gr_slatJWidth) , 55 (gr_slatUserDefn) michael@0: // attrid - 0 .. silf.numUser() where sattrnum == 55; 0..silf.m_iMaxComp where sattrnum == 15 otherwise 0 michael@0: // gattrnum - 0 .. face->getGlyphFaceCache->numAttrs() michael@0: // gmetric - 0 .. 11 (kgmetDescent) michael@0: // featidx - 0 .. face.numFeatures() michael@0: // level - any byte michael@0: static const opcode_t opcode_table[] = michael@0: { michael@0: {{do2(nop)}, 0, "NOP"}, michael@0: michael@0: {{do2(push_byte)}, 1, "PUSH_BYTE"}, // number michael@0: {{do2(push_byte_u)}, 1, "PUSH_BYTE_U"}, // number michael@0: {{do2(push_short)}, 2, "PUSH_SHORT"}, // number number michael@0: {{do2(push_short_u)}, 2, "PUSH_SHORT_U"}, // number number michael@0: {{do2(push_long)}, 4, "PUSH_LONG"}, // number number number number michael@0: michael@0: {{do2(add)}, 0, "ADD"}, michael@0: {{do2(sub)}, 0, "SUB"}, michael@0: {{do2(mul)}, 0, "MUL"}, michael@0: {{do2(div_)}, 0, "DIV"}, michael@0: {{do2(min_)}, 0, "MIN"}, michael@0: {{do2(max_)}, 0, "MAX"}, michael@0: {{do2(neg)}, 0, "NEG"}, michael@0: {{do2(trunc8)}, 0, "TRUNC8"}, michael@0: {{do2(trunc16)}, 0, "TRUNC16"}, michael@0: michael@0: {{do2(cond)}, 0, "COND"}, michael@0: {{do2(and_)}, 0, "AND"}, // 0x10 michael@0: {{do2(or_)}, 0, "OR"}, michael@0: {{do2(not_)}, 0, "NOT"}, michael@0: {{do2(equal)}, 0, "EQUAL"}, michael@0: {{do2(not_eq_)}, 0, "NOT_EQ"}, michael@0: {{do2(less)}, 0, "LESS"}, michael@0: {{do2(gtr)}, 0, "GTR"}, michael@0: {{do2(less_eq)}, 0, "LESS_EQ"}, michael@0: {{do2(gtr_eq)}, 0, "GTR_EQ"}, // 0x18 michael@0: michael@0: {{do_(next), NILOP}, 0, "NEXT"}, michael@0: {{do_(next_n), NILOP}, 1, "NEXT_N"}, // number <= smap.end - map michael@0: {{do_(next), NILOP}, 0, "COPY_NEXT"}, michael@0: {{do_(put_glyph_8bit_obs), NILOP}, 1, "PUT_GLYPH_8BIT_OBS"}, // output_class michael@0: {{do_(put_subs_8bit_obs), NILOP}, 3, "PUT_SUBS_8BIT_OBS"}, // slot input_class output_class michael@0: {{do_(put_copy), NILOP}, 1, "PUT_COPY"}, // slot michael@0: {{do_(insert), NILOP}, 0, "INSERT"}, michael@0: {{do_(delete_), NILOP}, 0, "DELETE"}, // 0x20 michael@0: {{do_(assoc), NILOP}, VARARGS, "ASSOC"}, michael@0: {{NILOP ,do_(cntxt_item)}, 2, "CNTXT_ITEM"}, // slot offset michael@0: michael@0: {{do_(attr_set), NILOP}, 1, "ATTR_SET"}, // sattrnum michael@0: {{do_(attr_add), NILOP}, 1, "ATTR_ADD"}, // sattrnum michael@0: {{do_(attr_sub), NILOP}, 1, "ATTR_SUB"}, // sattrnum michael@0: {{do_(attr_set_slot), NILOP}, 1, "ATTR_SET_SLOT"}, // sattrnum michael@0: {{do_(iattr_set_slot), NILOP}, 2, "IATTR_SET_SLOT"}, // sattrnum attrid michael@0: {{do2(push_slot_attr)}, 2, "PUSH_SLOT_ATTR"}, // sattrnum slot michael@0: {{do2(push_glyph_attr_obs)}, 2, "PUSH_GLYPH_ATTR_OBS"}, // gattrnum slot michael@0: {{do2(push_glyph_metric)}, 3, "PUSH_GLYPH_METRIC"}, // gmetric slot level michael@0: {{do2(push_feat)}, 2, "PUSH_FEAT"}, // featidx slot michael@0: michael@0: {{do2(push_att_to_gattr_obs)}, 2, "PUSH_ATT_TO_GATTR_OBS"}, // gattrnum slot michael@0: {{do2(push_att_to_glyph_metric)}, 3, "PUSH_ATT_TO_GLYPH_METRIC"}, // gmetric slot level michael@0: {{do2(push_islot_attr)}, 3, "PUSH_ISLOT_ATTR"}, // sattrnum slot attrid michael@0: michael@0: {{NILOP,NILOP}, 3, "PUSH_IGLYPH_ATTR"}, michael@0: michael@0: {{do2(pop_ret)}, 0, "POP_RET"}, // 0x30 michael@0: {{do2(ret_zero)}, 0, "RET_ZERO"}, michael@0: {{do2(ret_true)}, 0, "RET_TRUE"}, michael@0: michael@0: {{do_(iattr_set), NILOP}, 2, "IATTR_SET"}, // sattrnum attrid michael@0: {{do_(iattr_add), NILOP}, 2, "IATTR_ADD"}, // sattrnum attrid michael@0: {{do_(iattr_sub), NILOP}, 2, "IATTR_SUB"}, // sattrnum attrid michael@0: {{do2(push_proc_state)}, 1, "PUSH_PROC_STATE"}, // dummy michael@0: {{do2(push_version)}, 0, "PUSH_VERSION"}, michael@0: {{do_(put_subs), NILOP}, 5, "PUT_SUBS"}, // slot input_class input_class output_class output_class michael@0: {{NILOP,NILOP}, 0, "PUT_SUBS2"}, michael@0: {{NILOP,NILOP}, 0, "PUT_SUBS3"}, michael@0: {{do_(put_glyph), NILOP}, 2, "PUT_GLYPH"}, // output_class output_class michael@0: {{do2(push_glyph_attr)}, 3, "PUSH_GLYPH_ATTR"}, // gattrnum gattrnum slot michael@0: {{do2(push_att_to_glyph_attr)}, 3, "PUSH_ATT_TO_GLYPH_ATTR"}, // gattrnum gattrnum slot michael@0: // private opcodes for internal use only, comes after all other on disk opcodes. michael@0: {{do_(temp_copy), NILOP}, 0, "TEMP_COPY"} michael@0: }; michael@0: