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