Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* GRAPHITE2 LICENSING |
michael@0 | 2 | |
michael@0 | 3 | Copyright 2010, SIL International |
michael@0 | 4 | All rights reserved. |
michael@0 | 5 | |
michael@0 | 6 | This library is free software; you can redistribute it and/or modify |
michael@0 | 7 | it under the terms of the GNU Lesser General Public License as published |
michael@0 | 8 | by the Free Software Foundation; either version 2.1 of License, or |
michael@0 | 9 | (at your option) any later version. |
michael@0 | 10 | |
michael@0 | 11 | This program is distributed in the hope that it will be useful, |
michael@0 | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
michael@0 | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
michael@0 | 14 | Lesser General Public License for more details. |
michael@0 | 15 | |
michael@0 | 16 | You should also have received a copy of the GNU Lesser General Public |
michael@0 | 17 | License along with this library in the file named "LICENSE". |
michael@0 | 18 | If not, write to the Free Software Foundation, 51 Franklin Street, |
michael@0 | 19 | Suite 500, Boston, MA 02110-1335, USA or visit their web page on the |
michael@0 | 20 | internet at http://www.fsf.org/licenses/lgpl.html. |
michael@0 | 21 | |
michael@0 | 22 | Alternatively, the contents of this file may be used under the terms of the |
michael@0 | 23 | Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public |
michael@0 | 24 | License, as published by the Free Software Foundation, either version 2 |
michael@0 | 25 | of the License or (at your option) any later version. |
michael@0 | 26 | */ |
michael@0 | 27 | // This file will be pulled into and integrated into a machine implmentation |
michael@0 | 28 | // DO NOT build directly |
michael@0 | 29 | #pragma once |
michael@0 | 30 | |
michael@0 | 31 | #define do2(n) do_(n) ,do_(n) |
michael@0 | 32 | #define NILOP 0U |
michael@0 | 33 | |
michael@0 | 34 | // types or parameters are: (.. is inclusive) |
michael@0 | 35 | // number - any byte |
michael@0 | 36 | // output_class - 0 .. silf.m_nClass |
michael@0 | 37 | // input_class - 0 .. silf.m_nClass |
michael@0 | 38 | // sattrnum - 0 .. 29 (gr_slatJWidth) , 55 (gr_slatUserDefn) |
michael@0 | 39 | // attrid - 0 .. silf.numUser() where sattrnum == 55; 0..silf.m_iMaxComp where sattrnum == 15 otherwise 0 |
michael@0 | 40 | // gattrnum - 0 .. face->getGlyphFaceCache->numAttrs() |
michael@0 | 41 | // gmetric - 0 .. 11 (kgmetDescent) |
michael@0 | 42 | // featidx - 0 .. face.numFeatures() |
michael@0 | 43 | // level - any byte |
michael@0 | 44 | static const opcode_t opcode_table[] = |
michael@0 | 45 | { |
michael@0 | 46 | {{do2(nop)}, 0, "NOP"}, |
michael@0 | 47 | |
michael@0 | 48 | {{do2(push_byte)}, 1, "PUSH_BYTE"}, // number |
michael@0 | 49 | {{do2(push_byte_u)}, 1, "PUSH_BYTE_U"}, // number |
michael@0 | 50 | {{do2(push_short)}, 2, "PUSH_SHORT"}, // number number |
michael@0 | 51 | {{do2(push_short_u)}, 2, "PUSH_SHORT_U"}, // number number |
michael@0 | 52 | {{do2(push_long)}, 4, "PUSH_LONG"}, // number number number number |
michael@0 | 53 | |
michael@0 | 54 | {{do2(add)}, 0, "ADD"}, |
michael@0 | 55 | {{do2(sub)}, 0, "SUB"}, |
michael@0 | 56 | {{do2(mul)}, 0, "MUL"}, |
michael@0 | 57 | {{do2(div_)}, 0, "DIV"}, |
michael@0 | 58 | {{do2(min_)}, 0, "MIN"}, |
michael@0 | 59 | {{do2(max_)}, 0, "MAX"}, |
michael@0 | 60 | {{do2(neg)}, 0, "NEG"}, |
michael@0 | 61 | {{do2(trunc8)}, 0, "TRUNC8"}, |
michael@0 | 62 | {{do2(trunc16)}, 0, "TRUNC16"}, |
michael@0 | 63 | |
michael@0 | 64 | {{do2(cond)}, 0, "COND"}, |
michael@0 | 65 | {{do2(and_)}, 0, "AND"}, // 0x10 |
michael@0 | 66 | {{do2(or_)}, 0, "OR"}, |
michael@0 | 67 | {{do2(not_)}, 0, "NOT"}, |
michael@0 | 68 | {{do2(equal)}, 0, "EQUAL"}, |
michael@0 | 69 | {{do2(not_eq_)}, 0, "NOT_EQ"}, |
michael@0 | 70 | {{do2(less)}, 0, "LESS"}, |
michael@0 | 71 | {{do2(gtr)}, 0, "GTR"}, |
michael@0 | 72 | {{do2(less_eq)}, 0, "LESS_EQ"}, |
michael@0 | 73 | {{do2(gtr_eq)}, 0, "GTR_EQ"}, // 0x18 |
michael@0 | 74 | |
michael@0 | 75 | {{do_(next), NILOP}, 0, "NEXT"}, |
michael@0 | 76 | {{do_(next_n), NILOP}, 1, "NEXT_N"}, // number <= smap.end - map |
michael@0 | 77 | {{do_(next), NILOP}, 0, "COPY_NEXT"}, |
michael@0 | 78 | {{do_(put_glyph_8bit_obs), NILOP}, 1, "PUT_GLYPH_8BIT_OBS"}, // output_class |
michael@0 | 79 | {{do_(put_subs_8bit_obs), NILOP}, 3, "PUT_SUBS_8BIT_OBS"}, // slot input_class output_class |
michael@0 | 80 | {{do_(put_copy), NILOP}, 1, "PUT_COPY"}, // slot |
michael@0 | 81 | {{do_(insert), NILOP}, 0, "INSERT"}, |
michael@0 | 82 | {{do_(delete_), NILOP}, 0, "DELETE"}, // 0x20 |
michael@0 | 83 | {{do_(assoc), NILOP}, VARARGS, "ASSOC"}, |
michael@0 | 84 | {{NILOP ,do_(cntxt_item)}, 2, "CNTXT_ITEM"}, // slot offset |
michael@0 | 85 | |
michael@0 | 86 | {{do_(attr_set), NILOP}, 1, "ATTR_SET"}, // sattrnum |
michael@0 | 87 | {{do_(attr_add), NILOP}, 1, "ATTR_ADD"}, // sattrnum |
michael@0 | 88 | {{do_(attr_sub), NILOP}, 1, "ATTR_SUB"}, // sattrnum |
michael@0 | 89 | {{do_(attr_set_slot), NILOP}, 1, "ATTR_SET_SLOT"}, // sattrnum |
michael@0 | 90 | {{do_(iattr_set_slot), NILOP}, 2, "IATTR_SET_SLOT"}, // sattrnum attrid |
michael@0 | 91 | {{do2(push_slot_attr)}, 2, "PUSH_SLOT_ATTR"}, // sattrnum slot |
michael@0 | 92 | {{do2(push_glyph_attr_obs)}, 2, "PUSH_GLYPH_ATTR_OBS"}, // gattrnum slot |
michael@0 | 93 | {{do2(push_glyph_metric)}, 3, "PUSH_GLYPH_METRIC"}, // gmetric slot level |
michael@0 | 94 | {{do2(push_feat)}, 2, "PUSH_FEAT"}, // featidx slot |
michael@0 | 95 | |
michael@0 | 96 | {{do2(push_att_to_gattr_obs)}, 2, "PUSH_ATT_TO_GATTR_OBS"}, // gattrnum slot |
michael@0 | 97 | {{do2(push_att_to_glyph_metric)}, 3, "PUSH_ATT_TO_GLYPH_METRIC"}, // gmetric slot level |
michael@0 | 98 | {{do2(push_islot_attr)}, 3, "PUSH_ISLOT_ATTR"}, // sattrnum slot attrid |
michael@0 | 99 | |
michael@0 | 100 | {{NILOP,NILOP}, 3, "PUSH_IGLYPH_ATTR"}, |
michael@0 | 101 | |
michael@0 | 102 | {{do2(pop_ret)}, 0, "POP_RET"}, // 0x30 |
michael@0 | 103 | {{do2(ret_zero)}, 0, "RET_ZERO"}, |
michael@0 | 104 | {{do2(ret_true)}, 0, "RET_TRUE"}, |
michael@0 | 105 | |
michael@0 | 106 | {{do_(iattr_set), NILOP}, 2, "IATTR_SET"}, // sattrnum attrid |
michael@0 | 107 | {{do_(iattr_add), NILOP}, 2, "IATTR_ADD"}, // sattrnum attrid |
michael@0 | 108 | {{do_(iattr_sub), NILOP}, 2, "IATTR_SUB"}, // sattrnum attrid |
michael@0 | 109 | {{do2(push_proc_state)}, 1, "PUSH_PROC_STATE"}, // dummy |
michael@0 | 110 | {{do2(push_version)}, 0, "PUSH_VERSION"}, |
michael@0 | 111 | {{do_(put_subs), NILOP}, 5, "PUT_SUBS"}, // slot input_class input_class output_class output_class |
michael@0 | 112 | {{NILOP,NILOP}, 0, "PUT_SUBS2"}, |
michael@0 | 113 | {{NILOP,NILOP}, 0, "PUT_SUBS3"}, |
michael@0 | 114 | {{do_(put_glyph), NILOP}, 2, "PUT_GLYPH"}, // output_class output_class |
michael@0 | 115 | {{do2(push_glyph_attr)}, 3, "PUSH_GLYPH_ATTR"}, // gattrnum gattrnum slot |
michael@0 | 116 | {{do2(push_att_to_glyph_attr)}, 3, "PUSH_ATT_TO_GLYPH_ATTR"}, // gattrnum gattrnum slot |
michael@0 | 117 | // private opcodes for internal use only, comes after all other on disk opcodes. |
michael@0 | 118 | {{do_(temp_copy), NILOP}, 0, "TEMP_COPY"} |
michael@0 | 119 | }; |
michael@0 | 120 |