PLplot: plcore.h Source File

PLplot 5.10.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
72 static PLINT xscl[PL_MAXPOLY], yscl[PL_MAXPOLY];
73
74 static PLINT initfont = 1; // initial font: extended by default
75
76 static PLINT lib_initialized = 0;
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
113 static PLDispatchTable **dispatch_table = 0;
114 static int npldrivers = 0;
115
116 static PLDispatchInit static_device_initializers[] = {
117 #ifdef PLD_mac
118 plD_dispatch_init_mac8,
119 plD_dispatch_init_mac1,
120 #endif
121 #ifdef PLD_next
122 plD_dispatch_init_nx,
123 #endif
124 #ifdef PLD_os2pm
125 plD_dispatch_init_os2,
126 #endif
127 #if defined ( PLD_xwin ) && !defined ( ENABLE_DYNDRIVERS )
128 plD_dispatch_init_xw,
129 #endif
130 #if defined ( PLD_gnome ) && !defined ( ENABLE_DYNDRIVERS )
131 plD_dispatch_init_gnome,
132 #endif
133 #if defined ( PLD_gcw ) && !defined ( ENABLE_DYNDRIVERS )
134 plD_dispatch_init_gcw,
135 #endif
136 #if defined ( PLD_tk ) && !defined ( ENABLE_DYNDRIVERS )
137 plD_dispatch_init_tk,
138 #endif
139 #if defined ( PLD_linuxvga ) && !defined ( ENABLE_DYNDRIVERS )
140 plD_dispatch_init_vga,
141 #endif
142 #ifdef PLD_mgr
143 plD_dispatch_init_mgr,
144 #endif
145 #ifdef PLD_win3
146 plD_dispatch_init_win3,
147 #endif
148 #if defined ( _MSC_VER ) && defined ( VGA ) // graphics for msc
149 plD_dispatch_init_vga,
150 #endif
151 #ifdef PLD_bgi
152 plD_dispatch_init_vga,
153 #endif
154 #ifdef PLD_gnusvga
155 plD_dispatch_init_vga,
156 #endif
157 #ifdef PLD_tiff
158 plD_dispatch_init_tiff,
159 #endif
160 #if defined ( PLD_jpg )
161 plD_dispatch_init_jpg,
162 #endif
163 #if defined ( PLD_bmp ) && !defined ( ENABLE_DYNDRIVERS )
164 plD_dispatch_init_bmp,
165 #endif
166 #ifdef PLD_emxvga // graphics for emx+gcc
167 plD_dispatch_init_vga,
168 #endif
169 #if defined ( PLD_xterm ) && !defined ( ENABLE_DYNDRIVERS )
170 plD_dispatch_init_xterm,
171 #endif
172 #if defined ( PLD_tek4010 ) && !defined ( ENABLE_DYNDRIVERS )
173 plD_dispatch_init_tekt,
174 #endif
175 #if defined ( PLD_tek4107 ) && !defined ( ENABLE_DYNDRIVERS )
176 plD_dispatch_init_tek4107t,
177 #endif
178 #if defined ( PLD_mskermit ) && !defined ( ENABLE_DYNDRIVERS )
179 plD_dispatch_init_mskermit,
180 #endif
181 #if defined ( PLD_versaterm ) && !defined ( ENABLE_DYNDRIVERS )
182 plD_dispatch_init_versaterm,
183 #endif
184 #if defined ( PLD_vlt ) && !defined ( ENABLE_DYNDRIVERS )
185 plD_dispatch_init_vlt,
186 #endif
187 #if defined ( PLD_conex ) && !defined ( ENABLE_DYNDRIVERS )
188 plD_dispatch_init_conex,
189 #endif
190 #if defined ( PLD_dg300 ) && !defined ( ENABLE_DYNDRIVERS )
191 plD_dispatch_init_dg,
192 #endif
193 #if defined ( PLD_plmeta ) && !defined ( ENABLE_DYNDRIVERS )
194 plD_dispatch_init_plm,
195 #endif
196 #if defined ( PLD_tek4010f ) && !defined ( ENABLE_DYNDRIVERS )
197 plD_dispatch_init_tekf,
198 #endif
199 #if defined ( PLD_tek4107f ) && !defined ( ENABLE_DYNDRIVERS )
200 plD_dispatch_init_tek4107f,
201 #endif
202 #if defined ( PLD_ps ) && !defined ( ENABLE_DYNDRIVERS )
203 plD_dispatch_init_psm,
204 plD_dispatch_init_psc,
205 #endif
206 #if defined ( PLD_xfig ) && !defined ( ENABLE_DYNDRIVERS )
207 plD_dispatch_init_xfig,
208 #endif
209 #if defined ( PLD_ljiip ) && !defined ( ENABLE_DYNDRIVERS )
210 plD_dispatch_init_ljiip,
211 #endif
212 #if defined ( PLD_ljii ) && !defined ( ENABLE_DYNDRIVERS )
213 plD_dispatch_init_ljii,
214 #endif
215 #if defined ( PLD_hp7470 ) && !defined ( ENABLE_DYNDRIVERS )
216 plD_dispatch_init_hp7470,
217 #endif
218 #if defined ( PLD_hp7580 ) && !defined ( ENABLE_DYNDRIVERS )
219 plD_dispatch_init_hp7580,
220 #endif
221 #if defined ( PLD_lj_hpgl ) && !defined ( ENABLE_DYNDRIVERS )
222 plD_dispatch_init_hpgl,
223 #endif
224 #if defined ( PLD_imp ) && !defined ( ENABLE_DYNDRIVERS )
225 plD_dispatch_init_imp,
226 #endif
227 #if defined ( PLD_pbm ) && !defined ( ENABLE_DYNDRIVERS )
228 plD_dispatch_init_pbm,
229 #endif
230 #if defined ( PLD_png ) && !defined ( ENABLE_DYNDRIVERS )
231 plD_dispatch_init_png,
232 #endif
233 #if defined ( PLD_jpeg ) && !defined ( ENABLE_DYNDRIVERS )
234 plD_dispatch_init_jpeg,
235 #endif
236 #if defined ( PLD_gif ) && !defined ( ENABLE_DYNDRIVERS )
237 plD_dispatch_init_gif,
238 #endif
239 #if defined ( PLD_pstex ) && !defined ( ENABLE_DYNDRIVERS )
240 plD_dispatch_init_pstex,
241 #endif
242 #if defined ( PLD_ntk ) && !defined ( ENABLE_DYNDRIVERS )
243 plD_dispatch_init_ntk,
244 #endif
245 #if defined ( PLD_cgm ) && !defined ( ENABLE_DYNDRIVERS )
246 plD_dispatch_init_cgm,
247 #endif
248 #if defined ( PLD_mem ) && !defined ( ENABLE_DYNDRIVERS )
249 plD_dispatch_init_mem,
250 #endif
251 #if defined ( PLD_null ) && !defined ( ENABLE_DYNDRIVERS )
252 plD_dispatch_init_null,
253 #endif
254 #if defined ( PLD_tkwin ) && !defined ( ENABLE_DYNDRIVERS )
255 plD_dispatch_init_tkwin,
256 #endif
257 #if defined ( PLD_wingcc ) && !defined ( ENABLE_DYNDRIVERS )
258 plD_dispatch_init_wingcc,
259 #endif
260 #if defined ( PLD_aqt ) && !defined ( ENABLE_DYNDRIVERS )
261 plD_dispatch_init_aqt,
262 #endif
263 #if defined ( PLD_wxwidgets ) && !defined ( ENABLE_DYNDRIVERS )
264 plD_dispatch_init_wxwidgets,
265 #endif
266 #if defined ( PLD_wxpng ) && !defined ( ENABLE_DYNDRIVERS )
267 plD_dispatch_init_wxpng,
268 #endif
269 #if defined ( PLD_svg ) && !defined ( ENABLE_DYNDRIVERS )
270 plD_dispatch_init_svg,
271 #endif
272 #if defined ( PLD_pdf ) && !defined ( ENABLE_DYNDRIVERS )
273 plD_dispatch_init_pdf,
274 #endif
275 #if defined ( PLD_psttf ) && !defined ( ENABLE_DYNDRIVERS )
276 plD_dispatch_init_psttfm,
277 plD_dispatch_init_psttfc,
278 #endif
279 #if defined ( PLD_xcairo ) && !defined ( ENABLE_DYNDRIVERS )
280 plD_dispatch_init_xcairo,
281 #endif
282 #if defined ( PLD_pdfcairo ) && !defined ( ENABLE_DYNDRIVERS )
283 plD_dispatch_init_pdfcairo,
284 #endif
285 #if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS )
286 plD_dispatch_init_pscairo,
287 #endif
288 #if defined ( PLD_epscairo ) && !defined ( ENABLE_DYNDRIVERS )
289 plD_dispatch_init_epscairo,
290 #endif
291 #if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS )
292 plD_dispatch_init_svgcairo,
293 #endif
294 #if defined ( PLD_pngcairo ) && !defined ( ENABLE_DYNDRIVERS )
295 plD_dispatch_init_pngcairo,
296 #endif
297 #if defined ( PLD_memcairo ) && !defined ( ENABLE_DYNDRIVERS )
298 plD_dispatch_init_memcairo,
299 #endif
300 #if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS )
301 plD_dispatch_init_extcairo,
302 #endif
303 #if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS )
304 plD_dispatch_init_wincairo,
305 #endif
306 #if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS )
307 plD_dispatch_init_bmpqt,
308 #endif
309 #if defined ( PLD_jpgqt ) && !defined ( ENABLE_DYNDRIVERS )
310 plD_dispatch_init_jpgqt,
311 #endif
312 #if defined ( PLD_pngqt ) && !defined ( ENABLE_DYNDRIVERS )
313 plD_dispatch_init_pngqt,
314 #endif
315 #if defined ( PLD_ppmqt ) && !defined ( ENABLE_DYNDRIVERS )
316 plD_dispatch_init_ppmqt,
317 #endif
318 #if defined ( PLD_tiffqt ) && !defined ( ENABLE_DYNDRIVERS )
319 plD_dispatch_init_tiffqt,
320 #endif
321 #if defined ( PLD_svgqt ) && !defined ( ENABLE_DYNDRIVERS )
322 plD_dispatch_init_svgqt,
323 #endif
324 #if defined ( PLD_epsqt ) && !defined ( ENABLE_DYNDRIVERS )
325 plD_dispatch_init_epsqt,
326 #endif
327 #if defined ( PLD_pdfqt ) && !defined ( ENABLE_DYNDRIVERS )
328 plD_dispatch_init_pdfqt,
329 #endif
330 #if defined ( PLD_qtwidget ) && !defined ( ENABLE_DYNDRIVERS )
331 plD_dispatch_init_qtwidget,
332 #endif
333 #if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS )
334 plD_dispatch_init_extqt,
335 #endif
336 #if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS )
337 plD_dispatch_init_memqt,
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__