1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
|
/*
* $Id: qms.trm,v 1.6 1998/11/25 21:07:51 lhecking Exp $
*
*/
/* GNUPLOT - qms.trm */
/*[
* Copyright 1990 - 1993, 1998
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
* This file is included by ../term.c.
*
* This terminal driver supports:
* QMS laser printers
*
* AUTHORS
* Colin Kelley, Thomas Williams, Russell Lang
*
* send your comments or suggestions to (info-gnuplot@dartmouth.edu).
*
*/
/*
* adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
*/
#include "driver.h"
#ifdef TERM_REGISTER
register_term(qms)
#endif
#ifdef TERM_PROTO
TERM_PUBLIC void QMS_init __PROTO((void));
TERM_PUBLIC void QMS_graphics __PROTO((void));
TERM_PUBLIC void QMS_text __PROTO((void));
TERM_PUBLIC void QMS_linetype __PROTO((int linetype));
TERM_PUBLIC void QMS_move __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void QMS_vector __PROTO((unsigned int x2, unsigned int y2));
TERM_PUBLIC void QMS_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
TERM_PUBLIC void QMS_reset __PROTO((void));
#define QMS_XMAX 9000
#define QMS_YMAX 6000
#define QMS_XLAST (QMS_XMAX - 1)
#define QMS_YLAST (QMS_YMAX - 1)
#define QMS_VCHAR 120
#define QMS_HCHAR 70
#define QMS_VTIC 70
#define QMS_HTIC 70
#endif /* TERM_PROTO */
#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
static int qms_line = 0; /* to remember current line type */
TERM_PUBLIC void QMS_init()
{
/* This was just ^IOL, but at Rutgers at least we need some more stuff */
fputs("^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n", gpoutfile);
/* ^ QUIC on ^set defaults ^ set botttom,top,left margins
* ^landscape ^free format
*/
/* set defaults are: implicit decimal point, units in inches,
* numbers left justified, units in 1/1000 inch, do not ignore spaces
* margins are in 1/1000 inch units
*/
}
TERM_PUBLIC void QMS_graphics()
{
fputs("^IGV\n", gpoutfile);
/* ^enter graphics vector mode */
}
TERM_PUBLIC void QMS_text()
{
/* added ^-, because ^, after an ^I command doesn't actually print a page */
/* Did anybody try this code out? [uhh...-cdk] */
fputs("^IGE\n^-^,", gpoutfile);
/* ^exit graphics vector mode
* ^pass terminator
* ^print page
*/
}
TERM_PUBLIC void QMS_linetype(linetype)
int linetype;
{
static int width[2 + 9] = { 7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7 };
static int type[2 + 9] = { 0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3 };
/*
* I don't know about Villanova, but on our printer, using ^V without
* previously setting up a pattern crashes the microcode.
* [nope, doesn't crash here. -cdk]
* [it generates a controller error here on dotted lines. - rjl]
*/
/* Code to define patterns added by rjl
* According to the manual it should work - but it doesn't
*/
qms_line = linetype;
if (linetype >= 9)
linetype %= 9;
fprintf(gpoutfile, "^PW%02d\n", width[linetype + 2]);
/* ^width in dots */
switch (type[linetype + 2]) {
case 1: /* short dash */
fputs("^PV102025^G\n^V1\n", gpoutfile);
/* ^PV = define pattern vector, 1 = pattern number,
* 02 = number of pen downs and ups, 025 = .025" length of ups/downs
*/
break;
case 2: /* medium dash */
fputs("^PV202050^G\n^V2\n", gpoutfile);
break;
case 3: /* long dash */
fputs("^PV302100^G\n^V3\n", gpoutfile);
break;
default:
case 0:
fputs("^V0\n", gpoutfile);
break;
}
}
TERM_PUBLIC void QMS_move(x, y)
unsigned int x, y;
{
fprintf(gpoutfile, "^U%05d:%05d\n", 1000 + x, QMS_YLAST + 1000 - y);
/* ^pen up vector*/
}
TERM_PUBLIC void QMS_vector(x2, y2)
unsigned int x2, y2;
{
fprintf(gpoutfile, "^D%05d:%05d\n", 1000 + x2, QMS_YLAST + 1000 - y2);
/* ^pen down vector*/
}
TERM_PUBLIC void QMS_put_text(x, y, str)
unsigned int x, y;
char str[];
{
char ch;
QMS_move(x, y + QMS_VCHAR / 3);
fputs("^IGE\n", gpoutfile);
ch = *str++;
while (ch != NUL) {
if (ch == '^')
putc('^', gpoutfile);
putc(ch, gpoutfile);
ch = *str++;
}
fputs("\n^IGV\n", gpoutfile);
QMS_linetype(qms_line); /* restore line type */
}
TERM_PUBLIC void QMS_reset()
{
fputs("^PN^-\n", gpoutfile);
/* ^QUIC off */
}
#endif /* TERM_BODY */
#ifdef TERM_TABLE
TERM_TABLE_START(qms_driver)
"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
QMS_XMAX, QMS_YMAX, QMS_VCHAR, QMS_HCHAR,
QMS_VTIC, QMS_HTIC, options_null, QMS_init, QMS_reset,
QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
QMS_linetype, QMS_put_text, null_text_angle,
null_justify_text, line_and_point, do_arrow, set_font_null
TERM_TABLE_END(qms_driver)
#undef LAST_TERM
#define LAST_TERM qms_driver
#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */
#ifdef TERM_HELP
START_HELP(qms)
"1 qms",
"?commands set terminal qms",
"?set terminal qms",
"?set term qms",
"?terminal qms",
"?term qms",
"?qms",
" The `qms` terminal driver supports the QMS/QUIC Laser printer, the Talaris",
" 1200 and others. It has no options."
END_HELP(qms)
#endif
|