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