Back to index

plt-scheme  4.2.1
plcore.h
Go to the documentation of this file.
00001 /* $Id: plcore.h,v 1.1 2004/03/01 20:54:51 cozmic Exp $
00002 
00003        Contains declarations for core plplot data structures.  This file
00004        should be included only by plcore.c.
00005 */
00006 
00007 #ifndef __PLCORE_H__
00008 #define __PLCORE_H__
00009 
00010 #include "plplotP.h"
00011 #include "drivers.h"
00012 #include "plDevs.h"
00013 #include "disptab.h"
00014 
00015 #ifdef ENABLE_DYNDRIVERS
00016 #include <ltdl.h>
00017 typedef lt_ptr (*PLDispatchInit)( PLDispatchTable *pdt );
00018 #else
00019 typedef void (*PLDispatchInit)( PLDispatchTable *pdt );
00020 #endif
00021     
00022 
00023 
00024 /* Static function prototypes */
00025 
00026 static void   grline        (short *, short *, PLINT);
00027 static void   grpolyline    (short *, short *, PLINT);
00028 static void   grfill        (short *, short *, PLINT);
00029 static void   plSelectDev   (void);
00030 static void   pldi_ini      (void);
00031 static void   calc_diplt    (void);
00032 static void   calc_didev    (void);
00033 static void   calc_diori    (void);
00034 static void   calc_dimap    (void);
00035 static void   plgdevlst     (char **, char **, int *, int);
00036 
00037 static void   plInitDispatchTable  (void);
00038 
00039 static void   plLoadDriver  (void);
00040 
00041 /* Static variables */
00042 
00043 static PLINT xscl[PL_MAXPOLY], yscl[PL_MAXPOLY];
00044 
00045 static PLINT initfont = 1;  /* initial font: extended by default */
00046 
00047 static PLINT lib_initialized = 0;
00048 
00049 /*--------------------------------------------------------------------------*\
00050  * Allocate a PLStream data structure (defined in plstrm.h).
00051  *
00052  * This struct contains a copy of every variable that is stream dependent.
00053  * Only the first [index=0] stream is statically allocated; the rest
00054  * are dynamically allocated when you switch streams (yes, it is legal
00055  * to only initialize the first element of the array of pointers).
00056 \*--------------------------------------------------------------------------*/
00057 
00058 static PLStream pls0;                     /* preallocated stream */
00059 static PLINT ipls;                 /* current stream number */
00060 
00061 static PLStream *pls[PL_NSTREAMS] = {&pls0};     /* Array of stream pointers */
00062 
00063 /* Current stream pointer.  Global, for easier access to state info */
00064 
00065 PLStream *plsc = &pls0;
00066 
00067 /* Only now can we include this */
00068 
00069 #include "pldebug.h"
00070 
00071 /*--------------------------------------------------------------------------*\
00072  * Initialize dispatch table.
00073  *
00074  * Each device is selected by the appropriate define, passed in from the
00075  * makefile.  When installing plplot you may wish to exclude devices not 
00076  * present on your system in order to reduce screen clutter.
00077  *
00078  * If you hit a <CR> in response to the plinit() prompt, you get the FIRST
00079  * one active below, so arrange them accordingly for your system (i.e. all
00080  * the system-specific ones should go first, since they won't appear on
00081  * most systems.)
00082 \*--------------------------------------------------------------------------*/
00083 
00084 static PLDispatchTable **dispatch_table = 0;
00085 static int npldrivers = 0;
00086 
00087 static PLDispatchInit static_device_initializers[] = {
00088 #ifdef PLD_mac
00089     plD_dispatch_init_mac8,
00090     plD_dispatch_init_mac1,
00091 #endif
00092 #ifdef PLD_next
00093     plD_dispatch_init_nx,
00094 #endif
00095 #ifdef PLD_os2pm
00096     plD_dispatch_init_os2,
00097 #endif
00098 #if defined(PLD_xwin) && !defined(ENABLE_DYNDRIVERS)
00099     plD_dispatch_init_xw,
00100 #endif
00101 #if defined(PLD_gnome) && !defined(ENABLE_DYNDRIVERS)
00102     plD_dispatch_init_gnome,
00103 #endif
00104 #if defined(PLD_tk) && !defined(ENABLE_DYNDRIVERS)
00105     plD_dispatch_init_tk,
00106 #endif
00107 #if defined(PLD_linuxvga) && !defined(ENABLE_DYNDRIVERS)
00108     plD_dispatch_init_vga,
00109 #endif
00110 #ifdef PLD_mgr
00111     plD_dispatch_init_mgr,
00112 #endif
00113 #ifdef PLD_win3
00114     plD_dispatch_init_win3,
00115 #endif
00116 #if defined (_MSC_VER) && defined (VGA)         /* graphics for msc */
00117     plD_dispatch_init_vga,
00118 #endif
00119 #ifdef PLD_bgi
00120     plD_dispatch_init_vga,
00121 #endif
00122 #ifdef PLD_gnusvga
00123     plD_dispatch_init_vga,
00124 #endif
00125 #ifdef PLD_tiff
00126     plD_dispatch_init_tiff,
00127 #endif
00128 #if defined(PLD_jpg)
00129     plD_dispatch_init_jpg,
00130 #endif
00131 #if defined(PLD_bmp)  && !defined(ENABLE_DYNDRIVERS)
00132     plD_dispatch_init_bmp,
00133 #endif
00134 #ifdef PLD_emxvga                  /* graphics for emx+gcc */
00135     plD_dispatch_init_vga,
00136 #endif
00137 #if defined(PLD_xterm) && !defined(ENABLE_DYNDRIVERS) 
00138     plD_dispatch_init_xterm,
00139 #endif
00140 #if defined(PLD_tek4010) && !defined(ENABLE_DYNDRIVERS) 
00141     plD_dispatch_init_tekt,
00142 #endif
00143 #if defined(PLD_tek4107) && !defined(ENABLE_DYNDRIVERS) 
00144     plD_dispatch_init_tek4107t,
00145 #endif
00146 #if defined(PLD_mskermit) && !defined(ENABLE_DYNDRIVERS) 
00147     plD_dispatch_init_mskermit,
00148 #endif
00149 #if defined(PLD_versaterm) && !defined(ENABLE_DYNDRIVERS) 
00150     plD_dispatch_init_versaterm,
00151 #endif
00152 #if defined(PLD_vlt) && !defined(ENABLE_DYNDRIVERS) 
00153     plD_dispatch_init_vlt,
00154 #endif
00155 #if defined(PLD_conex) && !defined(ENABLE_DYNDRIVERS) 
00156     plD_dispatch_init_conex,
00157 #endif
00158 #if defined(PLD_dg300) && !defined(ENABLE_DYNDRIVERS)
00159     plD_dispatch_init_dg,
00160 #endif
00161 #if defined(PLD_plmeta) && !defined(ENABLE_DYNDRIVERS)
00162     plD_dispatch_init_plm,
00163 #endif
00164 #if defined(PLD_tek4010f) && !defined(ENABLE_DYNDRIVERS) 
00165     plD_dispatch_init_tekf,
00166 #endif
00167 #if defined(PLD_tek4107f) && !defined(ENABLE_DYNDRIVERS) 
00168     plD_dispatch_init_tek4107f,
00169 #endif
00170 #if defined(PLD_ps) && !defined(ENABLE_DYNDRIVERS)
00171     plD_dispatch_init_psm,
00172     plD_dispatch_init_psc,
00173 #endif
00174 #if defined(PLD_xfig) && !defined(ENABLE_DYNDRIVERS)
00175     plD_dispatch_init_xfig,
00176 #endif
00177 #if defined(PLD_ljiip) && !defined(ENABLE_DYNDRIVERS)
00178     plD_dispatch_init_ljiip,
00179 #endif
00180 #if defined(PLD_ljii) && !defined(ENABLE_DYNDRIVERS)
00181     plD_dispatch_init_ljii,
00182 #endif
00183 #if defined( PLD_hp7470) && !defined(ENABLE_DYNDRIVERS)
00184     plD_dispatch_init_hp7470,
00185 #endif
00186 #if defined( PLD_hp7580) && !defined(ENABLE_DYNDRIVERS)
00187     plD_dispatch_init_hp7580,
00188 #endif
00189 #if defined( PLD_lj_hpgl) && !defined(ENABLE_DYNDRIVERS)
00190     plD_dispatch_init_hpgl,
00191 #endif
00192 #if defined( PLD_imp) && !defined(ENABLE_DYNDRIVERS)
00193     plD_dispatch_init_imp,
00194 #endif
00195 #if defined( PLD_pbm) && !defined(ENABLE_DYNDRIVERS)
00196     plD_dispatch_init_pbm,
00197 #endif
00198 #if defined(PLD_png) && !defined(ENABLE_DYNDRIVERS)
00199     plD_dispatch_init_png,
00200 #endif
00201 #if defined(PLD_jpeg) && !defined(ENABLE_DYNDRIVERS)
00202     //plD_dispatch_init_jpeg,
00203 #endif
00204 #if defined(PLD_pstex) && !defined(ENABLE_DYNDRIVERS)
00205     plD_dispatch_init_pstex,
00206 #endif
00207 #if defined(PLD_ntk) && !defined(ENABLE_DYNDRIVERS)
00208     plD_dispatch_init_ntk,
00209 #endif
00210 #if defined(PLD_cgm) && !defined(ENABLE_DYNDRIVERS)
00211     plD_dispatch_init_cgm,
00212 #endif
00213 #if defined(PLD_mem) && !defined(ENABLE_DYNDRIVERS)
00214      plD_dispatch_init_mem,
00215 #endif
00216 #if defined(PLD_null) && !defined(ENABLE_DYNDRIVERS)
00217     //plD_dispatch_init_null,
00218 #endif
00219 #if defined(PLD_tkwin) && !defined(ENABLE_DYNDRIVERS)
00220     plD_dispatch_init_tkwin,
00221 #endif
00222     NULL
00223 };
00224 
00225 static int nplstaticdevices = ( sizeof(static_device_initializers) /
00226                                 sizeof(PLDispatchInit) ) - 1;
00227 static int npldynamicdevices = 0;
00228 
00229 /*--------------------------------------------------------------------------*\
00230  * Stuff to support the loadable device drivers.
00231 \*--------------------------------------------------------------------------*/
00232 
00233 #ifdef ENABLE_DYNDRIVERS
00234 typedef struct {
00235     char *devnam;
00236     char *description;
00237     char *drvnam;
00238     char *tag;
00239     int drvidx;
00240 } PLLoadableDevice;
00241 
00242 typedef struct {
00243     char *drvnam;
00244     lt_dlhandle dlhand;
00245     
00246 } PLLoadableDriver;
00247 
00248 static PLLoadableDevice *loadable_device_list;
00249 static PLLoadableDriver *loadable_driver_list;
00250 #endif
00251 
00252 static int nloadabledrivers = 0;
00253 
00254 #endif /* __PLCORE_H__ */