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