Debian Codegraph @

texk/dvipsk/vmcms/dvipscms.h

raw
1 /*
2 * These are changes needed for the VM/CMS version of dvips as of
3 * May 21, 1991. Revised 12/1/92.
4 * This was written by J. Hafner, E. Blanz and M. Flickner of IBM Research,
5 * Almaden Research Center. Contact [email protected].
6 * The changes to the rest of the code can be found by searching for
7 * "VMCMS".
8 *
9 * This code can be included in dvips, subject to the same restrictions as
10 * in the copyright notice.
11 */
12 extern char *malloc();
13 /*
14 * Added ascii to ebcdic conversion table for VMCMS.
15 * Only for the printable characters. This is used by DVIPS.
16 */
17 char ascii2ebcdic[256] = {
18 0, 1, 2, 3, 53, 45, 46, 47,
19 22, 5, 37, 11, 12, 64, 14, 15,
20 16, 17, 18, 19, 60, 61, 50, 38,
21 24, 25, 63, 39,111,111,111,111,
22 64, 90,127,123, 91,108, 80,125,
23 77, 93, 92, 78,107, 96, 75, 97,
24 240,241,242,243,244,245,246,247,
25 248,249,122, 94, 76,126,110,111,
26 124,193,194,195,196,197,198,199,
27 200,201,209,210,211,212,213,214,
28 215,216,217,226,227,228,229,230,
29 231,232,233,173,224,189, 95,109,
30 121,129,130,131,132,133,134,135,
31 136,137,145,146,147,148,149,150,
32 151,152,153,162,163,164,165,166,
33 167,168,169,192, 79,208,161, 7,
34 128,129,130,131,132,133,134,135,
35 136,137,138,139,140,141,142,143,
36 144,145,146,147,148,149,150,151,
37 152,153,154,155,156,157,158,159,
38 160,161,162,163,164,165,166,167,
39 168,169,170,171,172,173,174,175,
40 176,177,178,179,180,181,182,183,
41 184,185,186,187,188,189,190,191,
42 192,193,194,195,196,197,198,199,
43 200,201,202,203,204,205,206,207,
44 208,209,210,211,212,213,214,215,
45 216,217,218,219,220,221,222,223,
46 224,225,226,227,228,229,230,231,
47 232,233,234,235,236,237,238,239,
48 240,241,242,243,244,245,246,247,
49 248,249,250,251,252,253,254,255
50 };
51 /*
52 * Added ebcdic to ascii conversion table for VMCMS.
53 * Only for the printable characters. This inverts the
54 * table above and is used by AFM2TFM.
55 */
56 char ebcdic2ascii[256] = {
57 0, 1, 2, 3, 4, 9, 6,127,
58 8, 9, 10, 11, 12, 13, 14, 15,
59 16, 17, 18, 19, 20, 21, 8, 23,
60 24, 25, 26, 27, 28, 29, 30, 31,
61 32, 33, 34, 35, 36, 10, 23, 27,
62 40, 41, 42, 43, 44, 5, 6, 7,
63 48, 49, 22, 51, 52, 4, 54, 55,
64 56, 57, 58, 59, 20, 21, 62, 26,
65 32, 65, 66, 67, 68, 69, 70, 71,
66 72, 73, 74, 46, 60, 40, 43,124,
67 38, 81, 82, 83, 84, 85, 86, 87,
68 88, 89, 33, 36, 42, 41, 59, 94,
69 45, 47, 98, 99,100,101,102,103,
70 104,105,124, 44, 37, 95, 62, 63,
71 112,113,114,115,116,117,118,119,
72 120, 96, 58, 35, 64, 39, 61, 34,
73 128, 97, 98, 99,100,101,102,103,
74 104,105,138,123,140,141,142,143,
75 144,106,107,108,109,110,111,112,
76 113,114,154,125,156,157,158,159,
77 160,161,115,116,117,118,119,120,
78 121,122,170,171,172, 91,174,175,
79 176,177,178,179,180,181,182,183,
80 184,185,186,187,188, 93,190,191,
81 192, 65, 66, 67, 68, 69, 70, 71,
82 72, 73,202,203,204,205,206,207,
83 208, 74, 75, 76, 77, 78, 79, 80,
84 81, 82,218,219,220,221,222,223,
85 92,225, 83, 84, 85, 86, 87, 88,
86 89, 90,234,235,236,237,238,239,
87 48, 49, 50, 51, 52, 53, 54, 55,
88 56, 57,250,251,252,253,254,255
89 };
90 /*
91 * This redefines fopen for VMCMS, truncating long filenames for
92 * portability of TeX source.
93 */
94 #ifdef fopen
95 #undef fopen
96 #endif
97 FILE *cmsfopen(filename, mode)
98 char *filename, *mode ;
99 {
100 char cmsfile[21] ;
101 char *save_file;
102 char *ptr;
103 void exit() ;
104
105 if (!(save_file =
106 (char *)malloc(strlen(filename) + 1, sizeof(char)))) {
107 fprintf (stderr, "sorry---out of memory\n");
108 exit(10);
109 }
110
111 strcpy(save_file, filename);
112
113 cmsfile[0] = '\0' ;
114
115 ptr = strtok(save_file, ". ") ;
116 strncat(cmsfile, ptr, 8) ;
117
118 strcat(cmsfile, ".");
119
120 if (!(ptr = strtok(NULL, ". "))) {
121 /* Remove this, not much help anyway since most filenames are built
122 internally. */
123 /*
124 fprintf(stderr, "\n<%s> is not a legitimate VM/CMS file name\n",
125 filename);
126 fprintf(stderr, "...we'll try to continue...\n");
127 */
128 return(NULL);
129 }
130
131 strncat(cmsfile, ptr, 8);
132
133 if (ptr = strtok(NULL, ". ")) {
134 strcat(cmsfile, ".");
135 strncat(cmsfile, ptr, 2);
136 }
137
138 free(save_file);
139
140 return(fopen(cmsfile, mode));
141
142 }
143
144
145 /*
146 * access.c for VMCMS
147 */
148 int access (path, amode)
149 char *path;
150 int amode;
151 {
152 return(1);
153 }