Initial release of Maemo 5 port of gnuplot
[gnuplot] / term / epson.trm
1 /* Hello, Emacs, this is -*-C-*-
2  * $Id: epson.trm,v 1.22 2006/07/21 02:35:46 sfeam Exp $
3  *
4  */
5
6 /* GNUPLOT - epson.trm */
7
8 /*[
9  * Copyright 1990 - 1993, 1998, 2004
10  *
11  * Permission to use, copy, and distribute this software and its
12  * documentation for any purpose with or without fee is hereby granted,
13  * provided that the above copyright notice appear in all copies and
14  * that both that copyright notice and this permission notice appear
15  * in supporting documentation.
16  *
17  * Permission to modify the software is granted, but not the right to
18  * distribute the complete modified source code.  Modifications are to
19  * be distributed as patches to the released version.  Permission to
20  * distribute binaries produced by compiling modified sources is granted,
21  * provided you
22  *   1. distribute the corresponding source modifications from the
23  *    released version in the form of a patch file along with the binaries,
24  *   2. add special version identification to distinguish your version
25  *    in addition to the base release version number,
26  *   3. provide your name and address as the primary contact for the
27  *    support of your modified version, and
28  *   4. retain our contact information in regard to use of the base
29  *    software.
30  * Permission to distribute the released version of the source code along
31  * with corresponding source modifications in the form of a patch file is
32  * granted with same provisions 2 through 4 for binary distributions.
33  *
34  * This software is provided "as is" without express or implied warranty
35  * to the extent permitted by applicable law.
36 ]*/
37
38 /*
39  * This file is included by ../term.c.
40  *
41  * This terminal driver supports:
42  *  epson_lx800, nec_cp6, starc,
43  *  epson_60dpi, tandy_60dpi
44  *  epson_180dpi
45  *
46  * AUTHORS
47  *  Russell Lang
48  *  William Wilson
49  *
50  * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
51  *
52  */
53
54 /*
55  * adapted to the new terminal layout by Stefan Bodewig (1995)
56  */
57
58 #include "driver.h"
59
60 #ifdef TERM_REGISTER
61 #ifdef EPS180
62 register_term(epson_180dpi)
63 #endif /* EPS180 */
64 #ifdef EPS60
65 register_term(epson_60dpi)
66 #endif /* EPS60 */
67 #ifdef EPSONP
68 register_term(epson_lx800)
69 #endif /* EPSONP */
70 #ifdef NEC
71 register_term(nec_cp6)
72 #endif /* NEC */
73 #ifdef OKIDATA
74 register_term(okidata)
75 #endif /* OKIDATA */
76 #ifdef STARC
77 register_term(starc)
78 #endif /* STARC */
79 #ifdef TAMDY60
80 register_term(tandy_60dpi)
81 #endif /* TANDY60 */
82 #endif /* TERM_REGISTER */
83
84 #ifdef TERM_PROTO
85
86 #if defined(EPS180) || defined(EPS60) || defined(EPSONP) || defined(TANDY60) || defined(OKIDATA)
87 TERM_PUBLIC void EPSON_init __PROTO((void));
88 TERM_PUBLIC void EPSON_reset __PROTO((void));
89
90 #if defined(EPS60) || defined(EPSONP) || defined(TANDY60) || defined(OKIDATA)
91 #define EPSONVCHAR              FNT5X9_VCHAR
92 #define EPSONHCHAR              FNT5X9_HCHAR
93 #define EPSONVTIC               6
94 #define EPSONHTIC               6
95
96 #ifdef EPSONP
97 #define EPSONXMAX       512
98 #define EPSONYMAX       384
99 TERM_PUBLIC void EPSON_graphics __PROTO((void));
100 TERM_PUBLIC void EPSON_text __PROTO((void));
101 #endif /* EPSONP */
102 #endif /* four drivers */
103 #endif /* all five */
104
105 #ifdef EPS180
106 TERM_PUBLIC void EPS180_graphics __PROTO((void));
107 TERM_PUBLIC void EPS180_text __PROTO((void));
108 #define EPSON180VCHAR           FNT13X25_VCHAR
109 #define EPSON180HCHAR           FNT13X25_HCHAR
110 #define EPSON180VTIC            18
111 #define EPSON180HTIC            18
112 /* make the total dimensions 8 inches by 6 inches */
113 #define EPS180XMAX      1260
114 #define EPS180YMAX      1080
115 #endif /* EPS180 */
116
117 #if defined(EPS60) || defined(TANDY60) || defined(OKIDATA)
118 /* make the total dimensions 8 inches by 5 inches */
119 #define EPS60XMAX       480
120 #define EPS60YMAX       360
121 TERM_PUBLIC void EPS60_graphics __PROTO((void));
122 #ifdef TANDY60
123 TERM_PUBLIC void TANDY60_text __PROTO((void));
124 #endif /* TANDY60 */
125 #ifdef OKIDATA
126 TERM_PUBLIC void OKIDATA_text __PROTO((void));
127 #endif /* OKIDATA */
128 #ifdef EPS60
129 TERM_PUBLIC void EPS60_text __PROTO((void));
130 #endif /* EPS60 */
131 #endif /* all three */
132
133 #ifdef NEC
134 TERM_PUBLIC void NEC_options __PROTO((void));
135 TERM_PUBLIC void NEC_init __PROTO((void));
136 TERM_PUBLIC void NEC_graphics __PROTO((void));
137 TERM_PUBLIC void NEC_text __PROTO((void));
138 TERM_PUBLIC void NEC_linetype __PROTO((int linetype));
139 TERM_PUBLIC void NEC_reset __PROTO((void));
140 #define NECXMAX 400
141 #define NECYMAX 320
142 #define NECVCHAR                FNT5X9_VCHAR
143 #define NECHCHAR                FNT5X9_HCHAR
144 #define NECVTIC         6
145 #define NECHTIC         6
146 #endif /* NEC */
147
148 #ifdef STARC
149 TERM_PUBLIC void STARC_init __PROTO((void));
150 TERM_PUBLIC void STARC_graphics __PROTO((void));
151 TERM_PUBLIC void STARC_text __PROTO((void));
152 TERM_PUBLIC void STARC_linetype __PROTO((int linetype));
153 TERM_PUBLIC void STARC_reset __PROTO((void));
154 #define STARCXMAX       512
155 #define STARCYMAX       384
156 #define STARCVCHAR              FNT5X9_VCHAR
157 #define STARCHCHAR              FNT5X9_HCHAR
158 #define STARCVTIC               6
159 #define STARCHTIC               6
160 #endif /* STARC */
161
162 #endif /* TERM_PROTO */
163
164 #ifndef TERM_PROTO_ONLY
165 #ifdef TERM_BODY
166
167
168 #ifdef EPSONP
169
170 /* The following epson lx800 driver uses generic bit mapped graphics
171    routines to build up a bit map in memory. */
172 /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
173 /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
174 /* EPSON_init changes gpoutfile to binary mode on PC's */
175
176 static void epson_dump __PROTO((void));
177
178 #define EPSONXLAST (EPSONXMAX - 1)
179 #define EPSONYLAST (EPSONYMAX - 1)
180
181 TERM_PUBLIC void
182 EPSON_init()
183 {
184 }
185
186 TERM_PUBLIC void
187 EPSON_graphics()
188 {
189     b_charsize(FNT5X9);
190     b_makebitmap((unsigned int) (EPSONXMAX * xsize),
191                  (unsigned int) (EPSONYMAX * ysize), 1);
192 }
193
194
195 TERM_PUBLIC void
196 EPSON_text()
197 {
198     epson_dump();
199     b_freebitmap();
200 }
201
202
203 TERM_PUBLIC void
204 EPSON_reset()
205 {
206 #ifdef VMS
207     fflush_binary();
208 #endif
209 }
210
211
212 /* output file must be binary mode for epson_dump */
213 static void
214 epson_dump()
215 {
216     register unsigned int x;
217     int j;
218     for (j = (b_ysize / 8) - 1; j >= 0; j--) {
219         /* select plotter graphics mode (square pixels) */
220         fputs("\033J\030", gpoutfile);  /* line feed 8/72" = 8 dots */
221         fputs("\r\033*\005", gpoutfile);
222         (void) fputc((char) (b_xsize % 256), gpoutfile);
223         (void) fputc((char) (b_xsize / 256), gpoutfile);
224         for (x = 0; x < b_xsize; x++) {
225             (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
226         }
227     }
228 #ifdef PC
229     fputs("Print using: COPY /B\n", stderr);
230 #endif
231 }
232
233 #endif /* EPSONP */
234
235
236 /* The following NEC CP6 Pinwriter driver uses generic bit mapped graphics
237    routines to build up a bit map in memory. */
238 /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
239 /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
240 /* NEC_init changes gpoutfile to binary mode for PC's */
241
242 /* Add a Monochrome NEC printer (for faster speed and line types) jdc */
243
244 #ifdef NEC
245
246 static void nec_dump __PROTO((void));
247 static void nec_draft_dump __PROTO((void));
248
249 #define NECXLAST (NECXMAX - 1)
250 #define NECYLAST (NECYMAX - 1)
251
252
253 /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
254 static unsigned int neccolor[] = { 1, 8, 4, 2, 10, 12, 6, 14 };
255 static unsigned int necpcolor[] = { 0, 2, 1, 4 };
256
257 static int NECmode;
258
259 enum NEC_id { NEC_MONOCHROME, NEC_COLOR, NEC_DRAFT, NEC_OTHER };
260
261 static struct gen_table NEC_opts[] =
262 {
263     { "m$onochrome", NEC_MONOCHROME },
264     { "c$olor", NEC_COLOR },
265     { "c$olour", NEC_COLOR },
266     { "d$raft", NEC_DRAFT },
267     { NULL, NEC_OTHER }
268 };
269
270 TERM_PUBLIC void
271 NEC_options()
272 {
273     /* default */
274     if (END_OF_COMMAND) {
275         strcpy(term_options, "monochrome");
276         NECmode = 'm';
277     }
278
279     while (!END_OF_COMMAND) {
280         switch(lookup_table(&NEC_opts[0],c_token)) {
281         case NEC_MONOCHROME:
282             c_token++;
283             strcpy(term_options, "monochrome");
284             NECmode = 'm';
285             break;
286         case NEC_COLOR:
287             c_token++;
288             strcpy(term_options, "color");
289             NECmode = 'c';
290             break;
291         case NEC_DRAFT:
292             c_token++;
293             strcpy(term_options, "draft");
294             NECmode = 'd';
295             break;
296         case NEC_OTHER:
297         default:
298             /* FIXME - not the most sensible thing to do */
299             /* error, but since the terminal is already set, default to mono */
300             strcpy(term_options, "monochrome");
301             NECmode = 'm';
302             int_error(c_token, "modes: color, monochrome, draft");
303             break;
304         }
305     }
306
307 }
308
309 TERM_PUBLIC void
310 NEC_init()
311 {
312 }
313
314 TERM_PUBLIC void
315 NEC_graphics()
316 {
317     b_charsize(FNT5X9);
318     b_makebitmap((unsigned int) (NECXMAX * xsize),
319                  (unsigned int) (NECYMAX * ysize), (NECmode == 'c' ? 4 : 1));
320 }
321
322 TERM_PUBLIC void
323 NEC_text()
324 {
325     if (NECmode == 'd') {
326         nec_draft_dump();
327     } else {
328         nec_dump();
329     }
330     b_freebitmap();
331 }
332
333 TERM_PUBLIC void
334 NEC_linetype(int linetype)
335 {
336     if (NECmode == 'c') {
337         if (linetype >= 6)
338             linetype %= 6;
339         b_setvalue(neccolor[linetype + 2]);
340     } else {
341         b_setlinetype(linetype);
342     }
343 }
344
345
346
347 TERM_PUBLIC void
348 NEC_reset()
349 {
350 #ifdef VMS
351     fflush_binary();
352 #endif
353 }
354
355
356 /* output file must be binary mode for nec_dump */
357 static void
358 nec_dump()
359 {
360     unsigned int x;
361     unsigned int plane, offset;
362     int j;
363     unsigned int column8;
364     unsigned long column24;
365     char column3, column2, column1;
366     fputs("\033P\033l\005", gpoutfile); /* 10cpi, left margin 5 char */
367     for (j = (b_ysize / 8) - 1; j >= 0; j--) {
368         fputs("\033J\030", gpoutfile);  /* 24/180" line feed */
369         for (plane = 0; plane < b_planes; plane++) {
370             offset = plane * b_psize;
371             if (b_planes > 1) {
372                 /* select colour for plane */
373                 fputs("\033r", gpoutfile);
374                 (void) fputc((char) necpcolor[plane], gpoutfile);
375             }
376             /* select plotter graphics mode (square pixels) */
377             fputs("\r\033*\047", gpoutfile);
378             (void) fputc((char) ((b_xsize * 3) % 256), gpoutfile);
379             (void) fputc((char) ((b_xsize * 3) / 256), gpoutfile);
380             for (x = 0; x < b_xsize; x++) {
381                 column8 = (unsigned int) (*((*b_p)[j + offset] + x));
382                 column24 = 0;
383                 if (column8 & 0x01)
384                     column24 |= (long) 0x000007;
385                 if (column8 & 0x02)
386                     column24 |= (long) 0x000038;
387                 if (column8 & 0x04)
388                     column24 |= (long) 0x0001c0;
389                 if (column8 & 0x08)
390                     column24 |= (long) 0x000e00;
391                 if (column8 & 0x10)
392                     column24 |= (long) 0x007000;
393                 if (column8 & 0x20)
394                     column24 |= (long) 0x038000;
395                 if (column8 & 0x40)
396                     column24 |= (long) 0x1c0000;
397                 if (column8 & 0x80)
398                     column24 |= (long) 0xe00000;
399                 column1 = (char) (column24 & (long) 0xff);
400                 column2 = (char) ((column24 >> 8) & (long) 0xff);
401                 column3 = (char) ((column24 >> 16) & (long) 0xff);
402                 (void) fputc(column3, gpoutfile);
403                 (void) fputc(column2, gpoutfile);
404                 (void) fputc(column1, gpoutfile);
405                 (void) fputc(column3, gpoutfile);
406                 (void) fputc(column2, gpoutfile);
407                 (void) fputc(column1, gpoutfile);
408                 (void) fputc(column3, gpoutfile);
409                 (void) fputc(column2, gpoutfile);
410                 (void) fputc(column1, gpoutfile);
411             }
412         }
413     }
414     fputs("\r\033l", gpoutfile);
415     (void) fputc('\0', gpoutfile);      /* set left margin to 0 */
416     if (b_planes > 1) {
417         fprintf(gpoutfile, "\033r");
418         (void) fputc('\0', gpoutfile);  /* set color to black */
419     }
420 #ifdef PC
421     fputs("Print using: COPY /B\n", stderr);
422 #endif
423 #ifdef VMS
424     fflush_binary();
425 #endif
426 }
427
428 /* output file must be binary mode for nec_dump */
429 static void
430 nec_draft_dump()
431 {
432     unsigned int x;
433     unsigned int plane, offset;
434     int j;
435     fputs("\033P\033l\005\r", gpoutfile);       /* 10cpi, left margin 5 char */
436     for (j = (b_ysize / 8) - 1; j >= 0; j--) {
437         fputs("\033J\030", gpoutfile);  /* 24/180" line feed */
438         for (plane = 0; plane < b_planes; plane++) {
439             offset = plane * b_psize;
440             if (b_planes > 1) {
441                 /* select colour for plane */
442                 fputs("\033r", gpoutfile);
443                 (void) fputc((char) necpcolor[plane], gpoutfile);
444             }
445             /* select plotter graphics mode (square pixels) */
446             fputs("\r\033*", gpoutfile);
447             (void) fputc('\0', gpoutfile);
448             (void) fputc((char) (b_xsize % 256), gpoutfile);
449             (void) fputc((char) (b_xsize / 256), gpoutfile);
450             for (x = 0; x < b_xsize; x++) {
451                 (void) fputc((char) (*((*b_p)[j + offset] + x)), gpoutfile);
452             }
453         }
454     }
455     fputs("\r\033l", gpoutfile);
456     (void) fputc('\0', gpoutfile);      /* set left margin to 0 */
457     if (b_planes > 1) {
458         fputs("\033r", gpoutfile);
459         (void) fputc('\0', gpoutfile);  /* set color to black */
460     }
461 #ifdef PC
462     fputs("Print using: COPY /B\n", gpoutfile);
463 #endif
464 }
465
466 #endif /* NEC */
467
468 #ifdef STARC
469 /* The following Star color driver uses generic bit mapped graphics
470    routines to build up a bit map in memory. */
471 /* Star Color changes made by William Wilson, wew@naucse.cse.nau.edu */
472 /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
473 /* STARC_init changes gpoutfile to binary mode on PC's */
474
475 static void STARC_dump __PROTO((void));
476
477 #define STARCXLAST (STARCXMAX - 1)
478 #define STARCYLAST (STARCYMAX - 1)
479
480
481 /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
482 static unsigned int STARCcolor[] = { 1, 8, 4, 2, 10, 12, 6, 14 };
483 static unsigned int STARCpcolor[] = { 0, 2, 1, 4 };
484
485 TERM_PUBLIC void
486 STARC_init()
487 {
488 }
489
490 TERM_PUBLIC void
491 STARC_graphics()
492 {
493     b_charsize(FNT5X9);
494     b_makebitmap((unsigned int) (STARCXMAX * xsize),
495                  (unsigned int) (STARCYMAX * ysize), 4);
496 }
497
498
499 TERM_PUBLIC void
500 STARC_text()
501 {
502     STARC_dump();
503     b_freebitmap();
504 }
505
506 TERM_PUBLIC void
507 STARC_linetype(int linetype)
508 {
509     if (linetype >= 6)
510         linetype %= 6;
511     b_setvalue(STARCcolor[linetype + 2]);
512 }
513
514
515
516 TERM_PUBLIC void
517 STARC_reset()
518 {
519 #ifdef VMS
520     fflush_binary();
521 #endif
522 }
523
524
525 /* output file must be binary mode for STARC_dump */
526 static void
527 STARC_dump()
528 {
529     unsigned int x;
530     unsigned int plane, offset;
531     int j;
532     for (j = (b_ysize / 8) - 1; j >= 0; j--) {
533         fputs("\033J\030", gpoutfile);  /* line feed 8/72" = 8 dots */
534         for (plane = 0; plane < b_planes; plane++) {
535             offset = plane * b_psize;
536             if (b_planes > 1) {
537                 /* select colour for plane */
538                 fputs("\033r", gpoutfile);
539                 (void) fputc((char) STARCpcolor[plane], gpoutfile);
540             }
541             /* select plotter graphics mode (square pixels) */
542             fputs("\r\033*\005", gpoutfile);
543             (void) fputc((char) (b_xsize % 256), gpoutfile);
544             (void) fputc((char) (b_xsize / 256), gpoutfile);
545             for (x = 0; x < b_xsize; x++) {
546                 (void) fputc((char) (*((*b_p)[j + offset] + x)), gpoutfile);
547             }
548         }
549     }
550     if (b_planes > 1) {
551         fputs("\033r", gpoutfile);
552         (void) fputc('\0', gpoutfile);  /* set color to black */
553     }
554 #ifdef PC
555     fputs("Print using: COPY /B\n", stderr);
556 #endif
557 }
558
559 #endif /* STARC */
560
561
562 #ifdef EPS180
563
564 static void eps180_dump __PROTO((void));
565
566 #define EPS180XLAST (EPS180XMAX - 1)
567 #define EPS180YLAST (EPS180YMAX - 1)
568
569 TERM_PUBLIC void
570 EPS180_graphics()
571 {
572     b_charsize(FNT13X25);
573     b_makebitmap((unsigned int) (EPS180XMAX * xsize),
574                  (unsigned int) (EPS180YMAX * ysize), 1);
575 }
576
577
578 TERM_PUBLIC void
579 EPS180_text()
580 {
581     eps180_dump();
582     b_freebitmap();
583 }
584
585
586
587 /* output file must be binary mode for eps180_dump */
588 static void
589 eps180_dump()
590 {
591     register unsigned int x;
592     int j;
593
594     /* reset, set line spacing to 24/180", and move left margin */
595     fputs("\033@\033+\060\033l\005", gpoutfile);
596     for (j = (b_ysize / 8) - 1; j >= 0;) {
597         /* select printer graphics mode '39' */
598         fputs("\r\n\033*'", gpoutfile);
599         (void) fputc((char) (b_xsize % 256), gpoutfile);
600         (void) fputc((char) (b_xsize / 256), gpoutfile);
601         for (x = 0; x < b_xsize; x++) {
602             (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
603             (void) fputc((char) (*((*b_p)[j - 1] + x)), gpoutfile);
604             (void) fputc((char) (*((*b_p)[j - 2] + x)), gpoutfile);
605         }
606         j -= 3;
607     }
608     fputs("\r\n\033@\r\n", gpoutfile);  /* reset printer */
609 #ifdef PC
610     fputs("Print using: COPY /B\n", stderr);
611 #endif
612 }
613
614 #endif /* EPS180 */
615
616 #ifdef EPS60
617
618 static void eps60_dump __PROTO((void));
619
620 #define EPS60XLAST (EPS60XMAX - 1)
621 #define EPS60YLAST (EPS60YMAX - 1)
622
623 TERM_PUBLIC void
624 EPS60_graphics()
625 {
626     b_charsize(FNT5X9);
627     b_makebitmap((unsigned int) (EPS60XMAX * xsize),
628                  (unsigned int) (EPS60YMAX * ysize), 1);
629 }
630
631
632 TERM_PUBLIC void
633 EPS60_text()
634 {
635     eps60_dump();
636     b_freebitmap();
637 }
638
639
640
641 /* output file must be binary mode for eps60_dump */
642 static void
643 eps60_dump()
644 {
645     register unsigned int x;
646     int j;
647     fprintf(gpoutfile, "\033%c\030", '3');      /* set line spacing 24/216" = 8 dots */
648     for (j = (b_ysize / 8) - 1; j >= 0; j--) {
649         /* select printer graphics mode 'K' */
650         fputs("\r\n\033K", gpoutfile);
651         (void) fputc((char) (b_xsize % 256), gpoutfile);
652         (void) fputc((char) (b_xsize / 256), gpoutfile);
653         for (x = 0; x < b_xsize; x++) {
654             (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
655         }
656     }
657     fprintf(gpoutfile, "\033%c\044\r\n", '3');  /* set line spacing 36/216" = 1/6" */
658 #ifdef PC
659     fputs("Print using: COPY /B\n", stderr);
660 #endif
661 }
662
663 #endif /* EPS60 */
664
665 #ifdef TANDY60
666
667 /* The only difference between TANDY60 and EPS60 is the inclusion
668    of codes to swap the Tandy printer into IBM mode and back
669    into Tandy mode.  For a Tandy already in IBM mode, use EPS60. */
670
671
672 TERM_PUBLIC void
673 TANDY60_text()
674 {
675 #ifdef PC
676     fputs("Inserting Tandy/IBM mode conversion codes\n", stderr);
677 #endif
678     /* Switch to IBM mode, and leave 3 inches above the plot so as
679        to get rough vertical centring on the page.  Perform the
680        centring by setting 1" line feeds and issuing 3 of them. */
681     fprintf(gpoutfile, "\033!\033%c%c\n\n\n", '3', 216);
682     eps60_dump();
683     b_freebitmap();
684     /* A form feed must be sent before switching back to Tandy mode,
685        or else the form setting will be messed up. */
686     fputs("\f\033!", gpoutfile);
687 }
688
689
690 #endif /* TANDY60 */
691
692 #ifdef OKIDATA
693
694 static void okidata_dump __PROTO((void));
695
696 TERM_PUBLIC void
697 OKIDATA_text()
698 {
699     okidata_dump();
700     b_freebitmap();
701 }
702
703 static int OKIDATAbitrev_tbl[] =
704 {
705     0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
706     0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
707     0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
708     0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
709     0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
710     0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
711     0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
712     0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
713     0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
714     0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
715     0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
716     0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
717     0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
718     0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
719     0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
720     0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
721     0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
722     0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
723     0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
724     0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
725     0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
726     0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
727     0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
728     0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
729     0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
730     0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
731     0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
732     0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
733     0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
734     0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
735     0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
736     0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
737 };
738
739 /* output file must be binary mode for okidata_dump */
740 static void
741 okidata_dump()
742 {
743     register unsigned int x;
744     int j;
745     char cur_char;
746     int prev_char;
747
748     prev_char = 0;
749     /* set line spacing 16/144" = 8 dots, turn on single density
750      * graphics mode: */
751     fprintf(gpoutfile, "\033%c%c\020\033*eP:\003", '%', '9');
752     for (j = (b_ysize / 8) - 1; j >= 0; j--) {
753         fputs("\003\016", gpoutfile);
754 /*              (void) fputc((char)(b_xsize%256),gpoutfile); */
755 /*              (void) fputc((char)(b_xsize/256),gpoutfile); */
756         for (x = 0; x < b_xsize; x++) {
757             if ((cur_char = (char)
758                  (OKIDATAbitrev_tbl[(int) (*((*b_p)[j] + x))])) == '\003') {
759                 fputs("\003\003", gpoutfile);
760             } else {
761                 (void) fputc((char) cur_char, gpoutfile);
762             }
763         }
764     }
765     fprintf(gpoutfile, "\003\002\033%c%c\030\r\n", '%', '9');   /* Turned off graphics mode: set line spacing 24/144" = 1/6" */
766 #ifdef PC
767     fputs("Print using: COPY /B\n", stderr);
768 #endif
769 }
770
771 #endif /* OKIDATA */
772
773 #endif /* TERM_BODY */
774
775 #ifdef TERM_TABLE
776
777 #ifdef EPS180
778 TERM_TABLE_START(epson180_driver)
779     "epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
780     EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
781     EPSON180VTIC, EPSON180HTIC, options_null, EPSON_init, EPSON_reset,
782     EPS180_text, null_scale, EPS180_graphics, b_move, b_vector,
783     b_setlinetype, b_put_text, b_text_angle,
784     null_justify_text, do_point, do_arrow, set_font_null, 0, TERM_BINARY,
785     0, 0, b_boxfill
786 TERM_TABLE_END(epson180_driver)
787
788 #undef LAST_TERM
789 #define LAST_TERM epson180_driver
790 #endif /* EPS180 */
791
792 #ifdef EPS60
793 TERM_TABLE_START(epson60_driver)
794     "epson_60dpi", "Epson-style 60-dot per inch printers",
795     EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
796     EPSONVTIC, EPSONHTIC, options_null, EPSON_init, EPSON_reset,
797     EPS60_text, null_scale, EPS60_graphics, b_move, b_vector,
798     b_setlinetype, b_put_text, b_text_angle,
799     null_justify_text, do_point, do_arrow, set_font_null, 0, TERM_BINARY,
800     0, 0, b_boxfill
801 TERM_TABLE_END(epson60_driver)
802
803 #undef LAST_TERM
804 #define LAST_TERM epson60_driver
805 #endif /* EPS60 */
806
807 #ifdef EPSONP
808 TERM_TABLE_START(epsonlx_driver)
809     "epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
810     EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR,
811     EPSONVTIC, EPSONHTIC, options_null, EPSON_init, EPSON_reset,
812     EPSON_text, null_scale, EPSON_graphics, b_move, b_vector,
813     b_setlinetype, b_put_text, b_text_angle,
814     null_justify_text, line_and_point, do_arrow, set_font_null, 0, TERM_BINARY,
815     0, 0, b_boxfill
816 TERM_TABLE_END(epsonlx_driver)
817
818 #undef LAST_TERM
819 #define LAST_TERM epsonlx_driver
820 #endif /* EPSONP */
821
822 #ifdef NEC
823     TERM_TABLE_START(nec_driver)
824     "nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
825     NECXMAX, NECYMAX, NECVCHAR, NECHCHAR,
826     NECVTIC, NECHTIC, NEC_options, NEC_init, NEC_reset,
827     NEC_text, null_scale, NEC_graphics, b_move, b_vector,
828     NEC_linetype, b_put_text, b_text_angle,
829     null_justify_text, line_and_point, do_arrow, set_font_null, 0, TERM_BINARY,
830     0, 0, b_boxfill
831 TERM_TABLE_END(nec_driver)
832
833 #undef LAST_TERM
834 #define LAST_TERM nec_driver
835 #endif /* NEC */
836
837 #ifdef OKIDATA
838 TERM_TABLE_START(okidata_driver)
839     "okidata", "OKIDATA 320/321 Standard",
840     EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
841     EPSONVTIC, EPSONHTIC, options_null, EPSON_init, EPSON_reset,
842     OKIDATA_text, null_scale, EPS60_graphics, b_move, b_vector,
843     b_setlinetype, b_put_text, b_text_angle,
844     null_justify_text, do_point, do_arrow, set_font_null, 0, TERM_BINARY,
845     0, 0, b_boxfill
846 TERM_TABLE_END(okidata_driver)
847
848 #undef LAST_TERM
849 #define LAST_TERM okidata_driver
850 #endif /* OKIDATA */
851
852 #ifdef STARC
853 TERM_TABLE_START(starc_driver)
854     "starc", "Star Color Printer",
855     STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR,
856     STARCVTIC, STARCHTIC, options_null, STARC_init, STARC_reset,
857     STARC_text, null_scale, STARC_graphics, b_move, b_vector,
858     STARC_linetype, b_put_text, b_text_angle,
859     null_justify_text, line_and_point, do_arrow, set_font_null, 0, TERM_BINARY,
860     0, 0, b_boxfill
861 TERM_TABLE_END(starc_driver)
862
863 #undef LAST_TERM
864 #define LAST_TERM starc_driver
865 #endif /* STARC */
866
867 #ifdef TANDY60
868 TERM_TABLE_START(tandy60_driver)
869     "tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
870     EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
871     EPSONVTIC, EPSONHTIC, options_null, EPSON_init, EPSON_reset,
872     TANDY60_text, null_scale, EPS60_graphics, b_move, b_vector,
873     b_setlinetype, b_put_text, b_text_angle,
874     null_justify_text, do_point, do_arrow, set_font_null, 0, TERM_BINARY,
875     0, 0, b_boxfill
876 TERM_TABLE_END(tandy60_driver)
877
878 #undef LAST_TERM
879 #define LAST_TERM tandy60_driver
880 #endif /* TANDY60 */
881
882 #endif /* TERM_TABLE */
883 #endif /* TERM_PROTO_ONLY */
884
885 #ifdef TERM_HELP
886 START_HELP(epson_180dpi)
887 "1 epson-180dpi",
888 "?commands set terminal epson-180dpi",
889 "?set terminal epson-180dpi",
890 "?set term epson-180dpi",
891 "?terminal epson-180dpi",
892 "?term epson-180dpi",
893 "?epson-180dpi",
894 "?commands set terminal epson-60dpi",
895 "?set terminal epson-60dpi",
896 "?set term epson-60dpi",
897 "?terminal epson-60dpi",
898 "?term epson-60dpi",
899 "?epson-60dpi",
900 "?commands set terminal epson-lx800",
901 "?set terminal epson-lx800",
902 "?set term epson-lx800",
903 "?terminal epson-lx800",
904 "?term epson-lx800",
905 "?epson-lx800",
906 "?commands set terminal nec-cp6",
907 "?set terminal nec-cp6",
908 "?set term nec-cp6",
909 "?terminal nec-cp6",
910 "?term nec-cp6",
911 "?nec-cp6",
912 "?commands set terminal okidata",
913 "?set terminal okidata",
914 "?set term okidata",
915 "?terminal okidata",
916 "?term okidata",
917 "?okidata",
918 "?commands set terminal starc",
919 "?set terminal starc",
920 "?set term starc",
921 "?terminal starc",
922 "?term starc",
923 "?starc",
924 "?commands set terminal tandy-60dpi",
925 "?set terminal tandy-60dpi",
926 "?set term tandy-60dpi",
927 "?terminal tandy-60dpi",
928 "?term tandy-60dpi",
929 "?tandy-60dpi",
930 " This driver supports a family of Epson printers and derivatives.",
931 "",
932 " `epson-180dpi` and `epson-60dpi` are drivers for Epson LQ-style 24-pin",
933 " printers with resolutions of 180 and 60 dots per inch, respectively.",
934 "",
935 " `epson-lx800` is a generic 9-pin driver appropriate for printers like the",
936 " Epson LX-800, the Star NL-10 and NX-1000, the PROPRINTER, and so forth.",
937 "",
938 " `nec-cp6` is generic 24-pin driver that can be used for printers like the",
939 " NEC CP6 and the Epson LQ-800.",
940 "",
941 " The `okidata` driver supports the 9-pin OKIDATA 320/321 Standard printers.",
942 "",
943 " The `starc` driver is for the Star Color Printer.",
944 "",
945 " The `tandy-60dpi` driver is for the Tandy DMP-130 series of 9-pin, 60-dpi",
946 " printers.",
947 "",
948 " Only `nec-cp6` has any options.",
949 "",
950 " Syntax:",
951 "       set terminal nec-cp6 {monochrome | colour | draft}",
952 "",
953 " which defaults to monochrome.",
954 "",
955 " With each of these drivers, a binary copy is required on a PC to print.  Do",
956 " not use `print`---use instead `copy file /b lpt1:`."
957 END_HELP(epson_180dpi)
958 #endif /* TERM_HELP */