1 /* dvipos-20070107 2 3 Copyright (C) 2003 by Jin-Hwan <chofchof@ktug.or.kr> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 18 */ 19 20 #ifndef _DVICORE_H_ 21 #define _DVICORE_H_ 22 23 #include "utils.h" 24 25 /* DVI opcodes */ 26 #define SET_CHAR_0 0 27 #define SET_CHAR_1 1 28 /* etc. */ 29 #define SET_CHAR_127 127 30 #define SET1 128 /* Typesets its single operand between 128 and 255 */ 31 #define SET2 129 /* Typesets its single two byte unsigned operand */ 32 #define SET3 130 /* Typesets its single three byte unsigned operand */ 33 #define SET4 131 /* Typesets its single four byte unsigned operand */ 34 /* Sets a rule of height param1(four bytes) and width param2(four bytes) 35 * These are *signed*. Nothing typeset for nonpositive values 36 * However, negative value *do* change current point */ 37 #define SET_RULE 132 38 #define PUT1 133 /* Like SET1, but point doesn't change */ 39 #define PUT2 134 /* Like SET2 */ 40 #define PUT3 135 /* Like SET3 */ 41 #define PUT4 136 /* Like SET4 */ 42 #define PUT_RULE 137 /* Like SET_RULE */ 43 #define NOP 138 44 /* Followed by 10 four byte count registers (signed?). 45 * Last parameter points to previous BOP (backward linked, first BOP has -1). 46 * BOP clears stack and resets current point. */ 47 #define BOP 139 48 #define EOP 140 49 #define PUSH 141 /* Pushes h,v,w,x,y,z */ 50 #define POP 142 /* Opposite of push */ 51 #define RIGHT1 143 /* Move right by one byte signed operand */ 52 #define RIGHT2 144 /* Move right by two byte signed operand */ 53 #define RIGHT3 145 /* Move right by three byte signed operand */ 54 #define RIGHT4 146 /* Move right by four byte signed operand */ 55 #define W0 147 /* Move right w */ 56 #define W1 148 /* w single byte signed operand. Move right by same amount */ 57 #define W2 149 /* Same as W1 with two byte signed operand */ 58 #define W3 150 /* Three byte signed operand */ 59 #define W4 151 /* Four byte signed operand */ 60 #define X0 152 /* Move right x */ 61 #define X1 153 /* Like W1 */ 62 #define X2 154 /* Like W2 */ 63 #define X3 155 /* Like W3 */ 64 #define X4 156 /* Like W4 */ 65 #define DOWN1 157 /* Move down by one byte signed operand */ 66 #define DOWN2 158 /* Two byte signed operand */ 67 #define DOWN3 159 /* Three byte signed operand */ 68 #define DOWN4 160 /* Four byte signed operand */ 69 #define Y0 161 /* Move down by y */ 70 #define Y1 162 /* Move down by one byte signed operand, which replaces Y */ 71 #define Y2 163 /* Two byte signed operand */ 72 #define Y3 164 /* Three byte signed operand */ 73 #define Y4 165 /* Four byte signed operand */ 74 #define Z0 166 /* Like Y0, but use z */ 75 #define Z1 167 /* Like Y1 */ 76 #define Z2 168 /* Like Y2 */ 77 #define Z3 169 /* Like Y3 */ 78 #define Z4 170 /* Like Y4 */ 79 #define FNT_NUM_0 171 /* Switch to font 0 */ 80 #define FNT_NUM_1 172 /* Switch to font 1 */ 81 /* etc. */ 82 #define FNT_NUM_63 234 /* Switch to font 63 */ 83 /* Switch to font described by single byte unsigned operand */ 84 #define FNT1 235 85 /* Switch to font described by two byte unsigned operand */ 86 #define FNT2 236 87 /* Switch to font described by three byte unsigned operand */ 88 #define FNT3 237 89 /* Four byte operator (Knuth says signed, but what would be the point?) */ 90 #define FNT4 238 91 /* Special. Operand is one byte length. Special follows immediately */ 92 #define XXX1 239 93 /* Two byte operand */ 94 #define XXX2 240 95 /* Three byte operand */ 96 #define XXX3 241 97 /* Four byte operand (Knuth says TeX uses only XXX1 and XXX4 */ 98 #define XXX4 242 99 /* One byte font number, four byte checksum, four byte magnified size 100 * (DVI units), four byte designed size, single byte directory length, 101 * single byte name length, followed by complete name (area+name) */ 102 #define FNT_DEF1 243 103 #define FNT_DEF2 244 /* Same for two byte font number */ 104 #define FNT_DEF3 245 /* Same for three byte font number */ 105 #define FNT_DEF4 246 /* Four byte font number (Knuth says signed) */ 106 /* Preamble: one byte DVI version (should be 2) 107 * four byte unsigned numerator 108 * four byte unsigned denominator -- one DVI unit = den/num*10^(-7) m 109 * four byte magnification (multiplied by 1000) 110 * one byte unsigned comment length followed by comment. */ 111 #define PRE 247 112 /* Postamble: similar to preamble 113 * four byte pointer to final bop 114 * four byte numerator 115 * four byte denominator 116 * four byte mag 117 * four byte maximum height (signed?) 118 * four byte maximum width 119 * two byte max stack depth required to process file 120 * two byte number of pages */ 121 #define POST 248 122 /* End of postamble: 123 * four byte pointer to POST command 124 * Version byte (same as preamble) 125 * Padded by four or more 223's to the end of the file. */ 126 #define POST_POST 249 127 #define DIR 255 /* Ascii pTeX DIR command */ 128 129 #define DVI_ID 2 /* ID Byte for current DVI file */ 130 #define DVIV_ID 3 /* with Ascii pTeX VW mode extension */ 131 132 #define PADDING 223 133 134 #define MAX_FONTS_STEP 10 135 136 extern int dvi_pages; 137 138 extern void dvi_init (int m, int r); 139 extern void dvi_close (void); 140 extern void dvi_do_page (int n); 141 142 #endif /* _DVICORE_H_ */ 143