File: plcore.h

package info (click to toggle)
plplot 5.14.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 30,424 kB
  • sloc: ansic: 79,613; xml: 28,583; cpp: 20,037; ada: 19,456; tcl: 12,081; f90: 11,423; ml: 7,276; java: 6,863; python: 6,792; sh: 3,185; perl: 828; lisp: 75; makefile: 48; sed: 33; fortran: 5
file content (287 lines) | stat: -rw-r--r-- 9,285 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
//      Contains declarations for core plplot data structures.  This file
//      should be included only by plcore.c.
//
//  Copyright (C) 2004  Andrew Roach
//  Copyright (C) 2005  Thomas J. Duck
//
//  This file is part of PLplot.
//
//  PLplot is free software; you can redistribute it and/or modify
//  it under the terms of the GNU Library General Public License as published
//  by the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  PLplot is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Library General Public License for more details.
//
//  You should have received a copy of the GNU Library General Public License
//  along with PLplot; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
//

#ifndef __PLCORE_H__
#define __PLCORE_H__

#include "plplotP.h"
#include "drivers.h"
#include "plDevs.h"
#include "disptab.h"

#ifdef ENABLE_DYNDRIVERS
  #ifndef LTDL_WIN32
    #include <ltdl.h>
  #else
    #include "ltdl_win32.h"
  #endif
typedef lt_ptr ( *PLDispatchInit )( PLDispatchTable *pdt );
#else
typedef void ( *PLDispatchInit )( PLDispatchTable *pdt );
#endif

#ifdef HAVE_LIBUNICODE
#include <unicode.h>
#endif


// Static function prototypes

static const char     *utf8_to_ucs4( const char *ptr, PLUNICODE *unichar );
static void     grline( short *, short *, PLINT );
static void     grpolyline( short *, short *, PLINT );
static void     grfill( short *, short *, PLINT );
static void     grgradient( short *, short *, PLINT );
static void     plSelectDev( void );
static void     pldi_ini( void );
static void     calc_diplt( void );
static void     calc_didev( void );
static void     calc_diori( void );
static void     calc_dimap( void );
static void     plgdevlst( const char **, const char **, int *, int );

static void     plInitDispatchTable( void );

static void     plLoadDriver( void );

// Static variables

static PLINT xscl[PL_MAXPOLY], yscl[PL_MAXPOLY];

static PLINT initfont = 1;      // initial font: extended by default

static PLINT lib_initialized = 0;

//--------------------------------------------------------------------------
// Allocate a PLStream data structure (defined in plstrm.h).
//
// This struct contains a copy of every variable that is stream dependent.
// Only the first [index=0] stream is statically allocated; the rest
// are dynamically allocated when you switch streams (yes, it is legal
// to only initialize the first element of the array of pointers).
//--------------------------------------------------------------------------

static PLStream pls0;                             // preallocated stream
static PLINT    ipls;                             // current stream number

static PLStream *pls[PL_NSTREAMS] = { &pls0 };    // Array of stream pointers

// Current stream pointer.  Global, for easier access to state info

PLDLLIMPEXP_DATA( PLStream ) * plsc = &pls0;

// Only now can we include this

#include "pldebug.h"

//--------------------------------------------------------------------------
// Initialize dispatch table.
//
// Each device is selected by the appropriate define, passed in from the
// makefile.  When installing plplot you may wish to exclude devices not
// present on your system in order to reduce screen clutter.
//
// If you hit a <CR> in response to the plinit() prompt, you get the FIRST
// one active below, so arrange them accordingly for your system (i.e. all
// the system-specific ones should go first, since they won't appear on
// most systems.)
//--------------------------------------------------------------------------

static PLDispatchTable **dispatch_table = 0;
static int             npldrivers       = 0;

static PLDispatchInit  static_device_initializers[] = {
// Same order (by source filename and by device) as in drivers.h.
// ps and psttf are special cases where two devices are handled with
// one PLD macro.
// xwin is special case where the macro name is PLD_xwin but the
// function name in drivers.h is plD_dispatch_init_xw

#if defined ( PLD_aqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_aqt,
#endif
#if defined ( PLD_epscairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_epscairo,
#endif
#if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_extcairo,
#endif
#if defined ( PLD_memcairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_memcairo,
#endif
#if defined ( PLD_pdfcairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pdfcairo,
#endif
#if defined ( PLD_pngcairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pngcairo,
#endif
#if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pscairo,
#endif
#if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_svgcairo,
#endif
#if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_wincairo,
#endif
#if defined ( PLD_xcairo ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_xcairo,
#endif
#if defined ( PLD_cgm ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_cgm,
#endif
#if defined ( PLD_gif ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_gif,
#endif
#if defined ( PLD_jpeg ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_jpeg,
#endif
#if defined ( PLD_png ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_png,
#endif
#if defined ( PLD_mem ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_mem,
#endif
#if defined ( PLD_ntk ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_ntk,
#endif
#if defined ( PLD_null ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_null,
#endif
#if defined ( PLD_pdf ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pdf,
#endif
#if defined ( PLD_plm ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_plm,
#endif
#if defined ( PLD_ps ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_ps,
#endif
#if defined ( PLD_psc ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_psc,
#endif
#if defined ( PLD_pstex ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pstex,
#endif
#if defined ( PLD_psttf ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_psttf,
#endif
#if defined ( PLD_psttfc ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_psttfc,
#endif
#if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_bmpqt,
#endif
#if defined ( PLD_epsqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_epsqt,
#endif
#if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_extqt,
#endif
#if defined ( PLD_jpgqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_jpgqt,
#endif
#if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_memqt,
#endif
#if defined ( PLD_pdfqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pdfqt,
#endif
#if defined ( PLD_pngqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_pngqt,
#endif
#if defined ( PLD_ppmqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_ppmqt,
#endif
#if defined ( PLD_qtwidget ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_qtwidget,
#endif
#if defined ( PLD_svgqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_svgqt,
#endif
#if defined ( PLD_tiffqt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_tiffqt,
#endif
#if defined ( PLD_svg ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_svg,
#endif
#if defined ( PLD_tk ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_tk,
#endif
#if defined ( PLD_tkwin ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_tkwin,
#endif
#if defined ( PLD_wingcc ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_wingcc,
#endif
#if defined ( PLD_wxpng ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_wxpng,
#endif
#if defined ( PLD_wxwidgets ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_wxwidgets,
#endif
#if defined ( PLD_xfig ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_xfig,
#endif
#if defined ( PLD_xwin ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_xw,
#endif
#if defined ( PLD_wingdi ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_wingdi,
#endif
    NULL
};

static int             nplstaticdevices = ( sizeof ( static_device_initializers ) /
                                            sizeof ( PLDispatchInit ) ) - 1;
static int             npldynamicdevices = 0;

//--------------------------------------------------------------------------
// Stuff to support the loadable device drivers.
//--------------------------------------------------------------------------

#ifdef ENABLE_DYNDRIVERS
typedef struct
{
    char *devnam;
    char *description;
    char *drvnam;
    char *tag;
    int  drvidx;
} PLLoadableDevice;

typedef struct
{
    char        *drvnam;
    lt_dlhandle dlhand;
} PLLoadableDriver;

static PLLoadableDevice *loadable_device_list;
static PLLoadableDriver *loadable_driver_list;

static int nloadabledrivers = 0;

#endif

#endif  // __PLCORE_H__