1 /* commands.h */ 2 3 /************************************************************************ 4 5 Part of the dvipng distribution 6 7 This program is free software: you can redistribute it and/or modify 8 it under the terms of the GNU Lesser General Public License as 9 published by the Free Software Foundation, either version 3 of the 10 License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with this program. If not, see 19 <http://www.gnu.org/licenses/>. 20 21 Copyright (C) 2002-2008 Jan-�ke Larsson 22 23 ************************************************************************/ 24 25 /* DVI COMMANDS */ 26 #define DVIFORMAT 2 27 28 #define SETC_000 0 /* typeset character 0 and move right */ 29 #define SETC_127 127 /* typeset character 127 and move right */ 30 #define SET1 128 /* typeset a character and move right */ 31 #define SET2 129 /* ??? */ 32 #define SET3 130 /* ??? */ 33 #define SET4 131 /* ??? */ 34 #define SET_RULE 132 /* typeset a rule and move right */ 35 #define PUT1 133 /* typeset a character */ 36 #define PUT2 134 /* ??? */ 37 #define PUT3 135 /* ??? */ 38 #define PUT4 136 /* ??? */ 39 #define PUT_RULE 137 /* typeset a rule */ 40 #define NOP 138 /* no operation */ 41 #define BOP 139 /* beginning of page */ 42 #define EOP 140 /* ending of page */ 43 #define PUSH 141 /* save the current positions */ 44 #define POP 142 /* restore previous positions */ 45 #define RIGHT1 143 /* move right */ 46 #define RIGHT2 144 /* ??? */ 47 #define RIGHT3 145 /* ??? */ 48 #define RIGHT4 146 /* ??? */ 49 #define W0 147 /* move right by |w| */ 50 #define W1 148 /* move right and set |w| */ 51 #define W2 149 /* ??? */ 52 #define W3 150 /* ??? */ 53 #define W4 151 /* ??? */ 54 #define X0 152 /* move right by |x| */ 55 #define X1 153 /* move right and set |x| */ 56 #define X2 154 /* ??? */ 57 #define X3 155 /* ??? */ 58 #define X4 156 /* ??? */ 59 #define DOWN1 157 /* move down */ 60 #define DOWN2 158 /* ??? */ 61 #define DOWN3 159 /* ??? */ 62 #define DOWN4 160 /* ??? */ 63 #define Y0 161 /* move down by |y| */ 64 #define Y1 162 /* move down and set |y| */ 65 #define Y2 163 /* ??? */ 66 #define Y3 164 /* ??? */ 67 #define Y4 165 /* ??? */ 68 #define Z0 166 /* move down by |z| */ 69 #define Z1 167 /* move down and set |z| */ 70 #define Z2 168 /* ??? */ 71 #define Z3 169 /* ??? */ 72 #define Z4 170 /* ??? */ 73 #define FONT_00 171 /* set current font to 0 */ 74 #define FONT_63 234 /* set current font to 63 */ 75 #define FNT1 235 /* set current font */ 76 #define FNT2 236 /* Same as FNT1, except that arg is 2 bytes */ 77 #define FNT3 237 /* Same as FNT1, except that arg is 3 bytes */ 78 #define FNT4 238 /* Same as FNT1, except that arg is 4 bytes */ 79 #define XXX1 239 /* extension to \.DVI primitives */ 80 #define XXX2 240 /* Like XXX1, but 0<=k<65536 */ 81 #define XXX3 241 /* Like XXX1, but 0<=k<@t$2^{24}$@> */ 82 #define XXX4 242 /* potentially long extension to \.DVI 83 primitives */ 84 #define FNT_DEF1 243 /* define the meaning of a font number */ 85 #define FNT_DEF2 244 /* ??? */ 86 #define FNT_DEF3 245 /* ??? */ 87 #define FNT_DEF4 246 /* ??? */ 88 #define PRE 247 /* preamble */ 89 #define POST 248 /* postamble beginning */ 90 #define POST_POST 249 /* postamble ending */ 91 92 /* undefined_commands 250,251,252,253,254,255 */ 93 94 EXTERN const int8_t dvi_commandlength[256] 95 #ifdef MAIN 96 ={ 97 1,1,1,1,1,1,1,1,1,1, 98 1,1,1,1,1,1,1,1,1,1, 99 1,1,1,1,1,1,1,1,1,1, 100 1,1,1,1,1,1,1,1,1,1, 101 1,1,1,1,1,1,1,1,1,1, 102 1,1,1,1,1,1,1,1,1,1, 103 1,1,1,1,1,1,1,1,1,1, 104 1,1,1,1,1,1,1,1,1,1, 105 1,1,1,1,1,1,1,1,1,1, 106 1,1,1,1,1,1,1,1,1,1, 107 1,1,1,1,1,1,1,1,1,1, 108 1,1,1,1,1,1,1,1,1,1, 109 1,1,1,1,1,1,1,1, /* SETC_000 --- SETC_127 */ 110 2,3,4,5,9, /* SET1 --- SET4, SET_RULE */ 111 2,3,4,5,9, /* PUT1 --- PUT4, PUT_RULE */ 112 1,45,1,1,1, /* NOP, BOP, EOP, PUSH, POP */ 113 2,3,4,5, /* RIGHT1 --- RIGHT4 */ 114 1,2,3,4,5, /* W0 --- W4 */ 115 1,2,3,4,5, /* X0 --- X4 */ 116 2,3,4,5, /* DOWN1 --- DOWN4 */ 117 1,2,3,4,5, /* Y0 --- Y4 */ 118 1,2,3,4,5, /* Z0 --- Z4 */ 119 1,1,1,1,1,1,1,1,1,1, 120 1,1,1,1,1,1,1,1,1,1, 121 1,1,1,1,1,1,1,1,1,1, 122 1,1,1,1,1,1,1,1,1,1, 123 1,1,1,1,1,1,1,1,1,1, 124 1,1,1,1,1,1,1,1,1,1, 125 1,1,1,1, /* FONT_00 --- FONT_63 */ 126 2,3,4,5, /* FNT1 --- FNT4 */ 127 2,3,4,5, /* XXX1 --- XXX4 + special string */ 128 16,17,18,19, /* FNT_DEF1 --- FNT_DEF4 + font name */ 129 15, /* PRE + TeX comment */ 130 29, /* POST */ 131 10, /* POST_POST minimum */ 132 -1,-1,-1,-1,-1,-1 /* undefined */ 133 } 134 #endif 135 ; 136 137 EXTERN const char* dvi_commands[256] 138 #ifdef MAIN 139 ={ 140 "SETC_000","SETC_001","SETC_002","SETC_003","SETC_004", 141 "SETC_005","SETC_006","SETC_007","SETC_008","SETC_009", 142 "SETC_010","SETC_011","SETC_012","SETC_013","SETC_014", 143 "SETC_015","SETC_016","SETC_017","SETC_018","SETC_019", 144 "SETC_020","SETC_021","SETC_022","SETC_023","SETC_024", 145 "SETC_025","SETC_026","SETC_027","SETC_028","SETC_029", 146 "SETC_030","SETC_031","SETC_032","SETC_033","SETC_034", 147 "SETC_035","SETC_036","SETC_037","SETC_038","SETC_039", 148 "SETC_040","SETC_041","SETC_042","SETC_043","SETC_044", 149 "SETC_045","SETC_046","SETC_047","SETC_048","SETC_049", 150 "SETC_050","SETC_051","SETC_052","SETC_053","SETC_054", 151 "SETC_055","SETC_056","SETC_057","SETC_058","SETC_059", 152 "SETC_060","SETC_061","SETC_062","SETC_063","SETC_064", 153 "SETC_065","SETC_066","SETC_067","SETC_068","SETC_069", 154 "SETC_070","SETC_071","SETC_072","SETC_073","SETC_074", 155 "SETC_075","SETC_076","SETC_077","SETC_078","SETC_079", 156 "SETC_080","SETC_081","SETC_082","SETC_083","SETC_084", 157 "SETC_085","SETC_086","SETC_087","SETC_088","SETC_089", 158 "SETC_090","SETC_091","SETC_092","SETC_093","SETC_094", 159 "SETC_095","SETC_096","SETC_097","SETC_098","SETC_099", 160 "SETC_100","SETC_101","SETC_102","SETC_103","SETC_104", 161 "SETC_105","SETC_106","SETC_107","SETC_108","SETC_109", 162 "SETC_110","SETC_111","SETC_112","SETC_113","SETC_114", 163 "SETC_115","SETC_116","SETC_117","SETC_118","SETC_119", 164 "SETC_120","SETC_121","SETC_122","SETC_123","SETC_124", 165 "SETC_125","SETC_126","SETC_127", 166 "SET1","SET2","SET3","SET4","SET_RULE", 167 "PUT1","PUT2","PUT3","PUT4","PUT_RULE", 168 "NOP","BOP","EOP","PUSH","POP", 169 "RIGHT1","RIGHT2","RIGHT3","RIGHT4", 170 "W0","W1","W2","W3","W4", 171 "X0","X1","X2","X3","X4", 172 "DOWN1","DOWN2","DOWN3","DOWN4", 173 "Y0","Y1","Y2","Y3","Y4", 174 "Z0","Z1","Z2","Z3","Z4", 175 "FONT_00","FONT_01","FONT_02","FONT_03","FONT_04", 176 "FONT_05","FONT_06","FONT_07","FONT_08","FONT_09", 177 "FONT_10","FONT_11","FONT_12","FONT_13","FONT_14", 178 "FONT_15","FONT_16","FONT_17","FONT_18","FONT_19", 179 "FONT_20","FONT_21","FONT_22","FONT_23","FONT_24", 180 "FONT_25","FONT_26","FONT_27","FONT_28","FONT_29", 181 "FONT_30","FONT_31","FONT_32","FONT_33","FONT_34", 182 "FONT_35","FONT_36","FONT_37","FONT_38","FONT_39", 183 "FONT_40","FONT_41","FONT_42","FONT_43","FONT_44", 184 "FONT_45","FONT_46","FONT_47","FONT_48","FONT_49", 185 "FONT_50","FONT_51","FONT_52","FONT_53","FONT_54", 186 "FONT_55","FONT_56","FONT_57","FONT_58","FONT_59", 187 "FONT_60","FONT_61","FONT_62","FONT_63", 188 "FNT1","FNT2","FNT3","FNT4", 189 "XXX1","XXX2","XXX3","XXX4", 190 "FNT_DEF1","FNT_DEF2","FNT_DEF3","FNT_DEF4", 191 "PRE","POST","POST_POST", 192 "UNDEF_250","UNDEF_251","UNDEF_252","UNDEF_253","UNDEF_254","UNDEF_255" 193 } 194 #endif 195 ; 196 197