| 1 |
/* Copyright (c) 1987, 1989, 2012 University of Maryland Department of |
| 2 |
Computer Science. |
| 3 |
|
| 4 |
Permission is hereby granted, free of charge, to any person obtaining |
| 5 |
a copy of this software and associated documentation files (the |
| 6 |
"Software"), to deal in the Software without restriction, including |
| 7 |
without limitation, the rights to use, copy, modify, merge, publish, |
| 8 |
distribute, sublicense, and/or sell copies of the Software, and to |
| 9 |
permit persons to whom the Software is furnished to do so, subject to |
| 10 |
the following conditions: The above copyright notice, this permission |
| 11 |
notice and the disclaimer statement shall be included in all copies |
| 12 |
or substantial portions of the Software. |
| 13 |
|
| 14 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 15 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 16 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 17 |
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 18 |
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 19 |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 20 |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
|
| 23 |
/* |
| 24 |
* dviclass - DVI code classification tables. |
| 25 |
*/ |
| 26 |
|
| 27 |
#include "dviclass.h" |
| 28 |
|
| 29 |
/* shorthand---in lowercase for contrast (read on!) */ |
| 30 |
#define four(x) x, x, x, x |
| 31 |
#ifdef ASCIIPTEX |
| 32 |
#define five(x) four(x), x |
| 33 |
#endif /* ASCIIPTEX */ |
| 34 |
#define six(x) four(x), x, x |
| 35 |
#define sixteen(x) four(x), four(x), four(x), four(x) |
| 36 |
#define sixty_four(x) sixteen(x), sixteen(x), sixteen(x), sixteen(x) |
| 37 |
#define one_twenty_eight(x) sixty_four(x), sixty_four(x) |
| 38 |
|
| 39 |
/* |
| 40 |
* This table contains the byte length of the single operand, or DPL_NONE |
| 41 |
* if no operand, or if it cannot be decoded this way. |
| 42 |
* |
| 43 |
* The sequences UNS1, UNS2, UNS3, SGN4 (`SEQ_U') and SGN1, SGN2, SGN3, |
| 44 |
* SGN4 (`SEQ_S') are rather common, and so we define macros for these. |
| 45 |
*/ |
| 46 |
#define SEQ_U DPL_UNS1, DPL_UNS2, DPL_UNS3, DPL_SGN4 |
| 47 |
#define SEQ_S DPL_SGN1, DPL_SGN2, DPL_SGN3, DPL_SGN4 |
| 48 |
|
| 49 |
char dvi_oplen[256] = { |
| 50 |
one_twenty_eight(DPL_NONE), |
| 51 |
/* characters 0 through 127 */ |
| 52 |
SEQ_U, /* DVI_SET1 through DVI_SET4 */ |
| 53 |
DPL_NONE, /* DVI_SETRULE */ |
| 54 |
SEQ_U, /* DVI_PUT1 through DVI_PUT4 */ |
| 55 |
DPL_NONE, /* DVI_PUTRULE */ |
| 56 |
DPL_NONE, /* DVI_NOP */ |
| 57 |
DPL_NONE, /* DVI_BOP */ |
| 58 |
DPL_NONE, /* DVI_EOP */ |
| 59 |
DPL_NONE, /* DVI_PUSH */ |
| 60 |
DPL_NONE, /* DVI_POP */ |
| 61 |
SEQ_S, /* DVI_RIGHT1 through DVI_RIGHT4 */ |
| 62 |
DPL_NONE, /* DVI_W0 */ |
| 63 |
SEQ_S, /* DVI_W1 through DVI_W4 */ |
| 64 |
DPL_NONE, /* DVI_X0 */ |
| 65 |
SEQ_S, /* DVI_X1 through DVI_X4 */ |
| 66 |
SEQ_S, /* DVI_DOWN1 through DVI_DOWN4 */ |
| 67 |
DPL_NONE, /* DVI_Y0 */ |
| 68 |
SEQ_S, /* DVI_Y1 through DVI_Y4 */ |
| 69 |
DPL_NONE, /* DVI_Z0 */ |
| 70 |
SEQ_S, /* DVI_Z1 through DVI_Z4 */ |
| 71 |
sixty_four(DPL_NONE), /* DVI_FNTNUM0 through DVI_FNTNUM63 */ |
| 72 |
SEQ_U, /* DVI_FNT1 through DVI_FNT4 */ |
| 73 |
SEQ_U, /* DVI_XXX1 through DVI_XXX4 */ |
| 74 |
SEQ_U, /* DVI_FNTDEF1 through DVI_FNTDEF4 */ |
| 75 |
DPL_NONE, /* DVI_PRE */ |
| 76 |
DPL_NONE, /* DVI_POST */ |
| 77 |
DPL_NONE, /* DVI_POSTPOST */ |
| 78 |
#ifdef ASCIIPTEX |
| 79 |
five(DPL_NONE), /* 250 through 254 */ |
| 80 |
DPL_UNS1, /* DVI_DIR */ |
| 81 |
#else /* !ASCIIPTEX */ |
| 82 |
six(DPL_NONE) /* 250 through 255 */ |
| 83 |
#endif /* !ASCIIPTEX */ |
| 84 |
}; |
| 85 |
|
| 86 |
char dvi_dt[256] = { |
| 87 |
one_twenty_eight(DT_CHAR), |
| 88 |
/* characters 0 through 127 */ |
| 89 |
four(DT_SET), /* DVI_SET1 through DVI_SET4 */ |
| 90 |
DT_SETRULE, /* DVI_SETRULE */ |
| 91 |
four(DT_PUT), /* DVI_PUT1 through DVI_PUT4 */ |
| 92 |
DT_PUTRULE, /* DVI_PUTRULE */ |
| 93 |
DT_NOP, /* DVI_NOP */ |
| 94 |
DT_BOP, /* DVI_BOP */ |
| 95 |
DT_EOP, /* DVI_EOP */ |
| 96 |
DT_PUSH, /* DVI_PUSH */ |
| 97 |
DT_POP, /* DVI_POP */ |
| 98 |
four(DT_RIGHT), /* DVI_RIGHT1 through DVI_RIGHT4 */ |
| 99 |
DT_W0, /* DVI_W0 */ |
| 100 |
four(DT_W), /* DVI_W1 through DVI_W4 */ |
| 101 |
DT_X0, /* DVI_X0 */ |
| 102 |
four(DT_X), /* DVI_X1 through DVI_X4 */ |
| 103 |
four(DT_DOWN), /* DVI_DOWN1 through DVI_DOWN4 */ |
| 104 |
DT_Y0, /* DVI_Y0 */ |
| 105 |
four(DT_Y), /* DVI_Y1 through DVI_Y4 */ |
| 106 |
DT_Z0, /* DVI_Z0 */ |
| 107 |
four(DT_Z), /* DVI_Z1 through DVI_Z4 */ |
| 108 |
sixty_four(DT_FNTNUM), /* DVI_FNTNUM0 through DVI_FNTNUM63 */ |
| 109 |
four(DT_FNT), /* DVI_FNT1 through DVI_FNT4 */ |
| 110 |
four(DT_XXX), /* DVI_XXX1 through DVI_XXX4 */ |
| 111 |
four(DT_FNTDEF), /* DVI_FNTDEF1 through DVI_FNTDEF4 */ |
| 112 |
DT_PRE, /* DVI_PRE */ |
| 113 |
DT_POST, /* DVI_POST */ |
| 114 |
DT_POSTPOST, /* DVI_POSTPOST */ |
| 115 |
#ifdef ASCIIPTEX |
| 116 |
five(DT_UNDEF), /* 250 through 254 */ |
| 117 |
DT_DIR, /* DVI_DIR */ |
| 118 |
#else /* !ASCIIPTEX */ |
| 119 |
six(DT_UNDEF) /* 250 through 255 */ |
| 120 |
#endif /* !ASCIIPTEX */ |
| 121 |
}; |