PLplot: plcore.h Source File

PLplot 5.15.0

plcore.h
Go to the documentation of this file.
1 // Contains declarations for core plplot data structures. This file
2 // should be included only by plcore.c.
3 //
4 // Copyright (C) 2004 Andrew Roach
5 // Copyright (C) 2005 Thomas J. Duck
6 //
7 // This file is part of PLplot.
8 //
9 // PLplot is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU Library General Public License as published
11 // by the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // PLplot is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU Library General Public License for more details.
18 //
19 // You should have received a copy of the GNU Library General Public License
20 // along with PLplot; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 //
24
25 #ifndef __PLCORE_H__
26 #define __PLCORE_H__
27
28 #include "plplotP.h"
29 #include "drivers.h"
30 #include "plDevs.h"
31 #include "disptab.h"
32
33 #ifdef ENABLE_DYNDRIVERS
34 #ifndef LTDL_WIN32
35 #include <ltdl.h>
36 #else
37 #include "ltdl_win32.h"
38 #endif
39 typedef lt_ptr ( *PLDispatchInit )( PLDispatchTable *pdt );
40 #else
41 typedef void ( *PLDispatchInit )( PLDispatchTable *pdt );
42 #endif
43
44 #ifdef HAVE_LIBUNICODE
45 #include <unicode.h>
46 #endif
47
48
49 // Static function prototypes
50
51 static const char *utf8_to_ucs4( const char *ptr, PLUNICODE *unichar );
52 static void grline( short *, short *, PLINT );
53 static void grpolyline( short *, short *, PLINT );
54 static void grfill( short *, short *, PLINT );
55 static void grgradient( short *, short *, PLINT );
56 static void plSelectDev( void );
57 static void pldi_ini( void );
58 static void calc_diplt( void );
59 static void calc_didev( void );
60 static void calc_diori( void );
61 static void calc_dimap( void );
62 static void plgdevlst( const char **, const char **, int *, int );
63
64 static void plInitDispatchTable( void );
65
66 static void plLoadDriver( void );
67
68 // Static variables
69
70 static PLINT xscl[PL_MAXPOLY], yscl[PL_MAXPOLY];
71
72 static PLINT initfont = 1; // initial font: extended by default
73
74 static PLINT lib_initialized = 0;
75
76 //--------------------------------------------------------------------------
77 // Allocate a PLStream data structure (defined in plstrm.h).
78 //
79 // This struct contains a copy of every variable that is stream dependent.
80 // Only the first [index=0] stream is statically allocated; the rest
81 // are dynamically allocated when you switch streams (yes, it is legal
82 // to only initialize the first element of the array of pointers).
83 //--------------------------------------------------------------------------
84
85 static PLStream pls0; // preallocated stream
86 static PLINT ipls; // current stream number
87
88 static PLStream *pls[PL_NSTREAMS] = { &pls0 }; // Array of stream pointers
89
90 // Current stream pointer. Global, for easier access to state info
91
92 PLDLLIMPEXP_DATA( PLStream ) * plsc = &pls0;
93
94 // Only now can we include this
95
96 #include "pldebug.h"
97
98 //--------------------------------------------------------------------------
99 // Initialize dispatch table.
100 //
101 // Each device is selected by the appropriate define, passed in from the
102 // makefile. When installing plplot you may wish to exclude devices not
103 // present on your system in order to reduce screen clutter.
104 //
105 // If you hit a <CR> in response to the plinit() prompt, you get the FIRST
106 // one active below, so arrange them accordingly for your system (i.e. all
107 // the system-specific ones should go first, since they won't appear on
108 // most systems.)
109 //--------------------------------------------------------------------------
110
111 static PLDispatchTable **dispatch_table = 0;
112 static int npldrivers = 0;
113
114 static PLDispatchInit static_device_initializers[] = {
115 // Same order (by source filename and by device) as in drivers.h.
116 // ps and psttf are special cases where two devices are handled with
117 // one PLD macro.
118 // xwin is special case where the macro name is PLD_xwin but the
119 // function name in drivers.h is plD_dispatch_init_xw
120
121 #if defined ( PLD_aqt ) && !defined ( ENABLE_DYNDRIVERS )
122 plD_dispatch_init_aqt,
123 #endif
124 #if defined ( PLD_epscairo ) && !defined ( ENABLE_DYNDRIVERS )
125 plD_dispatch_init_epscairo,
126 #endif
127 #if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS )
128 plD_dispatch_init_extcairo,
129 #endif
130 #if defined ( PLD_memcairo ) && !defined ( ENABLE_DYNDRIVERS )
131 plD_dispatch_init_memcairo,
132 #endif
133 #if defined ( PLD_pdfcairo ) && !defined ( ENABLE_DYNDRIVERS )
134 plD_dispatch_init_pdfcairo,
135 #endif
136 #if defined ( PLD_pngcairo ) && !defined ( ENABLE_DYNDRIVERS )
137 plD_dispatch_init_pngcairo,
138 #endif
139 #if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS )
140 plD_dispatch_init_pscairo,
141 #endif
142 #if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS )
143 plD_dispatch_init_svgcairo,
144 #endif
145 #if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS )
146 plD_dispatch_init_wincairo,
147 #endif
148 #if defined ( PLD_xcairo ) && !defined ( ENABLE_DYNDRIVERS )
149 plD_dispatch_init_xcairo,
150 #endif
151 #if defined ( PLD_cgm ) && !defined ( ENABLE_DYNDRIVERS )
152 plD_dispatch_init_cgm,
153 #endif
154 #if defined ( PLD_gif ) && !defined ( ENABLE_DYNDRIVERS )
155 plD_dispatch_init_gif,
156 #endif
157 #if defined ( PLD_jpeg ) && !defined ( ENABLE_DYNDRIVERS )
158 plD_dispatch_init_jpeg,
159 #endif
160 #if defined ( PLD_png ) && !defined ( ENABLE_DYNDRIVERS )
161 plD_dispatch_init_png,
162 #endif
163 #if defined ( PLD_mem ) && !defined ( ENABLE_DYNDRIVERS )
164 plD_dispatch_init_mem,
165 #endif
166 #if defined ( PLD_ntk ) && !defined ( ENABLE_DYNDRIVERS )
167 plD_dispatch_init_ntk,
168 #endif
169 #if defined ( PLD_null ) && !defined ( ENABLE_DYNDRIVERS )
170 plD_dispatch_init_null,
171 #endif
172 #if defined ( PLD_pdf ) && !defined ( ENABLE_DYNDRIVERS )
173 plD_dispatch_init_pdf,
174 #endif
175 #if defined ( PLD_plm ) && !defined ( ENABLE_DYNDRIVERS )
176 plD_dispatch_init_plm,
177 #endif
178 #if defined ( PLD_ps ) && !defined ( ENABLE_DYNDRIVERS )
179 plD_dispatch_init_ps,
180 #endif
181 #if defined ( PLD_psc ) && !defined ( ENABLE_DYNDRIVERS )
182 plD_dispatch_init_psc,
183 #endif
184 #if defined ( PLD_pstex ) && !defined ( ENABLE_DYNDRIVERS )
185 plD_dispatch_init_pstex,
186 #endif
187 #if defined ( PLD_psttf ) && !defined ( ENABLE_DYNDRIVERS )
188 plD_dispatch_init_psttf,
189 #endif
190 #if defined ( PLD_psttfc ) && !defined ( ENABLE_DYNDRIVERS )
191 plD_dispatch_init_psttfc,
192 #endif
193 #if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS )
194 plD_dispatch_init_bmpqt,
195 #endif
196 #if defined ( PLD_epsqt ) && !defined ( ENABLE_DYNDRIVERS )
197 plD_dispatch_init_epsqt,
198 #endif
199 #if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS )
200 plD_dispatch_init_extqt,
201 #endif
202 #if defined ( PLD_jpgqt ) && !defined ( ENABLE_DYNDRIVERS )
203 plD_dispatch_init_jpgqt,
204 #endif
205 #if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS )
206 plD_dispatch_init_memqt,
207 #endif
208 #if defined ( PLD_pdfqt ) && !defined ( ENABLE_DYNDRIVERS )
209 plD_dispatch_init_pdfqt,
210 #endif
211 #if defined ( PLD_pngqt ) && !defined ( ENABLE_DYNDRIVERS )
212 plD_dispatch_init_pngqt,
213 #endif
214 #if defined ( PLD_ppmqt ) && !defined ( ENABLE_DYNDRIVERS )
215 plD_dispatch_init_ppmqt,
216 #endif
217 #if defined ( PLD_qtwidget ) && !defined ( ENABLE_DYNDRIVERS )
218 plD_dispatch_init_qtwidget,
219 #endif
220 #if defined ( PLD_svgqt ) && !defined ( ENABLE_DYNDRIVERS )
221 plD_dispatch_init_svgqt,
222 #endif
223 #if defined ( PLD_tiffqt ) && !defined ( ENABLE_DYNDRIVERS )
224 plD_dispatch_init_tiffqt,
225 #endif
226 #if defined ( PLD_svg ) && !defined ( ENABLE_DYNDRIVERS )
227 plD_dispatch_init_svg,
228 #endif
229 #if defined ( PLD_tk ) && !defined ( ENABLE_DYNDRIVERS )
230 plD_dispatch_init_tk,
231 #endif
232 #if defined ( PLD_tkwin ) && !defined ( ENABLE_DYNDRIVERS )
233 plD_dispatch_init_tkwin,
234 #endif
235 #if defined ( PLD_wingcc ) && !defined ( ENABLE_DYNDRIVERS )
236 plD_dispatch_init_wingcc,
237 #endif
238 #if defined ( PLD_wxpng ) && !defined ( ENABLE_DYNDRIVERS )
239 plD_dispatch_init_wxpng,
240 #endif
241 #if defined ( PLD_wxwidgets ) && !defined ( ENABLE_DYNDRIVERS )
242 plD_dispatch_init_wxwidgets,
243 #endif
244 #if defined ( PLD_xfig ) && !defined ( ENABLE_DYNDRIVERS )
245 plD_dispatch_init_xfig,
246 #endif
247 #if defined ( PLD_xwin ) && !defined ( ENABLE_DYNDRIVERS )
248 plD_dispatch_init_xw,
249 #endif
250 #if defined ( PLD_wingdi ) && !defined ( ENABLE_DYNDRIVERS )
251 plD_dispatch_init_wingdi,
252 #endif
253 NULL
254 };
255
256 static int nplstaticdevices = ( sizeof ( static_device_initializers ) /
257 sizeof ( PLDispatchInit ) ) - 1;
258 static int npldynamicdevices = 0;
259
260 //--------------------------------------------------------------------------
261 // Stuff to support the loadable device drivers.
262 //--------------------------------------------------------------------------
263
264 #ifdef ENABLE_DYNDRIVERS
265 typedef struct
266 {
267 char *devnam;
268 char *description;
269 char *drvnam;
270 char *tag;
271 int drvidx;
272 } PLLoadableDevice;
273
274 typedef struct
275 {
276 char *drvnam;
277 lt_dlhandle dlhand;
278 } PLLoadableDriver;
279
280 static PLLoadableDevice *loadable_device_list;
281 static PLLoadableDriver *loadable_driver_list;
282
283 static int nloadabledrivers = 0;
284
285 #endif
286
287 #endif // __PLCORE_H__
plD_dispatch_init_pscairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pscairo(PLDispatchTable *pdt)
npldynamicdevices
static int npldynamicdevices
Definition: plcore.h:258
plplotP.h
plD_dispatch_init_bmpqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_bmpqt(PLDispatchTable *pdt)
plD_dispatch_init_wxwidgets
PLDLLIMPEXP_DRIVER void plD_dispatch_init_wxwidgets(PLDispatchTable *pdt)
grpolyline
static void grpolyline(short *, short *, PLINT)
plD_dispatch_init_memqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_memqt(PLDispatchTable *pdt)
plD_dispatch_init_wincairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_wincairo(PLDispatchTable *pdt)
static_device_initializers
static PLDispatchInit static_device_initializers[]
Definition: plcore.h:114
calc_diplt
static void calc_diplt(void)
plD_dispatch_init_ppmqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_ppmqt(PLDispatchTable *pdt)
plD_dispatch_init_null
PLDLLIMPEXP_DRIVER void plD_dispatch_init_null(PLDispatchTable *pdt)
plD_dispatch_init_psc
PLDLLIMPEXP_DRIVER void plD_dispatch_init_psc(PLDispatchTable *pdt)
lib_initialized
static PLINT lib_initialized
Definition: plcore.h:74
plD_dispatch_init_xfig
PLDLLIMPEXP_DRIVER void plD_dispatch_init_xfig(PLDispatchTable *pdt)
PLUNICODE
PLUINT PLUNICODE
Definition: plplot.h:201
plD_dispatch_init_wingcc
PLDLLIMPEXP_DRIVER void plD_dispatch_init_wingcc(PLDispatchTable *pdt)
yscl
static PLINT yscl[PL_MAXPOLY]
Definition: plcore.h:70
plD_dispatch_init_aqt
void plD_dispatch_init_aqt(PLDispatchTable *pdt)
Definition: aqt.c:208
plD_dispatch_init_wxpng
PLDLLIMPEXP_DRIVER void plD_dispatch_init_wxpng(PLDispatchTable *pdt)
plD_dispatch_init_tk
PLDLLIMPEXP_DRIVER void plD_dispatch_init_tk(PLDispatchTable *pdt)
ipls
static PLINT ipls
Definition: plcore.h:86
plD_dispatch_init_pngcairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngcairo(PLDispatchTable *pdt)
plD_dispatch_init_ps
PLDLLIMPEXP_DRIVER void plD_dispatch_init_ps(PLDispatchTable *pdt)
PLDLLIMPEXP_DATA
PLDLLIMPEXP_DATA(PLStream) *plsc
plD_dispatch_init_extcairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_extcairo(PLDispatchTable *pdt)
nplstaticdevices
static int nplstaticdevices
Definition: plcore.h:256
PLINT
int PLINT
Definition: plplot.h:181
plD_dispatch_init_extqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_extqt(PLDispatchTable *pdt)
plgdevlst
static void plgdevlst(const char **, const char **, int *, int)
ltdl_win32.h
plD_dispatch_init_gif
PLDLLIMPEXP_DRIVER void plD_dispatch_init_gif(PLDispatchTable *pdt)
plD_dispatch_init_svgcairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_svgcairo(PLDispatchTable *pdt)
PLDispatchInit
void(* PLDispatchInit)(PLDispatchTable *pdt)
Definition: plcore.h:41
plSelectDev
static void plSelectDev(void)
dispatch_table
static PLDispatchTable ** dispatch_table
Definition: plcore.h:111
plD_dispatch_init_svg
void plD_dispatch_init_svg(PLDispatchTable *pdt)
Definition: svg.c:129
PLDispatchTable
Definition: disptab.h:77
plD_dispatch_init_tiffqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_tiffqt(PLDispatchTable *pdt)
grgradient
static void grgradient(short *, short *, PLINT)
plD_dispatch_init_png
PLDLLIMPEXP_DRIVER void plD_dispatch_init_png(PLDispatchTable *pdt)
plD_dispatch_init_tkwin
PLDLLIMPEXP_DRIVER void plD_dispatch_init_tkwin(PLDispatchTable *pdt)
grline
static void grline(short *, short *, PLINT)
plD_dispatch_init_psttf
PLDLLIMPEXP_DRIVER void plD_dispatch_init_psttf(PLDispatchTable *pdt)
plD_dispatch_init_pdfcairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdfcairo(PLDispatchTable *pdt)
utf8_to_ucs4
static const char * utf8_to_ucs4(const char *ptr, PLUNICODE *unichar)
plD_dispatch_init_ntk
PLDLLIMPEXP_DRIVER void plD_dispatch_init_ntk(PLDispatchTable *pdt)
drivers.h
plD_dispatch_init_pdf
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdf(PLDispatchTable *pdt)
plDevs.h
plInitDispatchTable
static void plInitDispatchTable(void)
pls
static PLStream * pls[PL_NSTREAMS]
Definition: plcore.h:88
plLoadDriver
static void plLoadDriver(void)
plD_dispatch_init_pstex
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pstex(PLDispatchTable *pdt)
grfill
static void grfill(short *, short *, PLINT)
plD_dispatch_init_xw
PLDLLIMPEXP_DRIVER void plD_dispatch_init_xw(PLDispatchTable *pdt)
PLStream
Definition: plstrm.h:523
pldebug.h
plD_dispatch_init_xcairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_xcairo(PLDispatchTable *pdt)
plD_dispatch_init_epscairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_epscairo(PLDispatchTable *pdt)
plD_dispatch_init_cgm
PLDLLIMPEXP_DRIVER void plD_dispatch_init_cgm(PLDispatchTable *pdt)
plD_dispatch_init_pdfqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdfqt(PLDispatchTable *pdt)
plD_dispatch_init_memcairo
PLDLLIMPEXP_DRIVER void plD_dispatch_init_memcairo(PLDispatchTable *pdt)
pls0
static PLStream pls0
Definition: plcore.h:85
plD_dispatch_init_plm
PLDLLIMPEXP_DRIVER void plD_dispatch_init_plm(PLDispatchTable *pdt)
xscl
static PLINT xscl[PL_MAXPOLY]
Definition: plcore.h:70
plD_dispatch_init_wingdi
PLDLLIMPEXP_DRIVER void plD_dispatch_init_wingdi(PLDispatchTable *pdt)
initfont
static PLINT initfont
Definition: plcore.h:72
PL_NSTREAMS
#define PL_NSTREAMS
Definition: plplotP.h:284
plD_dispatch_init_epsqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_epsqt(PLDispatchTable *pdt)
lt_ptr
void lt_ptr
Definition: ltdl_win32.h:35
plD_dispatch_init_qtwidget
PLDLLIMPEXP_DRIVER void plD_dispatch_init_qtwidget(PLDispatchTable *pdt)
npldrivers
static int npldrivers
Definition: plcore.h:112
plD_dispatch_init_jpgqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_jpgqt(PLDispatchTable *pdt)
plD_dispatch_init_svgqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_svgqt(PLDispatchTable *pdt)
plD_dispatch_init_psttfc
PLDLLIMPEXP_DRIVER void plD_dispatch_init_psttfc(PLDispatchTable *pdt)
pldi_ini
static void pldi_ini(void)
plD_dispatch_init_jpeg
PLDLLIMPEXP_DRIVER void plD_dispatch_init_jpeg(PLDispatchTable *pdt)
calc_dimap
static void calc_dimap(void)
calc_diori
static void calc_diori(void)
plD_dispatch_init_pngqt
PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngqt(PLDispatchTable *pdt)
calc_didev
static void calc_didev(void)
PL_MAXPOLY
#define PL_MAXPOLY
Definition: plplotP.h:283
disptab.h
plD_dispatch_init_mem
PLDLLIMPEXP_DRIVER void plD_dispatch_init_mem(PLDispatchTable *pdt)
__dlhandle
Definition: ltdl_win32.h:29