Back to index

plt-scheme  4.2.1
disptab.h
Go to the documentation of this file.
00001 /* $Id: disptab.h,v 1.1 2004/03/01 20:54:46 cozmic Exp $
00002 
00003    Defines the data structure which holds the driver functions.
00004 */
00005 
00006 #ifndef __DISPATCH_H__
00007 #define __DISPATCH_H__
00008 
00009 #include "plConfig.h"
00010 
00011 struct PLStream_struct;
00012 
00013 enum {
00014     plDevType_FileOriented = 0,
00015     plDevType_Interactive = 1,
00016     plDevType_Null = -1
00017 };
00018 
00019 /*--------------------------------------------------------------------------*\
00020  * Define structure containing pointers to device dependent functions.
00021  *
00022  * pl_MenuStr Pointer to string that is printed in device menu. 
00023  *
00024  * pl_DevName A short device "name" for device selection by name. 
00025  *
00026  * pl_type    0 for file-oriented device, 1 for interactive
00027  *            (the null driver uses -1 here)
00028  *
00029  * pl_seq       The sequence number for ordering the presentation list of the
00030  *              available drivers.  This is an ordering only, not an absolute
00031  *              position in the list.
00032  *
00033  * pl_init    Initialize device.  This routine may also prompt the user
00034  *            for certain device parameters or open a graphics file
00035  *            (see note).  Called only once to set things up.  Certain
00036  *            options such as familying and resolution (dots/mm) should
00037  *            be set up before calling this routine (note: some drivers
00038  *            ignore these).
00039  *
00040  * pl_line    Draws a line between two points. 
00041  *
00042  * pl_polyline       Draws a polyline (no broken segments).
00043  *
00044  * pl_eop     Finishes out current page (see note). 
00045  *
00046  * pl_bop     Set up for plotting on a new page. May also open a new
00047  *            a new graphics file (see note). 
00048  *
00049  * pl_tidy    Tidy up. May close graphics file (see note). 
00050  *
00051  * pl_state   Handle change in PLStream state
00052  *            (color, pen width, fill attribute, etc).
00053  *
00054  * pl_esc     Escape function for driver-specific commands.
00055  *
00056  *
00057  * Notes:
00058  *
00059  * Most devices allow multi-page plots to be stored in a single graphics
00060  * file, in which case the graphics file should be opened in the pl_init()
00061  * routine, closed in pl_tidy(), and page advances done by calling pl_eop
00062  * and pl_bop() in sequence. If multi-page plots need to be stored in
00063  * different files then pl_bop() should open the file and pl_eop() should
00064  * close it.  Do NOT open files in both pl_init() and pl_bop() or close
00065  * files in both pl_eop() and pl_tidy().
00066 \*--------------------------------------------------------------------------*/
00067 
00068 typedef void (*plD_init_fp)    (struct PLStream_struct *);
00069 typedef void (*plD_line_fp)    (struct PLStream_struct *, short, short, short, short);
00070 typedef void (*plD_polyline_fp)(struct PLStream_struct *, short *, short *, PLINT);
00071 typedef void (*plD_eop_fp)     (struct PLStream_struct *);
00072 typedef void (*plD_bop_fp)     (struct PLStream_struct *);
00073 typedef void (*plD_tidy_fp)    (struct PLStream_struct *);
00074 typedef void (*plD_state_fp)   (struct PLStream_struct *, PLINT);
00075 typedef void (*plD_esc_fp)     (struct PLStream_struct *, PLINT, void *);
00076 
00077 typedef struct {
00078     char *pl_MenuStr;
00079     char *pl_DevName;
00080     int  pl_type;
00081     int  pl_seq;
00082     plD_init_fp     pl_init;
00083     plD_line_fp     pl_line;
00084     plD_polyline_fp pl_polyline;
00085     plD_eop_fp      pl_eop;
00086     plD_bop_fp      pl_bop;
00087     plD_tidy_fp     pl_tidy;
00088     plD_state_fp    pl_state;
00089     plD_esc_fp     pl_esc;
00090 } PLDispatchTable;
00091 
00092 #endif /* __DISPATCH_H__ */