1 /* $Id: plstrm.h,v 1.6 2007/05/17 10:37:26 ajb Exp $
2  *
3  *	Contains declarations for PLStream and PLDev structs.
4  *	Also prototypes for stream & device utility functions.
5 
6     Copyright (C) 2004  Andrew Ross
7     Copyright (C) 2004  Andrew Roach
8 
9     This file is part of PLplot.
10 
11     PLplot is free software; you can redistribute it and/or modify
12     it under the terms of the GNU Library General Public License as published
13     by the Free Software Foundation; either version 2 of the License, or
14     (at your option) any later version.
15 
16     PLplot is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU Library General Public License for more details.
20 
21     You should have received a copy of the GNU Library General Public License
22     along with PLplot; if not, write to the Free Software
23     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25 
26 #include "pdf.h"
27 
28 #ifndef __PLSTRM_H__
29 #define __PLSTRM_H__
30 
31 #include "disptab.h"
32 #include "pldll.h"
33 
34 /*--------------------------------------------------------------------------*\
35  * Define the PLDev data structure.
36  *
37  * These are all quantities that must be saved on a per-device basis.
38  * Some drivers (xwin, tk) allocate structures defined internally.
39 \*--------------------------------------------------------------------------*/
40 
41 typedef struct {
42     PLFLT pxlx, pxly;
43     PLINT xold, yold;
44 
45     PLINT xmin, xmax, xlen;
46     PLINT ymin, ymax, ylen;
47 
48     PLINT xmin_dev, xmax_dev, xlen_dev;
49     PLINT ymin_dev, ymax_dev, ylen_dev;
50 
51     PLFLT xscale_dev, yscale_dev;
52 } PLDev;
53 
54 /*--------------------------------------------------------------------------*\
55  * Define the PLStream data structure.
56  *
57  * This contains a copy of every variable that is stream dependent, which
58  * tends to be those which are settable by the user and persist for longer
59  * than one plot.
60  *
61  * Only those quantities listed in the PLStream struct will be preserved
62  * for an individual stream.  Note that the lack of every plplot constant
63  * means that one should only switch streams at a fairly high level, i.e.
64  * on the scale of an entire plot.  Otherwise intermediate quantities
65  * will be confused between the streams, possibly resulting in garbage plots.
66  * This structure may be expanded in time to improve intra-stream independence,
67  * but it is doubtful streams will ever be fully independent (perhaps
68  * neither necessary nor desirable? -- time will tell).
69  *
70  * There are undoubtably some inconsistencies in the declaration & use of
71  * the variables below.  This is a result of the continuing evolution of
72  * plplot and the numerous authors involved.  Hopefully in time the function
73  * of all variables can be fully documented and made more consistent.
74  *
75  * The quantities in each stream are as follows:
76  *
77  ***************************************************************************
78  *
79  * Misc control variables
80  *
81  * ipls		PLINT	Stream number
82  * level	PLINT	Initialization level
83  * program	const char*	Program name
84  * verbose	PLINT	Be more verbose than usual
85  * debug	PLINT	Generate debugging output
86  * initialized	PLINT	Set if the stream has been initialized
87  * dev_initialized PLINT Set if the device driver has been loaded
88  *
89  ***************************************************************************
90  *
91  * Palettes (two of them)
92  *
93  * Color map 0 is intended for static objects, such as boxes, lines, points,
94  * labels, etc.  These should be allocated before calling plinit (else you
95  * get 16 by default, which can be undesirable on some platforms).  These
96  * are then explicitly selected by number (in order of allocation).  The
97  * lowest number is 0, but this is used for the background color, so all
98  * color drivers start with 1 as the default color.
99  *
100  * Color map 1 is for continuous-tone plots, where color is used to
101  * represent function value or intensity.  These are set in a relative way
102  * only, for increased portability and flexibility.  The actual number of
103  * colors used to represent intensity levels is determined by the driver.
104  * Note that it is only necessary to specify intensity (on a scale from 0
105  * to 1) to get an appropriate color.  Drivers incapable of fine shading
106  * will do the best job they can.
107  *
108  * A palette selection tool for both palettes is available for the Tk
109  * driver.  Direct writing of RGB values (i.e.  banging on the hardware) is
110  * supported but highly discouraged (colors so written will be affected
111  * unpredictably by the palette tools).
112  *
113  * icol0	PLINT	Color map 0 entry, current color (0 <= icol0 <= ncol0)
114  * ncol0	PLINT	Number of colors allocated in color map 0.
115  * icol1	PLINT	Color map 1 entry, current color (0 <= icol1 <= ncol1)
116  * ncol1	PLINT	Number of colors allocated in color map 1.
117  * ncol1cp	PLINT	Number of control points in cmap1 allocation (max PL_MAX_CMAP1CP)
118  * lcol1cp	PLFLT	Locations of control points in cmap1 [0,1]
119  * curcmap	PLINT	Current color map
120  * curcolor	RGB[]	Current color
121  * tmpcolor	RGB[]	Temporary color storage
122  * cmap0 	RGB[]	Color map 0: maximum of ncol0 RGB 8-bit values
123  * cmap1 	RGB[]	Color map 1: maximum of ncol1 RGB 8-bit values
124  *
125  ***************************************************************************
126  *
127  * Variables governing pen width
128  *
129  * width	Current pen width
130  * widthset	Set if pen width was specified
131  * widthlock	Set if pen width is locked
132  *
133  ***************************************************************************
134  *
135  * Variables governing arrow type
136  *
137  * arrow_x      x coordinates of points in arrow
138  * arrow_y      y coordinates of points in arrow
139  * arrow_npts   number of points in arrow_x, arrow_y
140  * arrow_fill   whether the arrow should be filled or not
141  *
142  ***************************************************************************
143  *
144  * Variables used to pass information between the core and the driver
145  *
146  * It would be nice to use the "dev_" prefix uniformly but changing
147  * all that old code would be quite a lot of work..
148  *
149  * device	PLINT	Graphics device id number
150  * dev_minor	PLINT	Minor device id (for variations on one type)
151  * color	PLINT	Set if color is available
152  * colorset	PLINT	Set if "color" was set prior to calling plinit
153  * plbuf_read	PLINT	Set during a plot buffer redraw
154  * plbuf_write	PLINT	Set if driver needs to use the plot buffer
155  * dev_fill0	PLINT	Set if driver can do solid area fills
156  * dev_text	PLINT	Set if driver want to do it's only text drawing
157  * dev_unicode	PLINT	Set if driver wants unicode
158  * dev_hrshsym	PLINT	Set for Hershey symbols to be used
159  * dev_fill1	PLINT	Set if driver can do pattern area fills
160  * dev_dash     PLINT   Set if driver can do dashed lines
161  * dev_di	PLINT	Set if driver wants to handle DI commands
162  * dev_flush	PLINT	Set if driver wants to handle flushes itself
163  * dev_swin	PLINT	Set if driver wants to handle 'set window' commands
164  * dev_fastimg  PLINT   Set if driver has fast image drawing capabilities
165  * dev_xor      PLINT   Set if driver supports xor mode.
166  * dev_clear    PLINT   Set if driver support clear.
167  * termin	PLINT	Set for interactive devices
168  * graphx	PLINT	Set if currently in graphics mode
169  * nopause	PLINT	Set if we are skipping the pause between frames
170  * family	PLINT	Set if familying is enabled
171  * member	PLINT	Number of current family member file open
172  * finc		PLINT	Number to increment between member files
173  * fflen	PLINT	Minimum field length to use in member file number
174  * bytemax	PLINT	Number of bytes maximum per member file
175  * famadv	PLINT	Set to advance to the next family member
176  * DevName	char*	Device name
177  * OutFile	FILE	Output file pointer
178  * BaseName	char*	Output base name (i.e. family)
179  * Ext		char*	Output extension (i.e. device) pmr: added for EMBOSS
180  * FileName	char*	Output file name
181  * output_type	int	0 for file, 1 for stream
182  * bytecnt	PLINT	Byte count for output stream
183  * page		PLINT	Page count for output stream
184  * linepos	PLINT	Line count for output stream
185  * pdfs		PDFstrm* PDF stream pointer
186  *
187  * These are used by the escape function (for area fill, etc).
188  *
189  * dev_npts	PLINT	Number of points we are plotting
190  * dev_x	short*	Pointer to array of x values
191  * dev_y	short*	Pointer to array of x values
192  *
193  * For images
194  * dev_nptsX	PLINT	Number of points we are plotting in X
195  * dev_nptsY	PLINT	Number of points we are plotting in Y
196  * dev_z	ushort*	Pointer to array of z values for the color
197  * dev_zmin,
198  * dev_zmax     ushort  Min and max values of z to plot
199  *
200  * The following pointer is for drivers that require device-specific
201  * data.  At initialization the driver should malloc the necessary
202  * space and set pls->dev to point to this area.  This way there can
203  * be multiple streams using the same driver without conflict.
204  *
205  * dev		void*	pointer to device-specific data (malloc'ed)
206  *
207  * User-supplied event handlers for use by interactive drivers (e.g. X).
208  * Can be used to take various actions depending on input.  Currently
209  * only a keyboard event handler is supported.
210  *
211  * KeyEH	void*	Keyboard event handler
212  * KeyEH_data	void*	Pointer to client data to pass
213  *
214  * ButtonEH	void*	(Mouse) Button event handler
215  * ButtonEH_data void*	Pointer to client data to pass
216  *
217  * bop_handler	void*	bop handler
218  * bop_data	void*	Pointer to client data to pass
219  *
220  * eop_handler	void*	eop handler
221  * eop_data	void*	Pointer to client data to pass
222  *
223  * Variables used for direct specification of device characteristics
224  * Not supported by all drivers (or even very many)
225  *
226  * xdpi..	PLFLT	Device DPI settings in x and y
227  * xlength..	PLINT	Device output lengths in x and y
228  * xoffset..	PLINT	Device offsets from upper left hand corner
229  * pageset	PLINT	Set if page dimensions were specified
230  * hack		PLINT	Enables driver-specific hack(s) if set
231  *
232  ***************************************************************************
233  *
234  * User customization tidy routine.  This is called before closing a stream
235  * to do any program specific cleanup.
236  *
237  * tidy		void*   pointer to cleanup routine
238  * tidy_data	void*   pointer to client data to pass
239  *
240  ****************************************************************************
241  *
242  * User error control variables.  Pass in a pointer for either to be set
243  * in exceptional conditions.  The caller is responsible for clearing the
244  * error code.
245  *
246  * errcode	PLINT*	pointer to variable to assign error code
247  * errmsg	char* pointer to error message buffer (must be >= 160 bytes)
248  *
249  ****************************************************************************
250  *
251  * Stuff used by Xlib driver
252  *
253  * geometry	char*	Window geometry (malloc'ed)
254  * window_id	long	X-window window ID
255  * nopixmap	int	Set if you want to forbid allocation of pixmaps
256  * db		int	Set if you want to double buffer output
257  *			(only pixmap is drawn to directly; it is blitted
258  *			to output window on EOP or an Expose)
259  * ext_resize_draw int  Set if you want to control the redraw caused by a
260  *                      window resize by an external agent.
261  ***************************************************************************
262  *
263  * These are for support of the TK driver.
264  *
265  * server_name	char*	Main window name of server
266  * server_host	char*	Name of host to run server on
267  * server_port	char*	Port to talk to server on
268  * user		char*	Your user name on remote host (for remsh command)
269  * plserver	char*	Name of server
270  * plwindow	char*	Name of reference server window (malloc'ed)
271  * tk_file	char*   File for plserver use with its -file option
272  * auto_path	char*	Additional directories to autoload
273  * bufmax	int	Number of bytes sent before output buffer is flushed
274  * dp		int	Use Tcl-DP for communication, if set
275  * server_nokill int	Don't kill plserver on a ^C if set
276  *
277  ***************************************************************************
278  *
279  * Variables for use by the plot buffer
280  *
281  * For BUFFERED_FILE
282  * plbufFile	FILE	Plot buffer file pointer
283  *
284  * For Memory Buffer (default)
285  * plbuf_buffer_grow	size_t		Memory buffer growth step
286  * plbuf_buffer_size	size_t		Current size of memory buffer
287  * plbuf_buffer			void *		Pointer to memory buffer
288  * plbuf_top			size_t		Offset to the top of used area/start of free area
289  * plbuf_readpos		size_t		Offset to current position being read
290  *
291  * plbufOwner	int	Typically set; only zero if current stream is cloned.
292  *
293  ***************************************************************************
294  *
295  * Driver interface (DI)
296  *
297  * difilt	PLINT	Driver interface filter flag
298  *
299  * dipxmin	PLFLT
300  * dipymin	PLFLT	Min, max relative plot coordinates
301  * dipxmax	PLFLT
302  * dipymax	PLFLT
303  * dipxax 	PLFLT	Plot window transformation:
304  * dipxb 	PLFLT	  x' = dipxax * x + dipxb
305  * dipyay 	PLFLT
306  * dipyb 	PLFLT	  y' = dipyay * y + dipyb
307  *
308  * aspdev	PLFLT	Original device aspect ratio
309  * aspect	PLFLT	Page aspect ratio
310  * aspori	PLFLT	Rotation-induced aspect ratio
311  * caspfactor	PLFLT	Factor applied to preserve character aspect ratio
312  * freeaspect	PLINT	Allow aspect ratio to adjust to orientation swaps
313  * 			when overall aspect ratio is changed.
314  * portrait	PLINT	Portrait mode (orientation and aspect ratio)
315  * mar		PLFLT	Page margin (minimum)
316  * jx		PLFLT	Page justification in x
317  * jy		PLFLT	Page justification in y
318  *
319  * didxax 	PLFLT	Device window transformation:
320  * didxb 	PLFLT	  x' = didxax * x + didxb
321  * didyay 	PLFLT
322  * didyb 	PLFLT	  y' = didyay * y + didyb
323  *
324  * diclpxmi	PLINT
325  * diclpxma	PLINT	Device clip limits
326  * diclpymi	PLINT
327  * diclpyma	PLINT
328  *
329  * diorot	PLFLT	Rotation angle (in units of pi/2)
330  * dioxax	PLFLT	Orientation transformation:
331  * dioxay	PLFLT	  x' = dioxax * x + dioxay * y + dioxb
332  * dioxb 	PLFLT
333  * dioyax	PLFLT	  y' = dioyax * x + dioyay * y + dioyb
334  * dioyay	PLFLT
335  * dioyb 	PLFLT
336  *
337  * dimxmin	PLFLT
338  * dimymin	PLFLT	Target coordinate system parameters.
339  * dimxmax	PLFLT
340  * dimymax	PLFLT
341  * dimxpmm	PLFLT
342  * dimypmm	PLFLT
343  * dimxax 	PLFLT	Map meta to physical coordinates:
344  * dimxb 	PLFLT	  x' = dimxax * x + dimxb
345  * dimyay 	PLFLT
346  * dimyb 	PLFLT	  y' = dimyay * y + dimyb
347  *
348  * page_status	PLINT	Flag to indicate current action
349  *
350  ***************************************************************************
351  *
352  * Fill pattern state information.
353  * patt < 0: Hardware fill, if available (not implemented yet)
354  * patt ==0: Hardware fill, if available, solid
355  * patt > 0: Software fill
356  *
357  * patt		Fill pattern number
358  * inclin	Array of inclinations in tenths of degree for fill lines
359  * delta	Array of spacings in micrometers between fill lines
360  * nps		Number of distinct line styles for fills
361  *
362  ***************************************************************************
363  *
364  * Variables used in line drawing
365  *
366  * currx	Physical x-coordinate of current point
367  * curry	Physical y-coordinate of current point
368  * mark		Array of mark lengths in micrometers for broken lines
369  * space	Array of space lengths in micrometers for broken lines
370  * nms		Number of elements for current broken line style
371  * timecnt	Timer for broken lines
372  * alarm	Alarm indicating change of broken line status
373  * pendn	Flag indicating if pen is up or down
374  * curel	Current element within broken line
375  *
376  ***************************************************************************
377  *
378  * Variables governing character strings
379  *
380  * esc		Text string escape character
381  *
382  ***************************************************************************
383  *
384  * Scale factors for characters, symbols, and tick marks.
385  *
386  * scale	Scaling factor for chr, sym, maj, min.
387  * chr...	Character default height and current (scaled) height
388  * sym...	Symbol    default height and current (scaled) height
389  * maj...	Major tick default height and current (scaled) height
390  * min...	Minor tick default height and current (scaled) height
391  *
392  ***************************************************************************
393  *
394  * Variables governing numeric axis label appearance
395  *
396  * setpre	Non-zero to set precision using "prec"
397  * precis	User-specified precision
398  * xdigmax..	Allowed #digits in axes labels
399  * xdigits..	Actual field widths (returned)
400  *
401  ***************************************************************************
402  *
403  * Variables governing physical coordinate system
404  *
405  * vpp..	Viewport boundaries in physical coordinates
406  * spp..	Subpage  boundaries in physical coordinates
407  * clp..	Clip     boundaries in physical coordinates
408  * phy...	Physical device limits in physical coordinates
409  * um.		Number of micrometers in a pixel
410  * pmm		Number of pixels to a millimeter
411  *
412  ***************************************************************************
413  *
414  * State variables for 3d plots
415  *
416  * base3.	World coordinate size of base for 3-d plot
417  * basec.	Position of centre of base for 3-d plot
418  * dom...	Minimum and maximum values for domain
419  * zzscl	Vertical (z) scale for 3-d plot
420  * ran..	Minimum and maximum z values for 3-d plot
421  * c..		Coordinate transformation from 3-d to 2-d
422  *
423  ***************************************************************************
424  *
425  * Variables for keeping track of world coordinate windows on a page.
426  *
427  * nCWindows	Number of coordinate windows on current page
428  * windows	Array of plCWindow's for current page
429  *
430  ***************************************************************************
431  *
432  * Variables governing subpages and viewports.
433  *
434  * nsub...	Number of subpages on physical device
435  * cursub	Current subpage
436  * spd...	Subpage  boundaries in normalized device coordinates
437  * vpd...	Viewport boundaries in normalized device coordinates
438  * vpw...	Viewport boundaries in world coordinates
439  *
440  ***************************************************************************
441  *
442  * Transformation variables
443  *
444  * wp....	Transformation variables for world  to physical conversion
445  * wm....	Transformation variables for world coordinates to mm
446  *
447  ****************************************************************************
448  *
449  * Other variables
450  *
451  * dev_compression Compression level for supporting devices
452  *
453  ****************************************************************************
454  *
455  * Font related variables
456  *
457  * cfont           Current font number, replaces global 'font' in plsym.c
458  *                 This can be latter extended for font shape, series, family and size
459  * fci             FCI (font characterization integer)
460  * An FCI is sometimes inserted in the middle of a stream of
461  * unicode glyph indices.  Thus to distinguish it from those, the FCI is marked
462  * by 0x8 in the most significant 4 bits.  The remaining 7 hex digits
463  * stored in the 32-bit integer characterize 7 different font attributes.
464  * The font attributes are interpreted as follows:
465  * hexdigit =>                    0        1          2        3       4        5
466  * hexpower   Font attribute               Possible attribute values
467  *    0       font-family     sans-serif  serif    monospace  script  symbol |fantasy
468  *    1       font-style        upright   italic    oblique |
469  *    2       font-weight       medium     bold  |   bolder    light  lighter
470  *    3       font-variant      normal | small caps
471  *
472  * Everything to the right of the vertical bars is not implemented and is
473  * subject to change.  The four font attributes (font-family, font-style,
474  * font-weight, and font-variant are stored in the FCI in the order of
475  * hexpower, the left shift that is applied to the hex digit to place the
476  * hexdigit in the FCI.  The hexpower = 3 position is essentially undefined
477  * since there is currently only one hexdigit (0) defined, and similarly
478  * for hexpower = 4-6 so there is room for expansion of this scheme into more
479  * font attributes if required.  (hexpower = 7 is reserved for the 0x8 marker
480  * of the FCI.)
481 \*--------------------------------------------------------------------------*/
482 
483 #define PL_MAX_CMAP1CP 256
484 
485 typedef struct {
486 
487 /* Misc control information */
488 
489     PLINT ipls, level, verbose, debug, initialized, dev_initialized;
490     const char *program;		/* pmr: const */
491 
492 /* Colormaps */
493 
494     PLINT icol0, ncol0, icol1, ncol1, ncp1, curcmap;
495 
496     PLColor curcolor, tmpcolor;
497     PLColor *cmap0;
498     PLColor *cmap1;
499 
500     PLControlPt cmap1cp[PL_MAX_CMAP1CP];
501 
502 /* Variables governing pen width */
503 
504     PLINT width;
505     PLINT widthset, widthlock;
506 
507 /* Variables governing arrow */
508     char  padding1[4];
509     PLFLT *arrow_x;
510     PLFLT *arrow_y;
511     PLINT arrow_npts;
512     PLINT arrow_fill;
513 
514 /* Driver dispatch table, obsoletes "device" member below. */
515 
516     PLDispatchTable *dispatch_table;
517 
518 /* Variables used for interacting with or by device driver */
519 
520     PLINT plbuf_read, plbuf_write;
521     PLINT device, dev_minor, termin, graphx, nopause;
522     PLINT color, colorset;
523     PLINT family, member, finc, fflen, bytemax, famadv;
524     PLINT dev_fill0, dev_fill1, dev_dash, dev_di, dev_flush, dev_swin;
525     PLINT dev_text, dev_xor, dev_clear, dev_fastimg;
526 
527     char DevName[80];
528     char Padding2[4];
529 
530     FILE *OutFile;
531     char *BaseName, *FileName;
532     char *Ext;				/* pmr: added for EMBOSS */
533     int  output_type;
534     PLINT bytecnt, page, linepos;
535     PDFstrm *pdfs;
536 
537     PLINT dev_npts;
538     char Padding3[4];
539 
540     short *dev_x, *dev_y;
541 
542   /* variables for plimage() */
543 
544     PLINT dev_nptsX, dev_nptsY;
545     short *dev_ix, *dev_iy;
546     unsigned short *dev_z;
547     unsigned short dev_zmin, dev_zmax;
548     PLINT imclxmin, imclxmax, imclymin, imclymax;
549     char Padding4[4];
550   /* end of variables for plimage() */
551 
552     void *dev;
553 
554     void (*KeyEH)	(PLGraphicsIn *gin, void *KeyEH_data,
555 			 int *exit_eventloop);
556     void *KeyEH_data;
557 
558     void (*ButtonEH)	(PLGraphicsIn *gin, void *ButtonEH_data,
559 			 int *exit_eventloop);
560     void *ButtonEH_data;
561 
562     void (*LocateEH)	(PLGraphicsIn *gin, void *LocateEH_data,
563 			 int *locate_mode);
564     void *LocateEH_data;
565 
566     void (*bop_handler)	(void *bop_data, int *skip_driver_bop);
567     void *bop_data;
568 
569     void (*eop_handler)	(void *eop_data, int *skip_driver_eop);
570     void *eop_data;
571 
572     PLFLT xdpi, ydpi;
573     PLINT xlength, ylength;
574     PLINT xoffset, yoffset;
575     PLINT pageset, hack;
576 
577 /* Per stream tidy function. */
578 
579     void (*tidy)    (void *);
580     void *tidy_data;
581 
582 /* Error info */
583 
584     PLINT *errcode;
585     char *errmsg;
586 
587 /* Stuff used by Xlib driver */
588 
589     char *geometry;
590     long window_id;
591     int  nopixmap, db, ext_resize_draw;
592     char Padding5[4];
593 /* Stuff used by TK, DP drivers */
594 
595     char *server_name, *server_host, *server_port, *user;
596     char *plserver, *plwindow;
597     char *auto_path;
598     char *tk_file;  /* plserver -file option */
599     int  bufmax, dp, server_nokill;
600     char Padding6[4];
601 
602 /* Plot buffer settings */
603 
604 #ifdef BUFFERED_FILE
605     FILE *plbufFile;
606 #else
607     size_t plbuf_buffer_grow;
608     size_t plbuf_buffer_size;
609     void *plbuf_buffer;
610     size_t plbuf_top;
611     size_t plbuf_readpos;
612 #endif
613     int  plbufOwner;
614 
615 /* Driver interface (DI) */
616 
617     PLINT difilt, diclpxmi, diclpxma, diclpymi, diclpyma;
618     PLFLT dipxmin, dipymin, dipxmax, dipymax;
619     PLFLT dipxax, dipxb, dipyay, dipyb;
620     PLFLT aspdev, aspect, aspori, caspfactor, mar, jx, jy;
621     PLFLT didxax, didxb, didyay, didyb;
622     PLFLT diorot;
623     PLFLT dioxax, dioxay, dioxb, dioyax, dioyay, dioyb;
624     PLFLT dimxax, dimxb, dimyay, dimyb;
625     PLFLT dimxmin, dimymin, dimxmax, dimymax, dimxpmm, dimypmm;
626     PLINT page_status, freeaspect, portrait;
627 
628 /* Fill pattern info */
629 
630     PLINT patt, inclin[2], delta[2], nps;
631 
632 /* Variables used in line drawing */
633 
634     PLINT currx, curry;
635     PLINT mark[10], space[10], nms;
636     PLINT timecnt, alarm, pendn, curel;
637 
638 /* Variables governing character strings */
639 
640     char  esc;
641     char padding[7];
642 
643 /* Scale factors for characters, symbols, and tick marks. */
644 
645     PLFLT scale;
646     PLFLT chrdef, chrht;
647     PLFLT symdef, symht;
648     PLFLT majdef, majht;
649     PLFLT mindef, minht;
650 
651 /* Variables governing numeric axis label appearance */
652 
653     PLINT setpre, precis;
654     PLINT xdigmax, ydigmax, zdigmax;
655     PLINT xdigits, ydigits, zdigits;
656 
657 /* Variables governing physical coordinate system */
658 
659     PLINT vppxmi, vppxma, vppymi, vppyma;
660     PLINT sppxmi, sppxma, sppymi, sppyma;
661     PLINT clpxmi, clpxma, clpymi, clpyma;
662     PLINT phyxmi, phyxma, phyxlen, phyymi, phyyma, phyylen;
663     PLINT umx, umy;
664     PLFLT xpmm, ypmm;
665 
666 /* State variables for 3d plots */
667 
668     PLFLT base3x, base3y, basecx, basecy;
669     PLFLT domxmi, domxma, domymi, domyma;
670     PLFLT zzscl, ranmi, ranma;
671     PLFLT cxx, cxy, cyx, cyy, cyz;
672 
673 /* Variables for keeping track of windows on a page. */
674 
675     int nplwin;
676     PLWindow plwin[PL_MAXWINDOWS];
677 
678 /* Variables governing subpages and viewports. */
679 
680     PLINT nsubx, nsuby, cursub;
681     PLFLT spdxmi, spdxma, spdymi, spdyma;
682     PLFLT vpdxmi, vpdxma, vpdymi, vpdyma;
683     PLFLT vpwxmi, vpwxma, vpwymi, vpwyma;
684 
685 /* Transformation variables */
686 
687     PLFLT wpxscl, wpxoff, wpyscl, wpyoff;
688     PLFLT wmxscl, wmxoff, wmyscl, wmyoff;
689     PLFLT wdxscl, wdxoff, wdyscl, wdyoff;
690 
691 /* Other variables */
692 
693   PLINT dev_compression;
694   PLINT cfont;
695 
696   char Padding7[4];
697 
698 
699   void *FT;
700 
701 /* Stuff used by the Tkwin driver for Plframe */
702   struct PlPlotter *plPlotterPtr;
703 
704 
705 /* Unicode section */
706 
707   PLINT dev_unicode;
708 
709   PLUNICODE fci;
710 
711   PLINT dev_hrshsym;
712 
713 /* Used to keep a hold of a temporary copy of the original character height
714  * which I overload as a quick hack to fix up a bug in freetype an plsym()
715  */
716 
717   PLFLT original_chrdef,original_chrht;
718   char Padding8[4];
719 
720   /*
721    * Pointer to postscript document class used by psttf
722    */
723   void *psdoc;
724 
725 
726 } PLStream;
727 
728 /*--------------------------------------------------------------------------*\
729  * Prototypes for stream & device utility functions.
730 \*--------------------------------------------------------------------------*/
731 
732 #ifdef __cplusplus
733 extern "C" {
734 #endif
735 
736 /* Get the current stream pointer */
737 
738 void PLDLLIMPEXP
739 plgpls(PLStream **p_pls);
740 
741 /* Initializes device cmap 1 entry by interpolation from pls->cmap1 entries */
742 
743 void
744 plcol_interp(PLStream *pls, PLColor *newcolor, int i, int ncol);
745 
746 /* Opens file for output, prompting if not set. */
747 
748 void
749 plOpenFile(PLStream *pls);
750 
751 /* Sets up next file member name (in pls->FileName), but does not open it. */
752 
753 void
754 plP_getmember(PLStream *pls);
755 
756 /* Sets up file name & family stem name. */
757 
758 void
759 plP_sfnam(PLStream *pls, const char *fnam);
760 
761 void
762 plPX_sfnam(PLStream *pls, const char *fnam, const char *ext);
763 
764 /* Initializes family file parameters. */
765 
766 void
767 plFamInit(PLStream *pls);
768 
769 /* Starts new member file of family file set if necessary. */
770 
771 void
772 plGetFam(PLStream *pls);
773 
774 /* Rotates physical coordinates if necessary for given orientation. */
775 
776 void
777 plRotPhy(PLINT orient, PLINT xmin, PLINT ymin, PLINT xmax, PLINT ymax,
778 	 PLINT *px, PLINT *py);
779 
780 /* Allocates a standard PLDev structure for device-specific data */
781 
782 PLDev *
783 plAllocDev(PLStream *pls);
784 
785 /* Just fills in the PLGraphicsIn with appropriate initial values. */
786 
787 void
788 plGinInit(PLGraphicsIn *gin);
789 
790 #ifdef __cplusplus
791 }
792 #endif
793 
794 #endif	/* __PLSTRM_H__ */
795