Annotation of OpenXM_contrib/gnuplot/term/qms.trm, Revision 1.1
1.1 ! maekawa 1: /*
! 2: * $Id: qms.trm,v 1.14 1998/04/14 00:18:05 drd Exp $
! 3: *
! 4: */
! 5:
! 6: /* GNUPLOT - qms.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: * QMS laser printers
! 43: *
! 44: * AUTHORS
! 45: * Colin Kelley, Thomas Williams, Russell Lang
! 46: *
! 47: * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
! 48: *
! 49: */
! 50:
! 51: /*
! 52: * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
! 53: */
! 54:
! 55: #include "driver.h"
! 56:
! 57: #ifdef TERM_REGISTER
! 58: register_term(qms)
! 59: #endif
! 60:
! 61: #ifdef TERM_PROTO
! 62: TERM_PUBLIC void QMS_init __PROTO((void));
! 63: TERM_PUBLIC void QMS_graphics __PROTO((void));
! 64: TERM_PUBLIC void QMS_text __PROTO((void));
! 65: TERM_PUBLIC void QMS_linetype __PROTO((int linetype));
! 66: TERM_PUBLIC void QMS_move __PROTO((unsigned int x, unsigned int y));
! 67: TERM_PUBLIC void QMS_vector __PROTO((unsigned int x2, unsigned int y2));
! 68: TERM_PUBLIC void QMS_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
! 69: TERM_PUBLIC void QMS_reset __PROTO((void));
! 70:
! 71: #define QMS_XMAX 9000
! 72: #define QMS_YMAX 6000
! 73:
! 74: #define QMS_XLAST (QMS_XMAX - 1)
! 75: #define QMS_YLAST (QMS_YMAX - 1)
! 76:
! 77: #define QMS_VCHAR 120
! 78: #define QMS_HCHAR 70
! 79: #define QMS_VTIC 70
! 80: #define QMS_HTIC 70
! 81: #endif /* TERM_PROTO */
! 82:
! 83: #ifndef TERM_PROTO_ONLY
! 84: #ifdef TERM_BODY
! 85: static int qms_line = 0; /* to remember current line type */
! 86:
! 87: TERM_PUBLIC void QMS_init()
! 88: {
! 89: /* This was just ^IOL, but at Rutgers at least we need some more stuff */
! 90: fputs("^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n", gpoutfile);
! 91: /* ^ QUIC on ^set defaults ^ set botttom,top,left margins
! 92: * ^landscape ^free format
! 93: */
! 94:
! 95: /* set defaults are: implicit decimal point, units in inches,
! 96: * numbers left justified, units in 1/1000 inch, do not ignore spaces
! 97: * margins are in 1/1000 inch units
! 98: */
! 99: }
! 100:
! 101:
! 102: TERM_PUBLIC void QMS_graphics()
! 103: {
! 104: fputs("^IGV\n", gpoutfile);
! 105: /* ^enter graphics vector mode */
! 106: }
! 107:
! 108:
! 109:
! 110: TERM_PUBLIC void QMS_text()
! 111: {
! 112: /* added ^-, because ^, after an ^I command doesn't actually print a page */
! 113: /* Did anybody try this code out? [uhh...-cdk] */
! 114: fputs("^IGE\n^-^,", gpoutfile);
! 115: /* ^exit graphics vector mode
! 116: * ^pass terminator
! 117: * ^print page
! 118: */
! 119: }
! 120:
! 121:
! 122: TERM_PUBLIC void QMS_linetype(linetype)
! 123: int linetype;
! 124: {
! 125: static int width[2 + 9] = { 7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7 };
! 126: static int type[2 + 9] = { 0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3 };
! 127: /*
! 128: * I don't know about Villanova, but on our printer, using ^V without
! 129: * previously setting up a pattern crashes the microcode.
! 130: * [nope, doesn't crash here. -cdk]
! 131: * [it generates a controller error here on dotted lines. - rjl]
! 132: */
! 133: /* Code to define patterns added by rjl
! 134: * According to the manual it should work - but it doesn't
! 135: */
! 136: qms_line = linetype;
! 137: if (linetype >= 9)
! 138: linetype %= 9;
! 139:
! 140: fprintf(gpoutfile, "^PW%02d\n", width[linetype + 2]);
! 141: /* ^width in dots */
! 142:
! 143: switch (type[linetype + 2]) {
! 144: case 1: /* short dash */
! 145: fputs("^PV102025^G\n^V1\n", gpoutfile);
! 146: /* ^PV = define pattern vector, 1 = pattern number,
! 147: * 02 = number of pen downs and ups, 025 = .025" length of ups/downs
! 148: */
! 149: break;
! 150: case 2: /* medium dash */
! 151: fputs("^PV202050^G\n^V2\n", gpoutfile);
! 152: break;
! 153: case 3: /* long dash */
! 154: fputs("^PV302100^G\n^V3\n", gpoutfile);
! 155: break;
! 156: default:
! 157: case 0:
! 158: fputs("^V0\n", gpoutfile);
! 159: break;
! 160: }
! 161: }
! 162:
! 163:
! 164: TERM_PUBLIC void QMS_move(x, y)
! 165: unsigned int x, y;
! 166: {
! 167: fprintf(gpoutfile, "^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
! 168: /* ^pen up vector*/
! 169: }
! 170:
! 171:
! 172: TERM_PUBLIC void QMS_vector(x2, y2)
! 173: unsigned int x2, y2;
! 174: {
! 175: fprintf(gpoutfile, "^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
! 176: /* ^pen down vector*/
! 177: }
! 178:
! 179:
! 180: TERM_PUBLIC void QMS_put_text(x, y, str)
! 181: unsigned int x, y;
! 182: char str[];
! 183: {
! 184: char ch;
! 185: QMS_move(x, y + QMS_VCHAR / 3);
! 186: fputs("^IGE\n", gpoutfile);
! 187: ch = *str++;
! 188: while (ch != NUL) {
! 189: if (ch == '^')
! 190: putc('^', gpoutfile);
! 191: putc(ch, gpoutfile);
! 192: ch = *str++;
! 193: }
! 194: fputs("\n^IGV\n", gpoutfile);
! 195: QMS_linetype(qms_line); /* restore line type */
! 196: }
! 197:
! 198:
! 199: TERM_PUBLIC void QMS_reset()
! 200: {
! 201: fputs("^PN^-\n", gpoutfile);
! 202: /* ^QUIC off */
! 203: }
! 204:
! 205: #endif /* TERM_BODY */
! 206:
! 207: #ifdef TERM_TABLE
! 208: TERM_TABLE_START(qms_driver)
! 209: "qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
! 210: QMS_XMAX, QMS_YMAX, QMS_VCHAR, QMS_HCHAR,
! 211: QMS_VTIC, QMS_HTIC, options_null, QMS_init, QMS_reset,
! 212: QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
! 213: QMS_linetype, QMS_put_text, null_text_angle,
! 214: null_justify_text, line_and_point, do_arrow, set_font_null
! 215: TERM_TABLE_END(qms_driver)
! 216:
! 217: #undef LAST_TERM
! 218: #define LAST_TERM qms_driver
! 219:
! 220: #endif /* TERM_TABLE */
! 221: #endif /* TERM_PROTO_ONLY */
! 222:
! 223: #ifdef TERM_HELP
! 224: START_HELP(qms)
! 225: "1 qms",
! 226: "?commands set terminal qms",
! 227: "?set terminal qms",
! 228: "?set term qms",
! 229: "?terminal qms",
! 230: "?term qms",
! 231: "?qms",
! 232: " The `qms` terminal driver supports the QMS/QUIC Laser printer, the Talaris",
! 233: " 1200 and others. It has no options."
! 234: END_HELP(qms)
! 235: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>