• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

plcore.h

Go to the documentation of this file.
00001 // $Id: plcore.h 11269 2010-10-22 00:25:36Z airwin $
00002 //
00003 //      Contains declarations for core plplot data structures.  This file
00004 //      should be included only by plcore.c.
00005 //
00006 //  Copyright (C) 2004  Andrew Roach
00007 //  Copyright (C) 2005  Thomas J. Duck
00008 //
00009 //  This file is part of PLplot.
00010 //
00011 //  PLplot is free software; you can redistribute it and/or modify
00012 //  it under the terms of the GNU Library General Public License as published
00013 //  by the Free Software Foundation; either version 2 of the License, or
00014 //  (at your option) any later version.
00015 //
00016 //  PLplot is distributed in the hope that it will be useful,
00017 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 //  GNU Library General Public License for more details.
00020 //
00021 //  You should have received a copy of the GNU Library General Public License
00022 //  along with PLplot; if not, write to the Free Software
00023 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00024 //
00025 //
00026 
00027 #ifndef __PLCORE_H__
00028 #define __PLCORE_H__
00029 
00030 #include "plplotP.h"
00031 #include "drivers.h"
00032 #include "plDevs.h"
00033 #include "disptab.h"
00034 
00035 #ifdef ENABLE_DYNDRIVERS
00036   #ifndef LTDL_WIN32
00037     #include <ltdl.h>
00038   #else
00039     #include "ltdl_win32.h"
00040   #endif
00041 typedef lt_ptr ( *PLDispatchInit )( PLDispatchTable *pdt );
00042 #else
00043 typedef void ( *PLDispatchInit )( PLDispatchTable *pdt );
00044 #endif
00045 
00046 #ifdef HAVE_LIBUNICODE
00047 #include <unicode.h>
00048 #endif
00049 
00050 
00051 // Static function prototypes
00052 
00053 static char     *utf8_to_ucs4( const char *ptr, PLUNICODE *unichar );
00054 static void     grline( short *, short *, PLINT );
00055 static void     grpolyline( short *, short *, PLINT );
00056 static void     grfill( short *, short *, PLINT );
00057 static void     grgradient( short *, short *, PLINT );
00058 static void     plSelectDev( void );
00059 static void     pldi_ini( void );
00060 static void     calc_diplt( void );
00061 static void     calc_didev( void );
00062 static void     calc_diori( void );
00063 static void     calc_dimap( void );
00064 static void     plgdevlst( const char **, const char **, int *, int );
00065 
00066 static void     plInitDispatchTable( void );
00067 
00068 static void     plLoadDriver( void );
00069 
00070 // Static variables
00071 
00072 static PLINT xscl[PL_MAXPOLY], yscl[PL_MAXPOLY];
00073 
00074 static PLINT initfont = 1;      // initial font: extended by default
00075 
00076 static PLINT lib_initialized = 0;
00077 
00078 //--------------------------------------------------------------------------
00079 // Allocate a PLStream data structure (defined in plstrm.h).
00080 //
00081 // This struct contains a copy of every variable that is stream dependent.
00082 // Only the first [index=0] stream is statically allocated; the rest
00083 // are dynamically allocated when you switch streams (yes, it is legal
00084 // to only initialize the first element of the array of pointers).
00085 //--------------------------------------------------------------------------
00086 
00087 static PLStream pls0;                             // preallocated stream
00088 static PLINT    ipls;                             // current stream number
00089 
00090 static PLStream *pls[PL_NSTREAMS] = { &pls0 };    // Array of stream pointers
00091 
00092 // Current stream pointer.  Global, for easier access to state info
00093 
00094 PLDLLIMPEXP_DATA( PLStream ) * plsc = &pls0;
00095 
00096 // Only now can we include this
00097 
00098 #include "pldebug.h"
00099 
00100 //--------------------------------------------------------------------------
00101 // Initialize dispatch table.
00102 //
00103 // Each device is selected by the appropriate define, passed in from the
00104 // makefile.  When installing plplot you may wish to exclude devices not
00105 // present on your system in order to reduce screen clutter.
00106 //
00107 // If you hit a <CR> in response to the plinit() prompt, you get the FIRST
00108 // one active below, so arrange them accordingly for your system (i.e. all
00109 // the system-specific ones should go first, since they won't appear on
00110 // most systems.)
00111 //--------------------------------------------------------------------------
00112 
00113 static PLDispatchTable **dispatch_table = 0;
00114 static int             npldrivers       = 0;
00115 
00116 static PLDispatchInit  static_device_initializers[] = {
00117 #ifdef PLD_mac
00118     plD_dispatch_init_mac8,
00119     plD_dispatch_init_mac1,
00120 #endif
00121 #ifdef PLD_next
00122     plD_dispatch_init_nx,
00123 #endif
00124 #ifdef PLD_os2pm
00125     plD_dispatch_init_os2,
00126 #endif
00127 #if defined ( PLD_xwin ) && !defined ( ENABLE_DYNDRIVERS )
00128     plD_dispatch_init_xw,
00129 #endif
00130 #if defined ( PLD_gnome ) && !defined ( ENABLE_DYNDRIVERS )
00131     plD_dispatch_init_gnome,
00132 #endif
00133 #if defined ( PLD_gcw ) && !defined ( ENABLE_DYNDRIVERS )
00134     plD_dispatch_init_gcw,
00135 #endif
00136 #if defined ( PLD_tk ) && !defined ( ENABLE_DYNDRIVERS )
00137     plD_dispatch_init_tk,
00138 #endif
00139 #if defined ( PLD_linuxvga ) && !defined ( ENABLE_DYNDRIVERS )
00140     plD_dispatch_init_vga,
00141 #endif
00142 #ifdef PLD_mgr
00143     plD_dispatch_init_mgr,
00144 #endif
00145 #ifdef PLD_win3
00146     plD_dispatch_init_win3,
00147 #endif
00148 #if defined ( _MSC_VER ) && defined ( VGA )         // graphics for msc
00149     plD_dispatch_init_vga,
00150 #endif
00151 #ifdef PLD_bgi
00152     plD_dispatch_init_vga,
00153 #endif
00154 #ifdef PLD_gnusvga
00155     plD_dispatch_init_vga,
00156 #endif
00157 #ifdef PLD_tiff
00158     plD_dispatch_init_tiff,
00159 #endif
00160 #if defined ( PLD_jpg )
00161     plD_dispatch_init_jpg,
00162 #endif
00163 #if defined ( PLD_bmp ) && !defined ( ENABLE_DYNDRIVERS )
00164     plD_dispatch_init_bmp,
00165 #endif
00166 #ifdef PLD_emxvga                      // graphics for emx+gcc
00167     plD_dispatch_init_vga,
00168 #endif
00169 #if defined ( PLD_xterm ) && !defined ( ENABLE_DYNDRIVERS )
00170     plD_dispatch_init_xterm,
00171 #endif
00172 #if defined ( PLD_tek4010 ) && !defined ( ENABLE_DYNDRIVERS )
00173     plD_dispatch_init_tekt,
00174 #endif
00175 #if defined ( PLD_tek4107 ) && !defined ( ENABLE_DYNDRIVERS )
00176     plD_dispatch_init_tek4107t,
00177 #endif
00178 #if defined ( PLD_mskermit ) && !defined ( ENABLE_DYNDRIVERS )
00179     plD_dispatch_init_mskermit,
00180 #endif
00181 #if defined ( PLD_versaterm ) && !defined ( ENABLE_DYNDRIVERS )
00182     plD_dispatch_init_versaterm,
00183 #endif
00184 #if defined ( PLD_vlt ) && !defined ( ENABLE_DYNDRIVERS )
00185     plD_dispatch_init_vlt,
00186 #endif
00187 #if defined ( PLD_conex ) && !defined ( ENABLE_DYNDRIVERS )
00188     plD_dispatch_init_conex,
00189 #endif
00190 #if defined ( PLD_dg300 ) && !defined ( ENABLE_DYNDRIVERS )
00191     plD_dispatch_init_dg,
00192 #endif
00193 #if defined ( PLD_plmeta ) && !defined ( ENABLE_DYNDRIVERS )
00194     plD_dispatch_init_plm,
00195 #endif
00196 #if defined ( PLD_tek4010f ) && !defined ( ENABLE_DYNDRIVERS )
00197     plD_dispatch_init_tekf,
00198 #endif
00199 #if defined ( PLD_tek4107f ) && !defined ( ENABLE_DYNDRIVERS )
00200     plD_dispatch_init_tek4107f,
00201 #endif
00202 #if defined ( PLD_ps ) && !defined ( ENABLE_DYNDRIVERS )
00203     plD_dispatch_init_psm,
00204     plD_dispatch_init_psc,
00205 #endif
00206 #if defined ( PLD_xfig ) && !defined ( ENABLE_DYNDRIVERS )
00207     plD_dispatch_init_xfig,
00208 #endif
00209 #if defined ( PLD_ljiip ) && !defined ( ENABLE_DYNDRIVERS )
00210     plD_dispatch_init_ljiip,
00211 #endif
00212 #if defined ( PLD_ljii ) && !defined ( ENABLE_DYNDRIVERS )
00213     plD_dispatch_init_ljii,
00214 #endif
00215 #if defined ( PLD_hp7470 ) && !defined ( ENABLE_DYNDRIVERS )
00216     plD_dispatch_init_hp7470,
00217 #endif
00218 #if defined ( PLD_hp7580 ) && !defined ( ENABLE_DYNDRIVERS )
00219     plD_dispatch_init_hp7580,
00220 #endif
00221 #if defined ( PLD_lj_hpgl ) && !defined ( ENABLE_DYNDRIVERS )
00222     plD_dispatch_init_hpgl,
00223 #endif
00224 #if defined ( PLD_imp ) && !defined ( ENABLE_DYNDRIVERS )
00225     plD_dispatch_init_imp,
00226 #endif
00227 #if defined ( PLD_pbm ) && !defined ( ENABLE_DYNDRIVERS )
00228     plD_dispatch_init_pbm,
00229 #endif
00230 #if defined ( PLD_png ) && !defined ( ENABLE_DYNDRIVERS )
00231     plD_dispatch_init_png,
00232 #endif
00233 #if defined ( PLD_jpeg ) && !defined ( ENABLE_DYNDRIVERS )
00234     plD_dispatch_init_jpeg,
00235 #endif
00236 #if defined ( PLD_gif ) && !defined ( ENABLE_DYNDRIVERS )
00237     plD_dispatch_init_gif,
00238 #endif
00239 #if defined ( PLD_pstex ) && !defined ( ENABLE_DYNDRIVERS )
00240     plD_dispatch_init_pstex,
00241 #endif
00242 #if defined ( PLD_ntk ) && !defined ( ENABLE_DYNDRIVERS )
00243     plD_dispatch_init_ntk,
00244 #endif
00245 #if defined ( PLD_cgm ) && !defined ( ENABLE_DYNDRIVERS )
00246     plD_dispatch_init_cgm,
00247 #endif
00248 #if defined ( PLD_mem ) && !defined ( ENABLE_DYNDRIVERS )
00249     plD_dispatch_init_mem,
00250 #endif
00251 #if defined ( PLD_null ) && !defined ( ENABLE_DYNDRIVERS )
00252     plD_dispatch_init_null,
00253 #endif
00254 #if defined ( PLD_tkwin ) && !defined ( ENABLE_DYNDRIVERS )
00255     plD_dispatch_init_tkwin,
00256 #endif
00257 #if defined ( PLD_wingcc ) && !defined ( ENABLE_DYNDRIVERS )
00258     plD_dispatch_init_wingcc,
00259 #endif
00260 #if defined ( PLD_aqt ) && !defined ( ENABLE_DYNDRIVERS )
00261     plD_dispatch_init_aqt,
00262 #endif
00263 #if defined ( PLD_wxwidgets ) && !defined ( ENABLE_DYNDRIVERS )
00264     plD_dispatch_init_wxwidgets,
00265 #endif
00266 #if defined ( PLD_wxpng ) && !defined ( ENABLE_DYNDRIVERS )
00267     plD_dispatch_init_wxpng,
00268 #endif
00269 #if defined ( PLD_svg ) && !defined ( ENABLE_DYNDRIVERS )
00270     plD_dispatch_init_svg,
00271 #endif
00272 #if defined ( PLD_pdf ) && !defined ( ENABLE_DYNDRIVERS )
00273     plD_dispatch_init_pdf,
00274 #endif
00275 #if defined ( PLD_psttf ) && !defined ( ENABLE_DYNDRIVERS )
00276     plD_dispatch_init_psttfm,
00277     plD_dispatch_init_psttfc,
00278 #endif
00279 #if defined ( PLD_xcairo ) && !defined ( ENABLE_DYNDRIVERS )
00280     plD_dispatch_init_xcairo,
00281 #endif
00282 #if defined ( PLD_pdfcairo ) && !defined ( ENABLE_DYNDRIVERS )
00283     plD_dispatch_init_pdfcairo,
00284 #endif
00285 #if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS )
00286     plD_dispatch_init_pscairo,
00287 #endif
00288 #if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS )
00289     plD_dispatch_init_svgcairo,
00290 #endif
00291 #if defined ( PLD_pngcairo ) && !defined ( ENABLE_DYNDRIVERS )
00292     plD_dispatch_init_pngcairo,
00293 #endif
00294 #if defined ( PLD_memcairo ) && !defined ( ENABLE_DYNDRIVERS )
00295     plD_dispatch_init_memcairo,
00296 #endif
00297 #if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS )
00298     plD_dispatch_init_extcairo,
00299 #endif
00300 #if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS )
00301     plD_dispatch_init_wincairo,
00302 #endif
00303 #if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS )
00304     plD_dispatch_init_bmpqt,
00305 #endif
00306 #if defined ( PLD_jpgqt ) && !defined ( ENABLE_DYNDRIVERS )
00307     plD_dispatch_init_jpgqt,
00308 #endif
00309 #if defined ( PLD_pngqt ) && !defined ( ENABLE_DYNDRIVERS )
00310     plD_dispatch_init_pngqt,
00311 #endif
00312 #if defined ( PLD_ppmqt ) && !defined ( ENABLE_DYNDRIVERS )
00313     plD_dispatch_init_ppmqt,
00314 #endif
00315 #if defined ( PLD_tiffqt ) && !defined ( ENABLE_DYNDRIVERS )
00316     plD_dispatch_init_tiffqt,
00317 #endif
00318 #if defined ( PLD_svgqt ) && !defined ( ENABLE_DYNDRIVERS )
00319     plD_dispatch_init_svgqt,
00320 #endif
00321 #if defined ( PLD_epsqt ) && !defined ( ENABLE_DYNDRIVERS )
00322     plD_dispatch_init_epsqt,
00323 #endif
00324 #if defined ( PLD_pdfqt ) && !defined ( ENABLE_DYNDRIVERS )
00325     plD_dispatch_init_pdfqt,
00326 #endif
00327 #if defined ( PLD_qtwidget ) && !defined ( ENABLE_DYNDRIVERS )
00328     plD_dispatch_init_qtwidget,
00329 #endif
00330 #if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS )
00331     plD_dispatch_init_extqt,
00332 #endif
00333 #if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS )
00334     plD_dispatch_init_memqt,
00335 #endif
00336     NULL
00337 };
00338 
00339 static int             nplstaticdevices = ( sizeof ( static_device_initializers ) /
00340                                             sizeof ( PLDispatchInit ) ) - 1;
00341 static int             npldynamicdevices = 0;
00342 
00343 //--------------------------------------------------------------------------
00344 // Stuff to support the loadable device drivers.
00345 //--------------------------------------------------------------------------
00346 
00347 #ifdef ENABLE_DYNDRIVERS
00348 typedef struct
00349 {
00350     char *devnam;
00351     char *description;
00352     char *drvnam;
00353     char *tag;
00354     int  drvidx;
00355 } PLLoadableDevice;
00356 
00357 typedef struct
00358 {
00359     char        *drvnam;
00360     lt_dlhandle dlhand;
00361 } PLLoadableDriver;
00362 
00363 static PLLoadableDevice *loadable_device_list;
00364 static PLLoadableDriver *loadable_driver_list;
00365 #endif
00366 
00367 static int nloadabledrivers = 0;
00368 
00369 #endif  // __PLCORE_H__

Generated on Wed Oct 12 2011 20:42:22 for PLplot by  doxygen 1.7.1