1/* Hello, Emacs, this is -*-C-*-
2 * $Id: hp2648.trm,v 1.12 2006/07/07 03:51:22 sfeam Exp $
3 *
4 */
5
6/* GNUPLOT -  hp2648.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 *  HP2648 and HP2647
43 *
44 * AUTHORS
45 *  Russell Lang
46 *
47 * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
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
58register_term(hp2648)
59#endif
60
61#ifdef TERM_PROTO
62TERM_PUBLIC void HP2648init __PROTO((void));
63TERM_PUBLIC void HP2648graphics __PROTO((void));
64TERM_PUBLIC void HP2648text __PROTO((void));
65TERM_PUBLIC void HP2648linetype __PROTO((int linetype));
66TERM_PUBLIC void HP2648move __PROTO((unsigned int x, unsigned int y));
67TERM_PUBLIC void HP2648vector __PROTO((unsigned int x, unsigned int y));
68TERM_PUBLIC void HP2648put_text __PROTO((unsigned int x, unsigned int y, const char *str));
69TERM_PUBLIC int HP2648_text_angle __PROTO((int ang));
70TERM_PUBLIC void HP2648reset __PROTO((void));
71
72#define HP2648XMAX 720
73#define HP2648YMAX 360
74
75#define HP2648VCHAR		12
76#define HP2648HCHAR		7
77#define HP2648VTIC		8
78#define HP2648HTIC		8
79#endif /* TERM_PROTO */
80
81#ifndef TERM_PROTO_ONLY
82#ifdef TERM_BODY
83#define HP2648XLAST (HP2648XMAX - 1)
84#define HP2648YLAST (HP2648YMAX - 1)
85
86
87TERM_PUBLIC void
88HP2648init()
89{
90    fprintf(gpoutfile, "\033*m1m1n136,1cZ");
91/*                   1     2 3     4
92	1. mode
93	2. textsize=1
94	3. textangle=1
95        4. define line type 2 to be *   *   *   * etc.
96*/
97}
98
99
100TERM_PUBLIC void
101HP2648graphics()
102{
103    fprintf(gpoutfile, "\033*dacZ");
104/*                   1     23
105	1. mode
106	2. clear grahics screen
107	3. graphics video on
108*/
109}
110
111
112TERM_PUBLIC void
113HP2648text()
114{
115}
116
117
118TERM_PUBLIC void
119HP2648linetype(int linetype)
120{
121    static int hpline[] = { 1, 7, 1, 4, 5, 6, 8, 9, 10, 7, 2 };
122    fprintf(gpoutfile, "\033*m%dbZ", hpline[(linetype + 2) % 11]);
123}
124
125
126TERM_PUBLIC void
127HP2648move(unsigned int x, unsigned int y)
128{
129    fprintf(gpoutfile, "\033*paf%d,%dZ", x, y);
130    /*               1     23     4
131       1        plot mode
132       2        "pen up"
133       3        goto absolute x,y
134       4        end command
135     */
136}
137
138
139TERM_PUBLIC void
140HP2648vector(unsigned int x, unsigned int y)
141{
142    fprintf(gpoutfile, "\033*pbf%d,%dZ", x, y);
143    /*                     1
144       1        "pen down"
145     */
146}
147
148
149TERM_PUBLIC void
150HP2648put_text(unsigned int x, unsigned int y, const char *str)
151{
152    HP2648move(x, y - HP2648VCHAR / 2 + 1);
153    fprintf(gpoutfile, "\033*l%s\n", str);
154}
155
156
157TERM_PUBLIC int
158HP2648_text_angle(int ang)
159{
160int hp_ang = (ang ? 1 : 0);
161
162    fprintf(gpoutfile, "\033*m%dnZ\n", hp_ang+1);
163    return TRUE;
164}
165
166TERM_PUBLIC void
167HP2648reset()
168{
169}
170
171#endif /* TERM_BODY */
172
173#ifdef TERM_TABLE
174TERM_TABLE_START(hp2648_driver)
175    "hp2648", "HP2648 and HP2647",
176    HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR,
177    HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset,
178    HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector,
179    HP2648linetype, HP2648put_text, HP2648_text_angle,
180    null_justify_text, line_and_point, do_arrow, set_font_null
181TERM_TABLE_END(hp2648_driver)
182
183#undef LAST_TERM
184#define LAST_TERM hp2648_driver
185
186#endif /* TERM_TABLE */
187#endif /* TERM_PROTO_ONLY */
188
189#ifdef TERM_HELP
190START_HELP(hp2648)
191"1 hp2648",
192"?commands set terminal hp2648",
193"?set terminal hp2648",
194"?set term hp2648",
195"?terminal hp2648",
196"?term hp2648",
197"?hp2648",
198" The `hp2648` terminal driver supports the Hewlett Packard HP2647 and HP2648.",
199" It has no options."
200END_HELP(hp2648)
201#endif
202