PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plcore.h
Go to the documentation of this file.
1 // $Id: plcore.h 12275 2012-11-17 22:49:34Z hbabcock $
2 //
3 // Contains declarations for core plplot data structures. This file
4 // should be included only by plcore.c.
5 //
6 // Copyright (C) 2004 Andrew Roach
7 // Copyright (C) 2005 Thomas J. Duck
8 //
9 // This file is part of PLplot.
10 //
11 // PLplot is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published
13 // by the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
15 //
16 // PLplot is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with PLplot; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 //
25 //
26 
27 #ifndef __PLCORE_H__
28 #define __PLCORE_H__
29 
30 #include "plplotP.h"
31 #include "drivers.h"
32 #include "plDevs.h"
33 #include "disptab.h"
34 
35 #ifdef ENABLE_DYNDRIVERS
36  #ifndef LTDL_WIN32
37  #include <ltdl.h>
38  #else
39  #include "ltdl_win32.h"
40  #endif
41 typedef lt_ptr ( *PLDispatchInit )( PLDispatchTable *pdt );
42 #else
43 typedef void ( *PLDispatchInit )( PLDispatchTable *pdt );
44 #endif
45 
46 #ifdef HAVE_LIBUNICODE
47 #include <unicode.h>
48 #endif
49 
50 
51 // Static function prototypes
52 
53 static const char *utf8_to_ucs4( const char *ptr, PLUNICODE *unichar );
54 static void grline( short *, short *, PLINT );
55 static void grpolyline( short *, short *, PLINT );
56 static void grfill( short *, short *, PLINT );
57 static void grgradient( short *, short *, PLINT );
58 static void plSelectDev( void );
59 static void pldi_ini( void );
60 static void calc_diplt( void );
61 static void calc_didev( void );
62 static void calc_diori( void );
63 static void calc_dimap( void );
64 static void plgdevlst( const char **, const char **, int *, int );
65 
66 static void plInitDispatchTable( void );
67 
68 static void plLoadDriver( void );
69 
70 // Static variables
71 
73 
74 static PLINT initfont = 1; // initial font: extended by default
75 
77 
78 //--------------------------------------------------------------------------
79 // Allocate a PLStream data structure (defined in plstrm.h).
80 //
81 // This struct contains a copy of every variable that is stream dependent.
82 // Only the first [index=0] stream is statically allocated; the rest
83 // are dynamically allocated when you switch streams (yes, it is legal
84 // to only initialize the first element of the array of pointers).
85 //--------------------------------------------------------------------------
86 
87 static PLStream pls0; // preallocated stream
88 static PLINT ipls; // current stream number
89 
90 static PLStream *pls[PL_NSTREAMS] = { &pls0 }; // Array of stream pointers
91 
92 // Current stream pointer. Global, for easier access to state info
93 
94 PLDLLIMPEXP_DATA( PLStream ) * plsc = &pls0;
95 
96 // Only now can we include this
97 
98 #include "pldebug.h"
99 
100 //--------------------------------------------------------------------------
101 // Initialize dispatch table.
102 //
103 // Each device is selected by the appropriate define, passed in from the
104 // makefile. When installing plplot you may wish to exclude devices not
105 // present on your system in order to reduce screen clutter.
106 //
107 // If you hit a <CR> in response to the plinit() prompt, you get the FIRST
108 // one active below, so arrange them accordingly for your system (i.e. all
109 // the system-specific ones should go first, since they won't appear on
110 // most systems.)
111 //--------------------------------------------------------------------------
112 
114 static int npldrivers = 0;
115 
117 #ifdef PLD_mac
120 #endif
121 #ifdef PLD_next
123 #endif
124 #ifdef PLD_os2pm
126 #endif
127 #if defined ( PLD_xwin ) && !defined ( ENABLE_DYNDRIVERS )
129 #endif
130 #if defined ( PLD_gnome ) && !defined ( ENABLE_DYNDRIVERS )
132 #endif
133 #if defined ( PLD_gcw ) && !defined ( ENABLE_DYNDRIVERS )
135 #endif
136 #if defined ( PLD_tk ) && !defined ( ENABLE_DYNDRIVERS )
138 #endif
139 #if defined ( PLD_linuxvga ) && !defined ( ENABLE_DYNDRIVERS )
141 #endif
142 #ifdef PLD_mgr
144 #endif
145 #ifdef PLD_win3
147 #endif
148 #if defined ( _MSC_VER ) && defined ( VGA ) // graphics for msc
150 #endif
151 #ifdef PLD_bgi
153 #endif
154 #ifdef PLD_gnusvga
156 #endif
157 #ifdef PLD_tiff
159 #endif
160 #if defined ( PLD_jpg )
162 #endif
163 #if defined ( PLD_bmp ) && !defined ( ENABLE_DYNDRIVERS )
165 #endif
166 #ifdef PLD_emxvga // graphics for emx+gcc
168 #endif
169 #if defined ( PLD_xterm ) && !defined ( ENABLE_DYNDRIVERS )
171 #endif
172 #if defined ( PLD_tek4010 ) && !defined ( ENABLE_DYNDRIVERS )
174 #endif
175 #if defined ( PLD_tek4107 ) && !defined ( ENABLE_DYNDRIVERS )
177 #endif
178 #if defined ( PLD_mskermit ) && !defined ( ENABLE_DYNDRIVERS )
180 #endif
181 #if defined ( PLD_versaterm ) && !defined ( ENABLE_DYNDRIVERS )
183 #endif
184 #if defined ( PLD_vlt ) && !defined ( ENABLE_DYNDRIVERS )
186 #endif
187 #if defined ( PLD_conex ) && !defined ( ENABLE_DYNDRIVERS )
189 #endif
190 #if defined ( PLD_dg300 ) && !defined ( ENABLE_DYNDRIVERS )
192 #endif
193 #if defined ( PLD_plmeta ) && !defined ( ENABLE_DYNDRIVERS )
195 #endif
196 #if defined ( PLD_tek4010f ) && !defined ( ENABLE_DYNDRIVERS )
198 #endif
199 #if defined ( PLD_tek4107f ) && !defined ( ENABLE_DYNDRIVERS )
201 #endif
202 #if defined ( PLD_ps ) && !defined ( ENABLE_DYNDRIVERS )
205 #endif
206 #if defined ( PLD_xfig ) && !defined ( ENABLE_DYNDRIVERS )
208 #endif
209 #if defined ( PLD_ljiip ) && !defined ( ENABLE_DYNDRIVERS )
211 #endif
212 #if defined ( PLD_ljii ) && !defined ( ENABLE_DYNDRIVERS )
214 #endif
215 #if defined ( PLD_hp7470 ) && !defined ( ENABLE_DYNDRIVERS )
217 #endif
218 #if defined ( PLD_hp7580 ) && !defined ( ENABLE_DYNDRIVERS )
220 #endif
221 #if defined ( PLD_lj_hpgl ) && !defined ( ENABLE_DYNDRIVERS )
223 #endif
224 #if defined ( PLD_imp ) && !defined ( ENABLE_DYNDRIVERS )
226 #endif
227 #if defined ( PLD_pbm ) && !defined ( ENABLE_DYNDRIVERS )
229 #endif
230 #if defined ( PLD_png ) && !defined ( ENABLE_DYNDRIVERS )
232 #endif
233 #if defined ( PLD_jpeg ) && !defined ( ENABLE_DYNDRIVERS )
235 #endif
236 #if defined ( PLD_gif ) && !defined ( ENABLE_DYNDRIVERS )
238 #endif
239 #if defined ( PLD_pstex ) && !defined ( ENABLE_DYNDRIVERS )
241 #endif
242 #if defined ( PLD_ntk ) && !defined ( ENABLE_DYNDRIVERS )
244 #endif
245 #if defined ( PLD_cgm ) && !defined ( ENABLE_DYNDRIVERS )
247 #endif
248 #if defined ( PLD_mem ) && !defined ( ENABLE_DYNDRIVERS )
250 #endif
251 #if defined ( PLD_null ) && !defined ( ENABLE_DYNDRIVERS )
253 #endif
254 #if defined ( PLD_tkwin ) && !defined ( ENABLE_DYNDRIVERS )
256 #endif
257 #if defined ( PLD_wingcc ) && !defined ( ENABLE_DYNDRIVERS )
259 #endif
260 #if defined ( PLD_aqt ) && !defined ( ENABLE_DYNDRIVERS )
262 #endif
263 #if defined ( PLD_wxwidgets ) && !defined ( ENABLE_DYNDRIVERS )
265 #endif
266 #if defined ( PLD_wxpng ) && !defined ( ENABLE_DYNDRIVERS )
268 #endif
269 #if defined ( PLD_svg ) && !defined ( ENABLE_DYNDRIVERS )
271 #endif
272 #if defined ( PLD_pdf ) && !defined ( ENABLE_DYNDRIVERS )
274 #endif
275 #if defined ( PLD_psttf ) && !defined ( ENABLE_DYNDRIVERS )
278 #endif
279 #if defined ( PLD_xcairo ) && !defined ( ENABLE_DYNDRIVERS )
281 #endif
282 #if defined ( PLD_pdfcairo ) && !defined ( ENABLE_DYNDRIVERS )
284 #endif
285 #if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS )
287 #endif
288 #if defined ( PLD_epscairo ) && !defined ( ENABLE_DYNDRIVERS )
290 #endif
291 #if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS )
293 #endif
294 #if defined ( PLD_pngcairo ) && !defined ( ENABLE_DYNDRIVERS )
296 #endif
297 #if defined ( PLD_memcairo ) && !defined ( ENABLE_DYNDRIVERS )
299 #endif
300 #if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS )
302 #endif
303 #if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS )
305 #endif
306 #if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS )
308 #endif
309 #if defined ( PLD_jpgqt ) && !defined ( ENABLE_DYNDRIVERS )
311 #endif
312 #if defined ( PLD_pngqt ) && !defined ( ENABLE_DYNDRIVERS )
314 #endif
315 #if defined ( PLD_ppmqt ) && !defined ( ENABLE_DYNDRIVERS )
317 #endif
318 #if defined ( PLD_tiffqt ) && !defined ( ENABLE_DYNDRIVERS )
320 #endif
321 #if defined ( PLD_svgqt ) && !defined ( ENABLE_DYNDRIVERS )
323 #endif
324 #if defined ( PLD_epsqt ) && !defined ( ENABLE_DYNDRIVERS )
326 #endif
327 #if defined ( PLD_pdfqt ) && !defined ( ENABLE_DYNDRIVERS )
329 #endif
330 #if defined ( PLD_qtwidget ) && !defined ( ENABLE_DYNDRIVERS )
332 #endif
333 #if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS )
335 #endif
336 #if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS )
338 #endif
339  NULL
340 };
341 
342 static int nplstaticdevices = ( sizeof ( static_device_initializers ) /
343  sizeof ( PLDispatchInit ) ) - 1;
344 static int npldynamicdevices = 0;
345 
346 //--------------------------------------------------------------------------
347 // Stuff to support the loadable device drivers.
348 //--------------------------------------------------------------------------
349 
350 #ifdef ENABLE_DYNDRIVERS
351 typedef struct
352 {
353  char *devnam;
354  char *description;
355  char *drvnam;
356  char *tag;
357  int drvidx;
358 } PLLoadableDevice;
359 
360 typedef struct
361 {
362  char *drvnam;
363  lt_dlhandle dlhand;
364 } PLLoadableDriver;
365 
366 static PLLoadableDevice *loadable_device_list;
367 static PLLoadableDriver *loadable_driver_list;
368 
369 static int nloadabledrivers = 0;
370 
371 #endif
372 
373 #endif // __PLCORE_H__