PLplot  5.11.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plplot.d
Go to the documentation of this file.
1 // Converted to D from plplot_d.h by htod
2 module plplot;
3 
4 private import std.string;
5 private import std.array;
6 private import std.algorithm;
7 private import std.stdio;
8 private import std.conv;
9 
10 // improved D interface
11 
12 // certain functions must be declared as C functions so that PLplot
13 // can handle them
14 extern ( C ) {
15 alias PLINT function( PLFLT, PLFLT ) def_func;
16 alias void function( PLINT, PLFLT*, PLFLT* ) fill_func;
17 alias void function( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ) pltr_func;
18 alias void function( PLINT, PLFLT*, PLFLT* ) mapform_func;
19 alias void function( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ) ct_func;
20 }
21 
22 // D definition of PLcGrid and PLcGrid2
23 struct PLcGrid
24 {
25  PLFLT[] xg;
26  PLFLT[] yg;
27  PLFLT[] zg;
28 }
29 struct PLcGrid2
30 {
31  PLFLT[][] xg;
32  PLFLT[][] yg;
33  PLFLT[][] zg;
34 }
35 
36 // helper function to convert D dynamic arrays in C dynamic arrays
37 private PLFLT** convert_array( PLFLT[][] a )
38 {
39  if ( !a )
40  return null;
41 
42  size_t nx = a.length;
43  size_t ny = a[0].length;
44 
45  PLFLT ** c_a = ( new PLFLT *[nx] ).ptr;
46  for ( size_t i = 0; i < nx; i++ )
47  {
48  assert( ny == a[i].length, "convert_array(): Array must be 2 dimensional!" );
49  c_a[i] = a[i].ptr;
50  }
51 
52  return c_a;
53 }
54 
55 // Process options list using current options info.
56 int plparseopts( char[][] args, PLINT mode )
57 {
58  char*[] c_args = new char*[args.length];
59  foreach ( size_t i, char[] arg; args )
60  c_args[i] = cast(char *) toStringz( arg );
61  int argc = cast(int) c_args.length;
62  return c_plparseopts( &argc, cast(char**) c_args, mode );
63 }
64 
65 // simple arrow plotter.
66 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, pltr_func pltr = null, PLPointer pltr_data = null )
67 {
68  PLINT nx = cast(PLINT) u.length;
69  PLINT ny = cast(PLINT) u[0].length;
70  assert( nx == v.length, "plvect(): Arrays must be of same length!" );
71  assert( ny == v[0].length, "plvect(): Arrays must be of same length!" );
72 
73  c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, pltr, pltr_data );
74 }
75 
76 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid cgrid )
77 {
78  PLINT nx = cast(PLINT) u.length;
79  PLINT ny = cast(PLINT) u[0].length;
80  assert( nx == v.length, "plvect(): Arrays must be of same length!" );
81  assert( ny == v[0].length, "plvect(): Arrays must be of same length!" );
82 
83  c_PLcGrid c;
84  c.xg = cgrid.xg.ptr;
85  c.nx = cast(PLINT) cgrid.xg.length;
86  c.yg = cgrid.yg.ptr;
87  c.ny = cast(PLINT) cgrid.yg.length;
88  c.zg = cgrid.zg.ptr;
89  c.nz = cast(PLINT) cgrid.zg.length;
90 
91  c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, &pltr1, &c );
92 }
93 
94 void plvect( PLFLT[][] u, PLFLT[][] v, PLFLT scale, ref PLcGrid2 cgrid2 )
95 {
96  PLINT nx = cast(PLINT) u.length;
97  PLINT ny = cast(PLINT) u[0].length;
98  assert( nx == v.length, "plvect(): Arrays must be of same length!" );
99  assert( ny == v[0].length, "plvect(): Arrays must be of same length!" );
100 
101  c_PLcGrid2 c2;
102  c2.xg = convert_array( cgrid2.xg );
103  c2.yg = convert_array( cgrid2.yg );
104  c2.zg = convert_array( cgrid2.zg );
105  c2.nx = cast(PLINT) cgrid2.xg.length;
106  c2.ny = cast(PLINT) cgrid2.xg[0].length;
107  if ( cgrid2.yg )
108  {
109  assert( c2.nx == cgrid2.yg.length, "plvect(): Arrays must be of same length!" );
110  assert( c2.ny == cgrid2.yg[0].length, "plvect(): Arrays must be of same length!" );
111  }
112  if ( cgrid2.zg )
113  {
114  assert( c2.nx == cgrid2.zg.length, "plvect(): Arrays must be of same length!" );
115  assert( c2.ny == cgrid2.zg[0].length, "plvect(): Arrays must be of same length!" );
116  }
117 
118  c_plvect( convert_array( u ), convert_array( v ), nx, ny, scale, &pltr2, &c2 );
119 }
120 
121 void plsvect( PLFLT[] arrowx, PLFLT[] arrowy, PLBOOL fill )
122 {
123  PLINT npts = cast(PLINT) arrowx.length;
124  assert( npts == arrowy.length, "plsvect(): Arrays must be of same length!" );
125  c_plsvect( arrowx.ptr, arrowy.ptr, npts, fill );
126 }
127 
128 // This functions similarly to plbox() except that the origin of the axes
129 // is placed at the user-specified point (x0, y0).
130 void plaxes( PLFLT x0, PLFLT y0, string xopt, PLFLT xtick, PLINT nxsub,
131  string yopt, PLFLT ytick, PLINT nysub )
132 {
133  c_plaxes( x0, y0, toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub );
134 }
135 
136 // Plot a histogram using x to store data values and y to store frequencies
137 void plbin( PLFLT[] x, PLFLT[] y, PLINT opt )
138 {
139  PLINT nbin = cast(PLINT) x.length;
140  assert( nbin == y.length, "plbin(): Arrays must be of same length!" );
141  c_plbin( nbin, x.ptr, y.ptr, opt );
142 }
143 
144 // This draws a box around the current viewport.
145 void plbox( string xopt, PLFLT xtick, PLINT nxsub, string yopt, PLFLT ytick, PLINT nysub )
146 {
147  c_plbox( toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub );
148 }
149 
150 // This is the 3-d analogue of plbox().
151 void plbox3( string xopt, string xlabel, PLFLT xtick, PLINT nsubx,
152  string yopt, string ylabel, PLFLT ytick, PLINT nsuby,
153  string zopt, string zlabel, PLFLT ztick, PLINT nsubz )
154 {
155  c_plbox3( toStringz( xopt ), toStringz( xlabel ), xtick, nsubx,
156  toStringz( yopt ), toStringz( ylabel ), ytick, nsuby,
157  toStringz( zopt ), toStringz( zlabel ), ztick, nsubz );
158 }
159 
160 // Routine for drawing continous colour legends
161 void plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height,
162  PLINT opt, PLINT position, PLFLT x, PLFLT y,
163  PLFLT x_length, PLFLT y_length,
164  PLINT bg_color, PLINT bb_color, PLINT bb_style,
165  PLFLT low_cap_color, PLFLT high_cap_color,
166  PLINT cont_color, PLFLT cont_width,
167  PLINT[] label_opts, string[] label,
168  string[] axis_opts,
169  PLFLT[] ticks, PLINT[] sub_ticks,
170  PLFLT[][] values )
171 {
172  PLINT n_labels = cast(PLINT) label_opts.length;
173  PLINT n_axes = cast(PLINT) axis_opts.length;
174  PLINT[] n_values = new PLINT[values.length];
175  for ( size_t i = 0; i < values.length; i++ )
176  {
177  n_values[i] = cast(PLINT) values[i].length;
178  }
179  immutable( char ) * *labelz = array( map!toStringz( label ) ).ptr;
180  immutable( char ) * *axis_optsz = array( map!toStringz( axis_opts ) ).ptr;
181  assert( n_labels == label.length, "plcolorbar(): Arrays must be of same length!" );
182  assert( n_labels == label_opts.length, "plcolorbar(): Arrays must be of same length!" );
183  assert( n_axes == axis_opts.length, "plcolorbar(): Arrays must be of same length!" );
184  assert( n_axes == ticks.length, "plcolorbar(): Arrays must be of same length!" );
185  assert( n_axes == sub_ticks.length, "plcolorbar(): Arrays must be of same length!" );
186 
187  c_plcolorbar( p_colorbar_width, p_colorbar_height,
188  opt, position, x, y,
189  x_length, y_length,
190  bg_color, bb_color, bb_style,
191  low_cap_color, high_cap_color,
192  cont_color, cont_width,
193  n_labels, label_opts.ptr, labelz,
194  n_axes, axis_optsz,
195  ticks.ptr, sub_ticks.ptr,
196  n_values.ptr, convert_array( values ) );
197 }
198 
199 // Draws a contour plot from data in f(nx,ny). Is just a front-end to
200 // plfcont, with a particular choice for f2eval and f2eval_data.
201 //
202 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel,
203  pltr_func pltr, PLPointer pltr_data = null )
204 {
205  PLINT nx = cast(PLINT) f.length;
206  PLINT ny = cast(PLINT) f[0].length;
207 
208  c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length,
209  pltr, pltr_data );
210 }
211 
212 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel,
213  ref PLcGrid cgrid )
214 {
215  PLINT nx = cast(PLINT) f.length;
216  PLINT ny = cast(PLINT) f[0].length;
217 
218  c_PLcGrid c;
219  c.xg = cgrid.xg.ptr;
220  c.nx = cast(PLINT) cgrid.xg.length;
221  c.yg = cgrid.yg.ptr;
222  c.ny = cast(PLINT) cgrid.yg.length;
223  c.zg = cgrid.zg.ptr;
224  c.nz = cast(PLINT) cgrid.zg.length;
225 
226  c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length,
227  &pltr1, &c );
228 }
229 
230 void plcont( PLFLT[][] f, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT[] clevel,
231  ref PLcGrid2 cgrid2 )
232 {
233  PLINT nx = cast(PLINT) f.length;
234  PLINT ny = cast(PLINT) f[0].length;
235 
236  c_PLcGrid2 c2;
237  c2.xg = convert_array( cgrid2.xg );
238  c2.yg = convert_array( cgrid2.yg );
239  c2.zg = convert_array( cgrid2.zg );
240  c2.nx = cast(PLINT) cgrid2.xg.length;
241  c2.ny = cast(PLINT) cgrid2.xg[0].length;
242  if ( cgrid2.yg )
243  {
244  assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" );
245  assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" );
246  }
247  if ( cgrid2.zg )
248  {
249  assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" );
250  assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" );
251  }
252 
253  c_plcont( convert_array( f ), nx, ny, kx, lx, ky, ly, clevel.ptr, cast(PLINT) clevel.length,
254  &pltr2, &c2 );
255 }
256 
257 // Draws a contour plot using the function evaluator f2eval and data stored
258 // by way of the f2eval_data pointer. This allows arbitrary organizations
259 // of 2d array data to be used.
260 //
261 //void plfcont(PLFLT function(PLINT , PLINT , PLPointer )f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void function(PLFLT , PLFLT , PLFLT *, PLFLT *, PLPointer )pltr, PLPointer pltr_data);
262 
263 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i))
264 void plerrx( PLFLT[] xmin, PLFLT[] xmax, PLFLT[] y )
265 {
266  PLINT n = cast(PLINT) y.length;
267  assert( n == xmin.length, "plerrx(): Arrays must be of same length!" );
268  assert( n == xmax.length, "plerrx(): Arrays must be of same length!" );
269  c_plerrx( n, xmin.ptr, xmax.ptr, y.ptr );
270 }
271 
272 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i))
273 void plerry( PLFLT[] x, PLFLT[] ymin, PLFLT[] ymax )
274 {
275  PLINT n = cast(PLINT) x.length;
276  assert( n == ymin.length, "plerry(): Arrays must be of same length!" );
277  assert( n == ymax.length, "plerry(): Arrays must be of same length!" );
278  c_plerry( n, x.ptr, ymin.ptr, ymax.ptr );
279 }
280 
281 // Pattern fills the polygon bounded by the input points.
282 void plfill( PLFLT[] x, PLFLT[] y )
283 {
284  PLINT n = cast(PLINT) x.length;
285  assert( n == y.length, "plfill(): Arrays must be of same length!" );
286  c_plfill( n, x.ptr, y.ptr );
287 }
288 
289 // Pattern fills the 3d polygon bounded by the input points.
290 void plfill3( PLFLT[] x, PLFLT[] y, PLFLT[] z )
291 {
292  PLINT n = cast(PLINT) x.length;
293  assert( n == y.length, "plfill3(): Arrays must be of same length!" );
294  assert( n == z.length, "plfill3(): Arrays must be of same length!" );
295  c_plfill3( n, x.ptr, y.ptr, z.ptr );
296 }
297 
298 // Get the current device (keyword) name
299 void plgdev( out string p_dev )
300 {
301  char cdev[1024];
302  c_plgdev( cdev.ptr );
303  p_dev = to!string( cdev.ptr );
304 }
305 
306 // Get the (current) output file name. Must be preallocated to >80 bytes
307 void plgfnam( out string fnam )
308 {
309  char cfnam[1024];
310  c_plgfnam( cfnam.ptr );
311  fnam = to!string( cfnam.ptr );
312 }
313 
314 // Draw gradient in polygon.
315 void plgradient( PLFLT[] x, PLFLT[] y, PLFLT angle )
316 {
317  PLINT n = cast(PLINT) x.length;
318  assert( n == y.length, "plgradient(): Arrays must be of same length!" );
319  c_plgradient( n, x.ptr, y.ptr, angle );
320 }
321 
322 // grid irregularly sampled data
323 void plgriddata( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLFLT[] xg, PLFLT[] yg, PLFLT[][] zg, PLINT type, PLFLT data )
324 {
325  PLINT npts = cast(PLINT) x.length;
326  assert( npts == y.length, "plgriddata(): Arrays must be of same length!" );
327  assert( npts == z.length, "plgriddata(): Arrays must be of same length!" );
328 
329  PLINT nxg = cast(PLINT) xg.length;
330  PLINT nyg = cast(PLINT) yg.length;
331  assert( nxg == zg.length, "plgriddata(): Arrays must be of same length!" );
332  assert( nyg == zg[0].length, "plgriddata(): Arrays must be of same length!" );
333 
334  c_plgriddata( x.ptr, y.ptr, z.ptr, npts, xg.ptr, nxg, yg.ptr, nyg, convert_array( zg ), type, data );
335 }
336 
337 // Get the current library version number
338 void plgver( out string p_ver )
339 {
340  char cver[1024];
341  c_plgver( cver.ptr );
342  p_ver = to!string( cver.ptr );
343 }
344 
345 // Draws a histogram of n values of a variable in array data[0..n-1]
346 void plhist( PLFLT[] data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt )
347 {
348  c_plhist( cast(PLINT) data.length, data.ptr, datmin, datmax, nbin, opt );
349 }
350 
351 // Simple routine for labelling graphs.
352 void pllab( string xlabel, string ylabel, string tlabel )
353 {
354  c_pllab( toStringz( xlabel ), toStringz( ylabel ), toStringz( tlabel ) );
355 }
356 
357 // Routine for drawing discrete line, symbol, or cmap0 legends
358 void pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height,
359  PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width,
360  PLINT bg_color, PLINT bb_color, PLINT bb_style,
361  PLINT nrow, PLINT ncolumn,
362  PLINT[] opt_array,
363  PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing,
364  PLFLT text_justification,
365  PLINT[] text_colors, string[] text,
366  PLINT[] box_colors, PLINT[] box_patterns,
367  PLFLT[] box_scales, PLFLT[] box_line_widths,
368  PLINT[] line_colors, PLINT[] line_styles,
369  PLFLT[] line_widths,
370  PLINT[] symbol_colors, PLFLT[] symbol_scales,
371  PLINT[] symbol_numbers, string[] symbols )
372 {
373  PLINT nlegend = cast(PLINT) opt_array.length;
374  immutable( char ) * *textz = array( map!toStringz( text ) ).ptr;
375  immutable( char ) * *symbolsz = array( map!toStringz( symbols ) ).ptr;
376  assert( nlegend == text_colors.length, "pllegend(): Arrays must be of same length!" );
377  assert( nlegend == text.length, "pllegend(): Arrays must be of same length!" );
378  assert( box_colors == null || nlegend == box_colors.length, "pllegend(): Arrays must be of same length!" );
379  assert( box_patterns == null || nlegend == box_patterns.length, "pllegend(): Arrays must be of same length!" );
380  assert( box_scales == null || nlegend == box_scales.length, "pllegend(): Arrays must be of same length!" );
381  assert( box_line_widths == null || nlegend == box_line_widths.length, "pllegend(): Arrays must be of same length!" );
382  assert( line_colors == null || nlegend == line_colors.length, "pllegend(): Arrays must be of same length!" );
383  assert( line_styles == null || nlegend == line_styles.length, "pllegend(): Arrays must be of same length!" );
384  assert( line_widths == null || nlegend == line_widths.length, "pllegend(): Arrays must be of same length!" );
385  assert( symbol_colors == null || nlegend == symbol_colors.length, "pllegend(): Arrays must be of same length!" );
386  assert( symbol_scales == null || nlegend == symbol_scales.length, "pllegend(): Arrays must be of same length!" );
387  assert( symbol_numbers == null || nlegend == symbol_numbers.length, "pllegend(): Arrays must be of same length!" );
388  assert( symbols == null || nlegend == symbols.length, "pllegend(): Arrays must be of same length!" );
389  c_pllegend( p_legend_width, p_legend_height,
390  opt, position, x, y, plot_width,
391  bg_color, bb_color, bb_style,
392  nrow, ncolumn,
393  nlegend, opt_array.ptr,
394  text_offset, text_scale, text_spacing,
395  text_justification,
396  text_colors.ptr, textz,
397  box_colors.ptr, box_patterns.ptr,
398  box_scales.ptr, box_line_widths.ptr,
399  line_colors.ptr, line_styles.ptr,
400  line_widths.ptr,
401  symbol_colors.ptr, symbol_scales.ptr,
402  symbol_numbers.ptr, symbolsz );
403 }
404 
405 // Draws line segments connecting a series of points.
406 void plline( PLFLT[] x, PLFLT[] y )
407 {
408  PLINT n = cast(PLINT) x.length;
409  assert( n == y.length, "plline(): Arrays must be of same length!" );
410  c_plline( n, x.ptr, y.ptr );
411 }
412 
413 // Draws a line in 3 space.
414 void plline3( PLFLT[] x, PLFLT[] y, PLFLT[] z )
415 {
416  PLINT n = cast(PLINT) x.length;
417  assert( n == y.length, "plline3(): Arrays must be of same length!" );
418  assert( n == z.length, "plline3(): Arrays must be of same length!" );
419  c_plline3( n, x.ptr, y.ptr, z.ptr );
420 }
421 
422 // plot continental outline in world coordinates
423 void plmap( mapform_func mapform, string type, PLFLT minlong, PLFLT maxlong,
424  PLFLT minlat, PLFLT maxlat )
425 {
426  c_plmap( mapform, toStringz( type ), minlong, maxlong, minlat, maxlat );
427 }
428 
429 
430 // Plot map outlines
431 
432 void plmapline( mapform_func mapform, string name, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy,
433  const PLINT[] plotentries )
434 {
435  PLINT n = cast(PLINT) plotentries.length;
436  c_plmapline( mapform, toStringz( name ), minx, maxx, miny, maxy, plotentries.ptr, n );
437 }
438 
439 // Plot map points
440 
441 void plmapstring( mapform_func mapform, string name, string string,
442  PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy, const PLINT[] plotentries )
443 {
444  PLINT n = cast(PLINT) plotentries.length;
445  c_plmapstring( mapform, toStringz( name ), toStringz( string ), minx, maxx, miny, maxy, plotentries.ptr, n );
446 }
447 
448 // Plot map text
449 
450 void plmaptex( mapform_func mapform, string name, PLFLT dx, PLFLT dy, PLFLT just, string text,
451  PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy, PLINT plotentry )
452 {
453  c_plmaptex( mapform, toStringz( name ), dx, dy, just, toStringz( text ), minx, maxx, miny, maxy, plotentry );
454 }
455 
456 // Plot map fills
457 void plmapfill( mapform_func mapform, string name, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy,
458  const PLINT[] plotentries ) // Plots a mesh representation of the function z[x][y].
459 {
460  PLINT n = cast(PLINT) plotentries.length;
461  c_plmapfill( mapform, toStringz( name ), minx, maxx, miny, maxy, plotentries.ptr, n );
462 }
463 
464 void plmesh( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt )
465 {
466  PLINT nx = cast(PLINT) z.length;
467  PLINT ny = cast(PLINT) z[0].length;
468 
469  assert( nx == x.length, "plmesh(): Arrays must be of same length!" );
470  assert( ny == y.length, "plmesh(): Arrays must be of same length!" );
471 
472  c_plmesh( x.ptr, y.ptr, convert_array( z ), nx, ny, opt );
473 }
474 
475 // Plots a mesh representation of the function z[x][y] with contour
476 void plmeshc( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel )
477 {
478  PLINT nx = cast(PLINT) z.length;
479  PLINT ny = cast(PLINT) z[0].length;
480 
481  assert( nx == x.length, "plmeshc(): Arrays must be of same length!" );
482  assert( ny == y.length, "plmeshc(): Arrays must be of same length!" );
483 
484  c_plmeshc( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length );
485 }
486 
487 // Prints out "text" at specified position relative to viewport
488 void plmtex( string side, PLFLT disp, PLFLT pos, PLFLT just, string text )
489 {
490  c_plmtex( toStringz( side ), disp, pos, just, toStringz( text ) );
491 }
492 
493 // Prints out "text" at specified position relative to viewport (3D)
494 void plmtex3( string side, PLFLT disp, PLFLT pos, PLFLT just, string text )
495 {
496  c_plmtex3( toStringz( side ), disp, pos, just, toStringz( text ) );
497 }
498 
499 // Plots a 3-d representation of the function z[x][y].
500 void plot3d( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLBOOL side )
501 {
502  PLINT nx = cast(PLINT) z.length;
503  PLINT ny = cast(PLINT) z[0].length;
504 
505  assert( nx == x.length, "plot3d(): Arrays must be of same length!" );
506  assert( ny == y.length, "plot3d(): Arrays must be of same length!" );
507 
508  c_plot3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, side );
509 }
510 
511 // Plots a 3-d representation of the function z[x][y] with contour.
512 void plot3dc( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel )
513 {
514  PLINT nx = cast(PLINT) z.length;
515  PLINT ny = cast(PLINT) z[0].length;
516 
517  assert( nx == x.length, "plot3dc(): Arrays must be of same length!" );
518  assert( ny == y.length, "plot3dc(): Arrays must be of same length!" );
519 
520  c_plot3dc( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length );
521 }
522 
523 // Plots a 3-d representation of the function z[x][y] with contour and
524 // y index limits.
525 void plot3dcl( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel,
526  PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax )
527 {
528  PLINT nx = cast(PLINT) z.length;
529  PLINT ny = cast(PLINT) z[0].length;
530 
531  assert( nx == x.length, "plot3dcl(): Arrays must be of same length!" );
532  assert( ny == y.length, "plot3dcl(): Arrays must be of same length!" );
533 
534  c_plot3dcl( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length,
535  ixstart, ixn, indexymin.ptr, indexymax.ptr );
536 }
537 
538 // Set fill pattern directly.
539 void plpat( PLINT[] inc, PLINT[] del )
540 {
541  PLINT nlin = cast(PLINT) inc.length;
542  assert( nlin == del.length, "plpat(): Arrays must be of same length!" );
543  c_plpat( nlin, inc.ptr, del.ptr );
544 }
545 
546 // Plots array y against x for n points using ASCII code "code".
547 void plpoin( PLFLT[] x, PLFLT[] y, PLINT code )
548 {
549  PLINT n = cast(PLINT) x.length;
550  assert( n == y.length, "plpoin(): Arrays must be of same length!" );
551  c_plpoin( n, x.ptr, y.ptr, code );
552 }
553 
554 // Draws a series of points in 3 space.
555 void plpoin3( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLINT code )
556 {
557  PLINT n = cast(PLINT) x.length;
558  assert( n == y.length, "plpoin3(): Arrays must be of same length!" );
559  assert( n == z.length, "plpoin3(): Arrays must be of same length!" );
560  c_plpoin3( n, x.ptr, y.ptr, z.ptr, code );
561 }
562 
563 // Plots array y against x for n points using (UTF-8) text string
564 void plstring( PLFLT[] x, PLFLT[] y, string text )
565 {
566  PLINT n = cast(PLINT) x.length;
567  assert( n == y.length, "plstring(): Arrays must be of same length!" );
568  c_plstring( n, x.ptr, y.ptr, toStringz( text ) );
569 }
570 
571 // Draws a series of points (described by [UTF8] text string) in 3 space.
572 void plstring3( PLFLT[] x, PLFLT[] y, PLFLT[] z, string text )
573 {
574  PLINT n = cast(PLINT) x.length;
575  assert( n == y.length, "plstring3(): Arrays must be of same length!" );
576  assert( n == z.length, "plstring3(): Arrays must be of same length!" );
577  c_plstring3( n, x.ptr, y.ptr, z.ptr, toStringz( text ) );
578 }
579 
580 // Draws a polygon in 3 space.
581 void plpoly3( PLFLT[] x, PLFLT[] y, PLFLT[] z, PLBOOL[] draw, PLBOOL ifcc )
582 {
583  PLINT n = cast(PLINT) x.length;
584  assert( n == y.length, "plpoly3(): Arrays must be of same length!" );
585  assert( n == z.length, "plpoly3(): Arrays must be of same length!" );
586  assert( n - 1 == draw.length, "plpoly3(): Array draw must be of same length then other arrays minus 1!" );
587  c_plpoly3( n, x.ptr, y.ptr, z.ptr, draw.ptr, ifcc );
588 }
589 
590 // Prints out "text" at world cooordinate (x,y).
591 void plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, string text )
592 {
593  c_plptex( x, y, dx, dy, just, toStringz( text ) );
594 }
595 
596 // Prints out "text" at world cooordinate (x,y,z).
597 void plptex3( PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz,
598  PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, string text )
599 {
600  c_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz( text ) );
601 }
602 
603 // Set the colors for color table 0 from a cmap0 file
604 void plspal0( string filename )
605 {
606  c_plspal0( toStringz( filename ) );
607 }
608 
609 // Set the colors for color table 1 from a cmap1 file
610 void plspal1( string filename, PLBOOL interpolate )
611 {
612  c_plspal1( toStringz( filename ), interpolate );
613 }
614 
615 // Set color map 0 colors by 8 bit RGB values
616 void plscmap0( PLINT[] r, PLINT[] g, PLINT[] b )
617 {
618  PLINT ncol0 = cast(PLINT) r.length;
619  assert( ncol0 == g.length, "plscmap0(): Arrays must be of same length!" );
620  assert( ncol0 == b.length, "plscmap0(): Arrays must be of same length!" );
621  c_plscmap0( r.ptr, g.ptr, b.ptr, ncol0 );
622 }
623 
624 // Set color map 0 colors by 8 bit RGB values and alpha values
625 void plscmap0a( PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a )
626 {
627  PLINT ncol0 = cast(PLINT) r.length;
628  assert( ncol0 == g.length, "plscmap0a(): Arrays must be of same length!" );
629  assert( ncol0 == b.length, "plscmap0a(): Arrays must be of same length!" );
630  assert( ncol0 == a.length, "plscmap0a(): Arrays must be of same length!" );
631  c_plscmap0a( r.ptr, g.ptr, b.ptr, a.ptr, ncol0 );
632 }
633 
634 // Set color map 1 colors by 8 bit RGB values
635 void plscmap1( PLINT[] r, PLINT[] g, PLINT[] b )
636 {
637  PLINT ncol1 = cast(PLINT) r.length;
638  assert( ncol1 == g.length, "plscmap1(): Arrays must be of same length!" );
639  assert( ncol1 == b.length, "plscmap1(): Arrays must be of same length!" );
640  c_plscmap1( r.ptr, g.ptr, b.ptr, ncol1 );
641 }
642 
643 // Set color map 1 colors by 8 bit RGB and alpha values
644 void plscmap1a( PLINT[] r, PLINT[] g, PLINT[] b, PLFLT[] a )
645 {
646  PLINT ncol1 = cast(PLINT) r.length;
647  assert( ncol1 == g.length, "plscmap1a(): Arrays must be of same length!" );
648  assert( ncol1 == b.length, "plscmap1a(): Arrays must be of same length!" );
649  assert( ncol1 == a.length, "plscmap1a(): Arrays must be of same length!" );
650  c_plscmap1a( r.ptr, g.ptr, b.ptr, a.ptr, ncol1 );
651 }
652 
653 // Set color map 1 colors using a piece-wise linear relationship between
654 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
655 void plscmap1l( PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1,
656  PLFLT[] coord2, PLFLT[] coord3, PLBOOL[] alt_hue_path = null )
657 {
658  PLINT npts = cast(PLINT) intensity.length;
659  assert( npts == coord1.length, "plscmap1l(): Arrays must be of same length!" );
660  assert( npts == coord2.length, "plscmap1l(): Arrays must be of same length!" );
661  assert( npts == coord3.length, "plscmap1l(): Arrays must be of same length!" );
662  if ( alt_hue_path != null )
663  {
664  assert( npts - 1 == alt_hue_path.length, "plscmap1l(): Array alt_hue_path must be of same length then other arrays minus 1!" );
665  c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, alt_hue_path.ptr );
666  }
667  else
668  c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, null );
669 }
670 
671 
672 // Set color map 1 colors using a piece-wise linear relationship between
673 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
674 // Will also linear interpolate alpha values.
675 void plscmap1la( PLBOOL itype, PLFLT[] intensity, PLFLT[] coord1,
676  PLFLT[] coord2, PLFLT[] coord3, PLFLT[] a, PLBOOL[] alt_hue_path = null )
677 {
678  PLINT npts = cast(PLINT) intensity.length;
679  assert( npts == coord1.length, "plscmap1la(): Arrays must be of same length!" );
680  assert( npts == coord2.length, "plscmap1la(): Arrays must be of same length!" );
681  assert( npts == coord3.length, "plscmap1la(): Arrays must be of same length!" );
682  assert( npts == a.length, "plscmap1la(): Arrays must be of same length!" );
683  if ( alt_hue_path != null )
684  {
685  assert( npts - 1 == alt_hue_path.length, "plscmap1la(): Array alt_hue_path must be of same length then other arrays minus 1!" );
686  c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, alt_hue_path.ptr );
687  }
688  else
689  c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, null );
690 }
691 
692 // Set the device (keyword) name
693 void plsdev( string devname )
694 {
695  c_plsdev( toStringz( devname ) );
696 }
697 
698 // Set the output file name.
699 void plsfnam( string fnam )
700 {
701  c_plsfnam( toStringz( fnam ) );
702 }
703 
704 // Shade region.
705 void plshade( PLFLT[][] a, def_func defined, PLFLT left, PLFLT right,
706  PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap,
707  PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color,
708  PLFLT max_width, PLBOOL rectangular,
709  pltr_func pltr = null, PLPointer pltr_data = null )
710 {
711  PLINT nx = cast(PLINT) a.length;
712  PLINT ny = cast(PLINT) a[0].length;
713 
714  c_plshade( convert_array( a ), nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap,
715  sh_color, sh_width, min_color, min_width, max_color, max_width, &c_plfill,
716  rectangular, pltr, pltr_data );
717 }
718 
719 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
720  PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width,
721  PLBOOL rectangular, pltr_func pltr = null, PLPointer pltr_data = null )
722 {
723  PLINT nx = cast(PLINT) a.length;
724  PLINT ny = cast(PLINT) a[0].length;
725 
726  c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length,
727  fill_width, cont_color, cont_width, &c_plfill, rectangular, pltr, pltr_data );
728 }
729 
730 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
731  PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width,
732  PLBOOL rectangular, ref PLcGrid cgrid )
733 {
734  PLINT nx = cast(PLINT) a.length;
735  PLINT ny = cast(PLINT) a[0].length;
736 
737  c_PLcGrid c;
738  c.xg = cgrid.xg.ptr;
739  c.nx = cast(PLINT) cgrid.xg.length;
740  c.yg = cgrid.yg.ptr;
741  c.ny = cast(PLINT) cgrid.yg.length;
742  c.zg = cgrid.zg.ptr;
743  c.nz = cast(PLINT) cgrid.zg.length;
744 
745  c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length,
746  fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr1, &c );
747 }
748 
749 void plshades( PLFLT[][] a, def_func defined, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
750  PLFLT[] clevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width,
751  PLBOOL rectangular, ref PLcGrid2 cgrid2 )
752 {
753  PLINT nx = cast(PLINT) a.length;
754  PLINT ny = cast(PLINT) a[0].length;
755 
756  c_PLcGrid2 c2;
757  c2.xg = convert_array( cgrid2.xg );
758  c2.yg = convert_array( cgrid2.yg );
759  c2.zg = convert_array( cgrid2.zg );
760  c2.nx = cast(PLINT) cgrid2.xg.length;
761  c2.ny = cast(PLINT) cgrid2.xg[0].length;
762  if ( cgrid2.yg )
763  {
764  assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" );
765  assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" );
766  }
767  if ( cgrid2.zg )
768  {
769  assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" );
770  assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" );
771  }
772 
773  c_plshades( convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(PLINT) clevel.length,
774  fill_width, cont_color, cont_width, &c_plfill, rectangular, &pltr2, &c2 );
775 }
776 
777 // Initialize PLplot, passing the device name and windows/page settings.
778 void plstart( string devname, PLINT nx, PLINT ny )
779 {
780  c_plstart( toStringz( devname ), nx, ny );
781 }
782 
783 // Create 1d stripchart
784 void plstripc( PLINT* id, string xspec, string yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump,
785  PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc,
786  PLINT colbox, PLINT collab, PLINT[] colline, PLINT[] styline, string[] legline,
787  string labx, string laby, string labtop )
788 {
789  assert( 4 == colline.length, "plstripc(): Arrays must be of length 4!" );
790  assert( 4 == styline.length, "plstripc(): Arrays must be of length 4!" );
791  assert( 4 == legline.length, "plstripc(): Arrays must be of length 4!" );
792 
793  immutable( char ) * *leglinez = array( map!toStringz( legline ) ).ptr;
794  //for ( int i = 0; i < 4; i++ )
795  //{
796  // leglinez[i] = toStringz( legline[i] );
797  //}
798 
799  c_plstripc( id, toStringz( xspec ), toStringz( yspec ), xmin, xmax, xjump, ymin, ymax,
800  xlpos, ylpos, y_ascl, acc, colbox, collab, colline.ptr, styline.ptr, leglinez,
801  toStringz( labx ), toStringz( laby ), toStringz( labtop ) );
802 }
803 
804 // plots a 2d image (or a matrix too large for plshade() )
806  PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax,
807  pltr_func pltr = null, PLPointer pltr_data = null )
808 {
809  PLINT nx = cast(PLINT) idata.length;
810  PLINT ny = cast(PLINT) idata[0].length;
811 
812  c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
813  valuemin, valuemax, pltr, pltr_data );
814 }
815 
816 // plots a 2d image (or a matrix too large for plshade() )
818  PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLcGrid cgrid )
819 {
820  PLINT nx = cast(PLINT) idata.length;
821  PLINT ny = cast(PLINT) idata[0].length;
822 
823  c_PLcGrid c;
824  c.xg = cgrid.xg.ptr;
825  c.nx = cast(PLINT) cgrid.xg.length;
826  c.yg = cgrid.yg.ptr;
827  c.ny = cast(PLINT) cgrid.yg.length;
828  c.zg = cgrid.zg.ptr;
829  c.nz = cast(PLINT) cgrid.zg.length;
830 
831  c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
832  valuemin, valuemax, &pltr1, &c );
833 }
834 
835 // plots a 2d image (or a matrix too large for plshade() )
837  PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLcGrid2 cgrid2 )
838 {
839  PLINT nx = cast(PLINT) idata.length;
840  PLINT ny = cast(PLINT) idata[0].length;
841 
842  c_PLcGrid2 c2;
843  c2.xg = convert_array( cgrid2.xg );
844  c2.yg = convert_array( cgrid2.yg );
845  c2.zg = convert_array( cgrid2.zg );
846  c2.nx = cast(PLINT) cgrid2.xg.length;
847  c2.ny = cast(PLINT) cgrid2.xg[0].length;
848  if ( cgrid2.yg )
849  {
850  assert( c2.nx == cgrid2.yg.length, "plcont(): Arrays must be of same length!" );
851  assert( c2.ny == cgrid2.yg[0].length, "plcont(): Arrays must be of same length!" );
852  }
853  if ( cgrid2.zg )
854  {
855  assert( c2.nx == cgrid2.zg.length, "plcont(): Arrays must be of same length!" );
856  assert( c2.ny == cgrid2.zg[0].length, "plcont(): Arrays must be of same length!" );
857  }
858 
859  c_plimagefr( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
860  valuemin, valuemax, &pltr2, &c2 );
861 }
862 
863 // plots a 2d image (or a matrix too large for plshade() ) - colors
864 // automatically scaled
866  PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax )
867 {
868  PLINT nx = cast(PLINT) idata.length;
869  PLINT ny = cast(PLINT) idata[0].length;
870 
871  c_plimage( convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax,
872  Dymin, Dymax );
873 }
874 
875 // Set up a new line style
876 void plstyl( PLINT[] mark, PLINT[] space )
877 {
878  PLINT nms = cast(PLINT) mark.length;
879  assert( nms == space.length, "plstyl(): Arrays must be of same length!" );
880  c_plstyl( nms, mark.ptr, space.ptr );
881 }
882 
883 // Plots the 3d surface representation of the function z[x][y].
884 void plsurf3d( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel = null )
885 {
886  PLINT nx = cast(PLINT) z.length;
887  PLINT ny = cast(PLINT) z[0].length;
888  assert( nx == x.length, "plsurf3d(): Arrays must be of same length!" );
889  assert( ny == y.length, "plsurf3d(): Arrays must be of same length!" );
890 
891  if ( clevel )
892  c_plsurf3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length );
893  else
894  c_plsurf3d( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, null, 0 );
895 }
896 
897 // Plots the 3d surface representation of the function z[x][y] with y
898 // index limits.
899 void plsurf3dl( PLFLT[] x, PLFLT[] y, PLFLT[][] z, PLINT opt, PLFLT[] clevel,
900  PLINT ixstart, PLINT ixn, PLINT[] indexymin, PLINT[] indexymax )
901 {
902  PLINT nx = cast(PLINT) z.length;
903  PLINT ny = cast(PLINT) z[0].length;
904  assert( nx == x.length, "plsurf3d(): Arrays must be of same length!" );
905  assert( ny == y.length, "plsurf3d(): Arrays must be of same length!" );
906 
907  c_plsurf3dl( x.ptr, y.ptr, convert_array( z ), nx, ny, opt, clevel.ptr, cast(PLINT) clevel.length,
908  ixstart, ixn, indexymin.ptr, indexymax.ptr );
909 }
910 
911 // Plots array y against x for n points using Hershey symbol "code"
912 void plsym( PLFLT[] x, PLFLT[] y, PLINT code )
913 {
914  PLINT n = cast(PLINT) x.length;
915  assert( n == y.length, "plsym(): Arrays must be of same length!" );
916  c_plsym( n, x.ptr, y.ptr, code );
917 }
918 
919 // Set the format for date / time labels
920 void pltimefmt( string fmt )
921 {
922  c_pltimefmt( toStringz( fmt ) );
923 }
924 
925 //--------------------------------------------------------------------------
926 // Functions for use from C or C++ only
927 //--------------------------------------------------------------------------
928 
929 // Returns a list of file-oriented device names and their menu strings
930 //void plgFileDevs(char ***p_menustr, char ***p_devname, int *p_ndev);
931 
932 // Returns a list of all device names and their menu strings
933 //void plgDevs(char ***p_menustr, char ***p_devname, int *p_ndev);
934 
935 // Set the function pointer for the keyboard event handler
936 //void plsKeyEH(void function(PLGraphicsIn *, void *, int *)KeyEH, void *KeyEH_data);
937 
938 // Set the function pointer for the (mouse) button event handler
939 //void plsButtonEH(void function(PLGraphicsIn *, void *, int *)ButtonEH, void *ButtonEH_data);
940 
941 // Sets an optional user bop handler
942 //void plsbopH(void function(void *, int *)handler, void *handler_data);
943 
944 // Sets an optional user eop handler
945 //void plseopH(void function(void *, int *)handler, void *handler_data);
946 
947 // Set the variables to be used for storing error info
948 //void plsError(PLINT *errcode, char *errmsg)
949 //{
950 //}
951 
952 // Sets an optional user exit handler.
953 //void plsexit(int function(char *)handler);
954 
955 // Sets an optional user abort handler.
956 //void plsabort(void function(char *)handler);
957 
958 // Function evaluators
959 
960 // Does a lookup from a 2d function array. Array is of type (PLFLT **),
961 // and is column dominant (normal C ordering).
962 //PLFLT plf2eval2(PLINT ix, PLINT iy, PLPointer plf2eval_data);
963 
964 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
965 // and is column dominant (normal C ordering).
966 //PLFLT plf2eval(PLINT ix, PLINT iy, PLPointer plf2eval_data);
967 
968 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
969 // and is row dominant (Fortran ordering).
970 //PLFLT plf2evalr(PLINT ix, PLINT iy, PLPointer plf2eval_data);
971 
972 // Command line parsing utilities
973 
974 // Merge user option table into internal info structure.
975 //int plMergeOpts(PLOptionTable *options, char *name, char **notes);
976 
977 // Set the strings used in usage and syntax messages.
978 //void plSetUsage(char *program_string, char *usage_string);
979 
980 // Process input strings, treating them as an option and argument pair.
981 int plsetopt( string opt, string optarg )
982 {
983  return c_plsetopt( toStringz( opt ), toStringz( optarg ) );
984 }
985 
986 // Miscellaneous
987 
988 // Get the escape character for text strings.
989 //void plgesc(char *p_esc);
990 
991 // Front-end to driver escape function.
992 //void pl_cmd(PLINT op, void *ptr);
993 
994 // Return full pathname for given file if executable
995 //int plFindName(char *p);
996 
997 // Looks for the specified executable file according to usual search path.
998 //char * plFindCommand(char *fn);
999 
1000 // Gets search name for file by concatenating the dir, subdir, and file
1001 // name, allocating memory as needed.
1002 //void plGetName(char *dir, char *subdir, char *filename, char **filespec);
1003 
1004 // Prompts human to input an integer in response to given message.
1005 //PLINT plGetInt(char *s);
1006 
1007 // Prompts human to input a float in response to given message.
1008 //PLFLT plGetFlt(char *s);
1009 
1010 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid().
1011 void plMinMax2dGrid( PLFLT[][] f, out PLFLT fmax, out PLFLT fmin )
1012 {
1013  plMinMax2dGrid( convert_array( f ), cast(PLINT) f.length, cast(PLINT) f[0].length, &fmax, &fmin );
1014 }
1015 
1016 // Wait for graphics input event and translate to world coordinates
1017 //int plGetCursor(PLGraphicsIn *gin);
1018 
1019 // Translates relative device coordinates to world coordinates.
1020 //int plTranslateCursor(PLGraphicsIn *gin);
1021 
1022 
1023 
1024 extern ( C ) :
1025 
1026 alias double PLFLT;
1027 
1028 // This is apparently portable if stdint.h exists.
1029 // A reasonable back-up in case stdint.h does not exist on the platform.
1030 alias uint PLUNICODE;
1031 alias int PLINT;
1032 
1033 // For identifying logical (boolean) arguments
1035 
1036 // For passing user data, as with X's XtPointer
1037 alias void* PLPointer;
1038 
1039 //--------------------------------------------------------------------------
1040 // Complex data types and other good stuff
1041 //--------------------------------------------------------------------------
1042 
1043 // Switches for escape function call.
1044 // Some of these are obsolete but are retained in order to process
1045 // old metafiles.
1046 
1047 const PLESC_SET_RGB = 1;
1049 const PLESC_SET_LPB = 3;
1050 const PLESC_EXPOSE = 4;
1051 const PLESC_RESIZE = 5;
1052 const PLESC_REDRAW = 6;
1053 const PLESC_TEXT = 7;
1054 const PLESC_GRAPH = 8;
1055 const PLESC_FILL = 9;
1056 const PLESC_DI = 10;
1057 const PLESC_FLUSH = 11;
1058 const PLESC_EH = 12;
1059 const PLESC_GETC = 13;
1060 const PLESC_SWIN = 14;
1062 const PLESC_XORMOD = 16;
1064 const PLESC_CLEAR = 18;
1065 const PLESC_DASH = 19;
1066 const PLESC_HAS_TEXT = 20;
1067 const PLESC_IMAGE = 21;
1068 const PLESC_IMAGEOPS = 22;
1069 const PLESC_PL2DEVCOL = 23;
1070 const PLESC_DEV2PLCOL = 24;
1071 const PLESC_SETBGFG = 25;
1072 const PLESC_DEVINIT = 26;
1073 
1074 // image operations
1075 const ZEROW2B = 1;
1076 const ZEROW2D = 2;
1077 const ONEW2B = 3;
1078 const ONEW2D = 4;
1079 
1080 // Window parameter tags
1081 const PLSWIN_DEVICE = 1;
1082 const PLSWIN_WORLD = 2;
1083 
1084 // Axis label tags
1085 const PL_X_AXIS = 1; // The x-axis
1086 const PL_Y_AXIS = 2; // The y-axis
1087 const PL_Z_AXIS = 3; // The z-axis
1088 
1089 // PLplot Option table & support constants
1090 
1091 // Option-specific settings
1092 const PL_OPT_ENABLED = 0x0001;
1093 const PL_OPT_ARG = 0x0002;
1094 const PL_OPT_NODELETE = 0x0004;
1095 const PL_OPT_INVISIBLE = 0x0008;
1096 const PL_OPT_DISABLED = 0x0010;
1097 
1098 // Option-processing settings -- mutually exclusive
1099 const PL_OPT_FUNC = 0x0100;
1100 const PL_OPT_BOOL = 0x0200;
1101 const PL_OPT_INT = 0x0400;
1102 const PL_OPT_FLOAT = 0x0800;
1103 const PL_OPT_STRING = 0x1000;
1104 
1105 // Global mode settings
1106 // These override per-option settings
1107 const PL_PARSE_PARTIAL = 0x0000;
1108 const PL_PARSE_FULL = 0x0001;
1109 const PL_PARSE_QUIET = 0x0002;
1110 
1111 // processing
1112 const PL_PARSE_NODELETE = 0x0004;
1113 const PL_PARSE_SHOWALL = 0x0008;
1114 const PL_PARSE_OVERRIDE = 0x0010;
1115 const PL_PARSE_NOPROGRAM = 0x0020;
1116 const PL_PARSE_NODASH = 0x0040;
1117 const PL_PARSE_SKIP = 0x0080;
1118 
1119 // FCI (font characterization integer) related constants.
1120 const PL_FCI_MARK = 0x80000000;
1121 const PL_FCI_IMPOSSIBLE = 0x00000000;
1124 
1125 // These define hexpower values corresponding to each font attribute.
1127 const PL_FCI_FAMILY = 0x0;
1128 const PL_FCI_STYLE = 0x1;
1129 
1130 // These are legal values for font family attribute
1131 const PL_FCI_WEIGHT = 0x2;
1132 const PL_FCI_SANS = 0x0;
1133 const PL_FCI_SERIF = 0x1;
1134 const PL_FCI_MONO = 0x2;
1135 const PL_FCI_SCRIPT = 0x3;
1136 
1137 // These are legal values for font style attribute
1138 const PL_FCI_SYMBOL = 0x4;
1139 const PL_FCI_UPRIGHT = 0x0;
1140 const PL_FCI_ITALIC = 0x1;
1141 
1142 // These are legal values for font weight attribute
1143 const PL_FCI_MEDIUM = 0x0;
1144 const PL_FCI_BOLD = 0x1;
1145 const PL_FCI_OBLIQUE = 0x2;
1146 
1147 // Obsolete names
1148 
1149 // Option table definition
1150 
1151 struct _N1
1152 {
1153  string opt;
1154  int function( char *, char *, void * ) handler;
1156  void *var;
1157  int mode;
1158  string syntax;
1159  string desc;
1160 }
1161 alias _N1 PLOptionTable;
1162 
1163 // PLplot Graphics Input structure
1164 
1165 
1166 const PL_MAXKEY = 16;
1167 struct _N2
1168 {
1169  int type;
1170  uint state;
1171  uint keysym;
1172  uint button;
1174  char [16] string;
1175  int pX;
1176  int pY;
1181 }
1182 alias _N2 PLGraphicsIn;
1183 
1184 // Structure for describing the plot window
1185 
1186 
1187 const PL_MAXWINDOWS = 64;
1188 struct _N3
1189 {
1198 }
1199 alias _N3 PLWindow;
1200 
1201 // Structure for doing display-oriented operations via escape commands
1202 // May add other attributes in time
1203 
1204 struct _N4
1205 {
1206  uint x;
1207  uint y;
1208  uint width;
1209  uint height;
1210 }
1211 alias _N4 PLDisplay;
1212 
1213 // Macro used (in some cases) to ignore value of argument
1214 // I don't plan on changing the value so you can hard-code it
1215 
1216 const int PL_NOTSET = -42;
1217 
1218 // See plcont.c for examples of the following
1219 
1220 //
1221 // PLfGrid is for passing (as a pointer to the first element) an arbitrarily
1222 // dimensioned array. The grid dimensions MUST be stored, with a maximum of 3
1223 // dimensions assumed for now.
1224 //
1225 
1226 struct _N5
1227 {
1232 }
1233 alias _N5 PLfGrid;
1234 
1235 //
1236 // PLfGrid2 is for passing (as an array of pointers) a 2d function array. The
1237 // grid dimensions are passed for possible bounds checking.
1238 //
1239 
1240 struct _N6
1241 {
1245 }
1246 alias _N6 PLfGrid2;
1247 
1248 //
1249 // NOTE: a PLfGrid3 is a good idea here but there is no way to exploit it yet
1250 // so I'll leave it out for now.
1251 //
1252 
1253 //
1254 // PLcGrid is for passing (as a pointer to the first element) arbitrarily
1255 // dimensioned coordinate transformation arrays. The grid dimensions MUST be
1256 // stored, with a maximum of 3 dimensions assumed for now.
1257 //
1258 
1259 struct _N7
1260 {
1267 }
1268 alias _N7 c_PLcGrid;
1269 
1270 //
1271 // PLcGrid2 is for passing (as arrays of pointers) 2d coordinate
1272 // transformation arrays. The grid dimensions are passed for possible bounds
1273 // checking.
1274 //
1275 
1276 struct _N8
1277 {
1283 }
1284 alias _N8 c_PLcGrid2;
1285 
1286 //
1287 // NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet
1288 // so I'll leave it out for now.
1289 //
1290 
1291 // PLColor is the usual way to pass an rgb color value.
1292 
1293 struct _N9
1294 {
1295  ubyte r;
1296  ubyte g;
1297  ubyte b;
1299  char *name;
1300 }
1301 alias _N9 PLColor;
1302 
1303 // PLControlPt is how cmap1 control points are represented.
1304 
1305 struct _N10
1306 {
1313 }
1314 alias _N10 PLControlPt;
1315 
1316 // A PLBufferingCB is a control block for interacting with devices
1317 // that support double buffering.
1318 
1319 struct _N11
1320 {
1323 }
1324 alias _N11 PLBufferingCB;
1325 
1328 
1330 
1331 //--------------------------------------------------------------------------* * BRAINDEAD-ness
1332 //
1333 // Some systems allow the Fortran & C namespaces to clobber each other.
1334 // For PLplot to work from Fortran on these systems, we must name the the
1335 // externally callable C functions something other than their Fortran entry
1336 // names. In order to make this as easy as possible for the casual user,
1337 // yet reversible to those who abhor my solution, I have done the
1338 // following:
1339 //
1340 // The C-language bindings are actually different from those
1341 // described in the manual. Macros are used to convert the
1342 // documented names to the names used in this package. The
1343 // user MUST include plplot.h in order to get the name
1344 // redefinition correct.
1345 //
1346 // Sorry to have to resort to such an ugly kludge, but it is really the
1347 // best way to handle the situation at present. If all available
1348 // compilers offer a way to correct this stupidity, then perhaps we can
1349 // eventually reverse it.
1350 //
1351 // If you feel like screaming at someone (I sure do), please
1352 // direct it at your nearest system vendor who has a braindead shared
1353 // C/Fortran namespace. Some vendors do offer compiler switches that
1354 // change the object names, but then everybody who wants to use the
1355 // package must throw these same switches, leading to no end of trouble.
1356 //
1357 // Note that this definition should not cause any noticable effects except
1358 // when debugging PLplot calls, in which case you will need to remember
1359 // the real function names (same as before but with a 'c_' prepended).
1360 //
1361 // Also, to avoid macro conflicts, the BRAINDEAD part must not be expanded
1362 // in the stub routines.
1363 //
1364 // Aside: the reason why a shared Fortran/C namespace is deserving of the
1365 // BRAINDEAD characterization is that it completely precludes the the kind
1366 // of universal API that is attempted (more or less) with PLplot, without
1367 // Herculean efforts (e.g. remapping all of the C bindings by macros as
1368 // done here). The vendors of such a scheme, in order to allow a SINGLE
1369 // type of argument to be passed transparently between C and Fortran,
1370 // namely, a pointer to a conformable data type, have slammed the door on
1371 // insertion of stub routines to handle the conversions needed for other
1372 // data types. Intelligent linkers could solve this problem, but these are
1373 // not anywhere close to becoming universal. So meanwhile, one must live
1374 // with either stub routines for the inevitable data conversions, or a
1375 // different API. The former is what is used here, but is made far more
1376 // difficult in a braindead shared Fortran/C namespace.
1377 //--------------------------------------------------------------------------
1378 
1379 
1380 
1381 
1385 //alias c_plaxes plaxes;
1386 //alias c_plbin plbin;
1388 //alias c_plbox plbox;
1389 //alias c_plbox3 plbox3;
1397 //alias c_plcolorbar plcolorbar;
1399 //alias c_plcont plcont;
1407 //alias c_plerrx plerrx;
1408 //alias c_plerry plerry;
1410 //alias c_plfill plfill;
1411 //alias c_plfill3 plfill3;
1421 //alias c_plgdev plgdev;
1427 //alias c_plgfnam plgfnam;
1433 //alias c_plgriddata plgriddata;
1436 //alias c_plgver plgver;
1442 //alias c_plhist plhist;
1445 //alias c_plimage plimage;
1446 //alias c_plimagefr plimagefr;
1449 //alias c_pllab pllab;
1450 //alias c_pllegend pllegend;
1452 //alias c_plline plline;
1454 //alias c_plline3 plline3;
1456 //alias c_plmap plmap;
1458 //alias c_plmesh plmesh;
1459 //alias c_plmeshc plmeshc;
1461 //alias c_plmtex plmtex;
1462 //alias c_plmtex3 plmtex3;
1463 //alias c_plot3d plot3d;
1464 //alias c_plot3dc plot3dc;
1465 //alias c_plot3dcl plot3dcl;
1466 //alias c_plparseopts plparseopts;
1467 //alias c_plpat plpat;
1468 //alias c_plpoin plpoin;
1469 //alias c_plpoin3 plpoin3;
1470 //alias c_plpoly3 plpoly3;
1473 //alias c_plptex plptex;
1474 //alias c_plptex3 plptex3;
1481 //alias c_plscmap0 plscmap0;
1482 //alias c_plscmap0a plscmap0a;
1484 //alias c_plscmap1 plscmap1;
1485 //alias c_plscmap1a plscmap1a;
1486 //alias c_plscmap1l plscmap1l;
1487 //alias c_plscmap1la plscmap1la;
1496 // alias c_plsdev plsdev;
1504 //alias c_plsetopt plsetopt;
1507 // alias c_plsfnam plsfnam;
1509 //alias c_plshade plshade;
1510 //alias c_plshades plshades;
1516 // alias c_plspal0 plspal0;
1517 // alias c_plspal1 plspal1;
1523 //alias c_plstart plstart;
1526 //alias c_plstripc plstripc;
1528 //alias c_plstring plstring;
1529 //alias c_plstring3 plstring3;
1530 //alias c_plstyl plstyl;
1531 //alias c_plsurf3d plsurf3d;
1532 //alias c_plsurf3dl plsurf3dl;
1533 //alias c_plsvect plsvect;
1537 //alias c_plsym plsym;
1540 //alias c_pltimefmt pltimefmt;
1542 //alias c_plvect plvect;
1549 
1551 
1552 
1553 // Redefine some old function names for backward compatibility
1554 
1555 
1556 alias pleop plclr;
1565 
1566 
1567 //--------------------------------------------------------------------------* * Function Prototypes
1568 //--------------------------------------------------------------------------
1569 
1570 
1571 // All void types
1572 // C routines callable from stub routines come first
1573 
1574 // set the format of the contour labels
1575 void c_pl_setcontlabelformat( PLINT lexp, PLINT sigdig );
1576 
1577 // set offset and spacing of contour labels
1578 void c_pl_setcontlabelparam( PLFLT offset, PLFLT size, PLFLT spacing, PLINT active );
1579 
1580 // Advance to subpage "page", or to the next one if "page" = 0.
1581 void c_pladv( PLINT page );
1582 
1583 // simple arrow plotter.
1584 void c_plvect( PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale,
1585  void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
1586 void c_plsvect( PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill );
1587 
1588 // This functions similarly to plbox() except that the origin of the axes
1589 // is placed at the user-specified point (x0, y0).
1590 void c_plaxes( PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub,
1591  const char *yopt, PLFLT ytick, PLINT nysub );
1592 
1593 // Flags for plbin() - opt argument
1594 const PL_BIN_DEFAULT = 0;
1595 const PL_BIN_CENTRED = 1;
1597 const PL_BIN_NOEMPTY = 4;
1598 
1599 // Plot a histogram using x to store data values and y to store frequencies
1600 void c_plbin( PLINT nbin, PLFLT *x, PLFLT *y, PLINT opt );
1601 
1602 // Start new page. Should only be used with pleop().
1603 void c_plbop();
1604 
1605 // This draws a box around the current viewport.
1606 void c_plbox( const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub );
1607 
1608 // This is the 3-d analogue of plbox().
1609 void c_plbox3( const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx, const char *yopt,
1610  const char *ylabel, PLFLT ytick, PLINT nsuby, const char *zopt, const char *zlabel,
1611  PLFLT ztick, PLINT nsubz );
1612 
1613 // Calculate broken-down time from continuous time for current stream.
1614 void c_plbtime( PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime );
1615 
1616 // Setup a user-provided custom labeling function
1617 void c_plslabelfunc( void function( PLINT, PLFLT, char*, PLINT, PLPointer ) labelfunc,
1618  PLPointer label_data );
1619 
1620 // Calculate world coordinates and subpage from relative device coordinates.
1621 void c_plcalc_world( PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window );
1622 
1623 // Plot an arc
1624 void c_plarc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2,
1625  PLFLT rotate, PLBOOL fill );
1626 
1627 // Clear current subpage.
1628 void c_plclear();
1629 
1630 // Set color, map 0. Argument is integer between 0 and 15.
1631 void c_plcol0( PLINT icol0 );
1632 
1633 // Set color, map 1. Argument is a float between 0. and 1.
1634 void c_plcol1( PLFLT col1 );
1635 
1636 
1637 // Configure transformation between continuous and broken-down time (and
1638 // vice versa) for current stream.
1639 void c_plconfigtime( PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset,
1640  PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec );
1641 
1642 // Draws a contour plot from data in f(nx,ny). Is just a front-end to
1643 // plfcont, with a particular choice for f2eval and f2eval_data.
1644 //
1645 void c_plcont( PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly,
1646  PLFLT *clevel, PLINT nlevel,
1647  void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
1648 
1649 // Draws a contour plot using the function evaluator f2eval and data stored
1650 // by way of the f2eval_data pointer. This allows arbitrary organizations
1651 // of 2d array data to be used.
1652 //
1653 void plfcont( PLFLT function( PLINT, PLINT, PLPointer ) f2eval, PLPointer f2eval_data, PLINT nx, PLINT ny,
1654  PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel,
1655  void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
1656 
1657 // Copies state parameters from the reference stream to the current stream.
1658 void c_plcpstrm( PLINT iplsr, PLBOOL flags );
1659 
1660 // Calculate continuous time from broken-down time for current stream.
1661 void c_plctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime );
1662 
1663 // Converts input values from relative device coordinates to relative plot
1664 // coordinates.
1665 void pldid2pc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax );
1666 
1667 // Converts input values from relative plot coordinates to relative
1668 // device coordinates.
1669 void pldip2dc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax );
1670 
1671 // End a plotting session for all open streams.
1672 void c_plend();
1673 
1674 // End a plotting session for the current stream only.
1675 void c_plend1();
1676 
1677 // Simple interface for defining viewport and window.
1678 void c_plenv( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis );
1679 
1680 // similar to plenv() above, but in multiplot mode does not advance the subpage,
1681 // instead the current subpage is cleared
1682 void c_plenv0( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis );
1683 
1684 // End current page. Should only be used with plbop().
1685 void c_pleop();
1686 
1687 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i))
1688 void c_plerrx( PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y );
1689 
1690 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i))
1691 void c_plerry( PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax );
1692 
1693 // Advance to the next family file on the next new page
1694 void c_plfamadv();
1695 
1696 // Pattern fills the polygon bounded by the input points.
1697 void c_plfill( PLINT n, PLFLT *x, PLFLT *y );
1698 
1699 // Pattern fills the 3d polygon bounded by the input points.
1700 void c_plfill3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z );
1701 
1702 // Flushes the output stream. Use sparingly, if at all.
1703 void c_plflush();
1704 
1705 // Sets the global font flag to 'ifont'.
1706 void c_plfont( PLINT ifont );
1707 
1708 // Load specified font set.
1709 void c_plfontld( PLINT fnt );
1710 
1711 // Get character default height and current (scaled) height
1712 void c_plgchr( PLFLT *p_def, PLFLT *p_ht );
1713 
1714 // Returns 8 bit RGB values for given color from color map 0
1715 void c_plgcol0( PLINT icol0, PLINT *r, PLINT *g, PLINT *b );
1716 
1717 // Returns 8 bit RGB values for given color from color map 0 and alpha value
1718 void c_plgcol0a( PLINT icol0, PLINT *r, PLINT *g, PLINT *b, PLFLT *a );
1719 
1720 // Returns the background color by 8 bit RGB value
1721 void c_plgcolbg( PLINT *r, PLINT *g, PLINT *b );
1722 
1723 // Returns the background color by 8 bit RGB value and alpha value
1724 void c_plgcolbga( PLINT *r, PLINT *g, PLINT *b, PLFLT *a );
1725 
1726 // Returns the current compression setting
1727 void c_plgcompression( PLINT *compression );
1728 
1729 // Get the current device (keyword) name
1730 void c_plgdev( char *p_dev );
1731 
1732 // Retrieve current window into device space
1733 void c_plgdidev( PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy );
1734 
1735 // Get plot orientation
1736 void c_plgdiori( PLFLT *p_rot );
1737 
1738 // Retrieve current window into plot space
1739 void c_plgdiplt( PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax );
1740 
1741 // Get FCI (font characterization integer)
1742 
1743 void c_plgfci( PLUNICODE *pfci );
1744 
1745 // Get family file parameters
1746 
1747 void c_plgfam( PLINT *p_fam, PLINT *p_num, PLINT *p_bmax );
1748 
1749 // Get the (current) output file name. Must be preallocated to >80 bytes
1750 void c_plgfnam( char *fnam );
1751 
1752 // Get the current font family, style and weight
1753 void c_plgfont( PLINT *p_family, PLINT *p_style, PLINT *p_weight );
1754 
1755 // Get the (current) run level.
1756 void c_plglevel( PLINT *p_level );
1757 
1758 // Get output device parameters.
1759 void c_plgpage( PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng,
1760  PLINT *p_xoff, PLINT *p_yoff );
1761 
1762 // Switches to graphics screen.
1763 void c_plgra();
1764 
1765 // Draw gradient in polygon.
1766 void c_plgradient( PLINT n, PLFLT *x, PLFLT *y, PLFLT angle );
1767 
1768 // grid irregularly sampled data
1769 void c_plgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx,
1770  PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data );
1771 
1772 // type of gridding algorithm for plgriddata()
1773 const GRID_CSA = 1;
1774 const GRID_DTLI = 2;
1775 const GRID_NNI = 3;
1776 const GRID_NNIDW = 4;
1777 const GRID_NNLI = 5;
1778 const GRID_NNAIDW = 6;
1779 
1780 // Get subpage boundaries in absolute coordinates
1781 void c_plgspa( PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax );
1782 
1783 // Get current stream number.
1784 void c_plgstrm( PLINT *p_strm );
1785 
1786 // Get the current library version number
1787 void c_plgver( char *p_ver );
1788 
1789 // Get viewport boundaries in normalized device coordinates
1790 void c_plgvpd( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax );
1791 
1792 // Get viewport boundaries in world coordinates
1793 void c_plgvpw( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax );
1794 
1795 // Get x axis labeling parameters
1796 void c_plgxax( PLINT *p_digmax, PLINT *p_digits );
1797 
1798 // Get y axis labeling parameters
1799 void c_plgyax( PLINT *p_digmax, PLINT *p_digits );
1800 
1801 // Get z axis labeling parameters
1802 void c_plgzax( PLINT *p_digmax, PLINT *p_digits );
1803 
1804 // Flags for plhist() - opt argument; note: some flags are passed to
1805 // plbin() for the actual plotting
1810 const PL_HIST_NOEMPTY = 16;
1811 
1812 // Draws a histogram of n values of a variable in array data[0..n-1]
1813 void c_plhist( PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt );
1814 
1815 // Set current color (map 0) by hue, lightness, and saturation.
1816 void c_plhls( PLFLT h, PLFLT l, PLFLT s );
1817 
1818 // Functions for converting between HLS and RGB color space
1819 void c_plhlsrgb( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b );
1820 
1821 // Initializes PLplot, using preset or default options
1822 void c_plinit();
1823 
1824 // Draws a line segment from (x1, y1) to (x2, y2).
1825 void c_pljoin( PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 );
1826 
1827 // Simple routine for labelling graphs.
1828 void c_pllab( const char *xlabel, const char *ylabel, const char *tlabel );
1829 
1830 // Flags used for position argument of both pllegend and plcolorbar
1839 
1840 // Flags for pllegend
1841 const PL_LEGEND_NONE = 1;
1843 const PL_LEGEND_LINE = 4;
1849 
1850 // Flags for plcolorbar
1868 
1869 
1870 // Routine for drawing discrete line, symbol, or cmap0 legends
1871 void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height,
1872  PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width,
1873  PLINT bg_color, PLINT bb_color, PLINT bb_style,
1874  PLINT nrow, PLINT ncolumn,
1875  PLINT nlegend, PLINT *opt_array,
1876  PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing,
1877  PLFLT text_justification,
1878  PLINT *text_colors, const char **text,
1879  PLINT *box_colors, PLINT *box_patterns,
1880  PLFLT *box_scales, PLFLT *box_line_widths,
1881  PLINT *line_colors, PLINT *line_styles,
1882  PLFLT *line_widths,
1883  PLINT *symbol_colors, PLFLT *symbol_scales,
1884  PLINT *symbol_numbers, const char **symbols );
1885 
1886 // Routine for drawing continous colour legends
1887 void c_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height,
1888  PLINT opt, PLINT position, PLFLT x, PLFLT y,
1889  PLFLT x_length, PLFLT y_length,
1890  PLINT bg_color, PLINT bb_color, PLINT bb_style,
1891  PLFLT low_cap_color, PLFLT high_cap_color,
1892  PLINT cont_color, PLFLT cont_width,
1893  PLINT n_labels, const PLINT *label_opts, const char **label,
1894  PLINT n_axes, const char ** axis_opts,
1895  const PLFLT *ticks, const PLINT *sub_ticks,
1896  const PLINT *n_values, const PLFLT **values );
1897 
1898 // Sets position of the light source
1899 void c_pllightsource( PLFLT x, PLFLT y, PLFLT z );
1900 
1901 // Draws line segments connecting a series of points.
1902 void c_plline( PLINT n, PLFLT *x, PLFLT *y );
1903 
1904 // Draws a line in 3 space.
1905 void c_plline3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z );
1906 
1907 // Set line style.
1908 void c_pllsty( PLINT lin );
1909 
1910 // plot continental outline in world coordinates
1911 void c_plmap( void function( PLINT, PLFLT *, PLFLT* ) mapform, const char *type, PLFLT minlong,
1912  PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
1913 
1914 // Plot map outlines
1915 void c_plmapline( void function( PLINT, PLFLT *, PLFLT * ) mapform, const char *name,
1916  PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy,
1917  const PLINT *plotentries, PLINT nplotentries );
1918 
1919 // Plot map points
1920 void c_plmapstring( void function( PLINT, PLFLT *, PLFLT * ) mapform,
1921  const char *name, const char *string,
1922  PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy,
1923  const PLINT *plotentries, PLINT nplotentries );
1924 
1925 // Plot map text
1926 void c_plmaptex( void function( PLINT, PLFLT *, PLFLT * ) mapform,
1927  const char *name, PLFLT dx, PLFLT dy, PLFLT just, const char *text,
1928  PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy,
1929  PLINT plotentry );
1930 
1931 // Plot map fills
1932 void c_plmapfill( void function( PLINT, PLFLT *, PLFLT * ) mapform,
1933  const char *name, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy,
1934  const PLINT *plotentries, PLINT nplotentries );
1935 
1936 // Plot the latitudes and longitudes on the background.
1937 void c_plmeridians( void function( PLINT, PLFLT *, PLFLT* ) mapform, PLFLT dlong, PLFLT dlat,
1938  PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
1939 
1940 // Plots a mesh representation of the function z[x][y].
1941 void c_plmesh( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt );
1942 
1943 // Plots a mesh representation of the function z[x][y] with contour
1944 void c_plmeshc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
1945  PLFLT *clevel, PLINT nlevel );
1946 
1947 // Creates a new stream and makes it the default.
1948 void c_plmkstrm( PLINT *p_strm );
1949 
1950 // Prints out "text" at specified position relative to viewport
1951 void c_plmtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text );
1952 
1953 // Prints out "text" at specified position relative to viewport (3D)
1954 void c_plmtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text );
1955 
1956 // Plots a 3-d representation of the function z[x][y].
1957 void c_plot3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side );
1958 
1959 // Plots a 3-d representation of the function z[x][y] with contour.
1960 void c_plot3dc( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
1961  PLFLT *clevel, PLINT nlevel );
1962 
1963 // Plots a 3-d representation of the function z[x][y] with contour and
1964 // y index limits.
1965 void c_plot3dcl( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
1966  PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn,
1967  PLINT *indexymin, PLINT *indexymax );
1968 
1969 //
1970 // definitions for the opt argument in plot3dc() and plsurf3d()
1971 //
1972 // DRAW_LINEX *must* be 1 and DRAW_LINEY *must* be 2, because of legacy code!
1973 //
1974 const DRAW_LINEX = 1 << 0; // draw lines parallel to the X axis
1975 const DRAW_LINEY = 1 << 1; // draw lines parallel to the Y axis
1976 const DRAW_LINEXY = DRAW_LINEX | DRAW_LINEY; // draw lines parallel to both the X and Y axis
1977 const MAG_COLOR = 1 << 2; // draw the mesh with a color dependent of the magnitude
1978 const BASE_CONT = 1 << 3; // draw contour plot at bottom xy plane
1979 const TOP_CONT = 1 << 4; // draw contour plot at top xy plane
1980 const SURF_CONT = 1 << 5; // draw contour plot at surface
1981 const DRAW_SIDES = 1 << 6; // draw sides
1982 const FACETED = 1 << 7; // draw outline for each square that makes up the surface
1983 const MESH = 1 << 8; // draw mesh
1984 
1985 //
1986 // valid options for plot3dc():
1987 //
1988 // DRAW_SIDES, BASE_CONT, TOP_CONT (not yet),
1989 // MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY.
1990 //
1991 // valid options for plsurf3d():
1992 //
1993 // MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES.
1994 //
1995 
1996 // Set fill pattern directly.
1997 void c_plpat( PLINT nlin, PLINT *inc, PLINT *del );
1998 
1999 // Draw a line connecting two points, accounting for coordinate transforms
2000 void c_plpath( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 );
2001 
2002 // Plots array y against x for n points using ASCII code "code".
2003 void c_plpoin( PLINT n, PLFLT *x, PLFLT *y, PLINT code );
2004 
2005 // Draws a series of points in 3 space.
2006 void c_plpoin3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code );
2007 
2008 // Draws a polygon in 3 space.
2009 void c_plpoly3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc );
2010 
2011 // Plots array y against x for n points using (UTF-8) text string
2012 void c_plstring( PLINT n, PLFLT *x, PLFLT *y, const char *text );
2013 
2014 // Draws a series of points (described by [UTF8] text string) in 3 space.
2015 void c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char * text );
2016 
2017 // Set the floating point precision (in number of places) in numeric labels.
2018 void c_plprec( PLINT setp, PLINT prec );
2019 
2020 // Set fill pattern, using one of the predefined patterns.
2021 void c_plpsty( PLINT patt );
2022 
2023 // Prints out "text" at world cooordinate (x,y).
2024 void c_plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, const char *text );
2025 
2026 // Prints out "text" at world cooordinate (x,y,z).
2027 void c_plptex3( PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, const char *text );
2028 
2029 // Random number generator based on Mersenne Twister.
2030 // Obtain real random number in range [0,1].
2031 PLFLT c_plrandd();
2032 
2033 // Replays contents of plot buffer to current device/file.
2034 void c_plreplot();
2035 
2036 // Set line color by red, green, blue from 0. to 1.
2037 
2038 void c_plrgb( PLFLT r, PLFLT g, PLFLT b );
2039 
2040 // Set line color by 8 bit RGB values.
2041 
2042 void c_plrgb1( PLINT r, PLINT g, PLINT b );
2043 
2044 // Functions for converting between HLS and RGB color space
2045 
2046 void c_plrgbhls( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s );
2047 
2048 // Set character height.
2049 
2050 void c_plschr( PLFLT def, PLFLT scale );
2051 
2052 // Set color map 0 colors by 8 bit RGB values
2053 void c_plscmap0( PLINT *r, PLINT *g, PLINT *b, PLINT ncol0 );
2054 
2055 // Set color map 0 colors by 8 bit RGB values and alpha values
2056 void c_plscmap0a( PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol0 );
2057 
2058 // Set number of colors in cmap 0
2059 void c_plscmap0n( PLINT ncol0 );
2060 
2061 // Set color map 1 colors by 8 bit RGB values
2062 void c_plscmap1( PLINT *r, PLINT *g, PLINT *b, PLINT ncol1 );
2063 
2064 // Set color map 1 colors by 8 bit RGB and alpha values
2065 void c_plscmap1a( PLINT *r, PLINT *g, PLINT *b, PLFLT *a, PLINT ncol1 );
2066 
2067 // Set color map 1 colors using a piece-wise linear relationship between
2068 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
2069 void c_plscmap1l( PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *alt_hue_path );
2070 
2071 // Set color map 1 colors using a piece-wise linear relationship between
2072 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
2073 // Will also linear interpolate alpha values.
2074 void c_plscmap1la( PLBOOL itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLFLT *a, PLBOOL *alt_hue_path );
2075 
2076 // Set number of colors in cmap 1
2077 void c_plscmap1n( PLINT ncol1 );
2078 
2079 // Set the color map 1 range used in continuous plots
2080 void c_plscmap1_range( PLFLT min_color, PLFLT max_color );
2081 
2082 // Get the color map 1 range used in continuous plots
2083 void c_plgcmap1_range( PLFLT *min_color, PLFLT *max_color );
2084 
2085 // Set a given color from color map 0 by 8 bit RGB value
2086 void c_plscol0( PLINT icol0, PLINT r, PLINT g, PLINT b );
2087 
2088 // Set a given color from color map 0 by 8 bit RGB value
2089 void c_plscol0a( PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a );
2090 
2091 // Set the background color by 8 bit RGB value
2092 void c_plscolbg( PLINT r, PLINT g, PLINT b );
2093 
2094 // Set the background color by 8 bit RGB value and alpha value
2095 void c_plscolbga( PLINT r, PLINT g, PLINT b, PLFLT a );
2096 
2097 // Used to globally turn color output on/off
2098 void c_plscolor( PLINT color );
2099 
2100 // Set the compression level
2101 
2102 void c_plscompression( PLINT compression );
2103 
2104 // Set the device (keyword) name
2105 void c_plsdev( const char *devname );
2106 
2107 // Set window into device space using margin, aspect ratio, and
2108 // justification
2109 
2110 void c_plsdidev( PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy );
2111 
2112 // Set up transformation from metafile coordinates.
2113 
2114 void c_plsdimap( PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm );
2115 
2116 // Set plot orientation, specifying rotation in units of pi/2.
2117 
2118 void c_plsdiori( PLFLT rot );
2119 
2120 // Set window into plot space
2121 
2123 
2124 // Set window into plot space incrementally (zoom)
2126 
2127 // Set seed for internal random number generator
2128 void c_plseed( uint s );
2129 
2130 // Set the escape character for text strings.
2131 void c_plsesc( char esc );
2132 
2133 // Set family file parameters
2134 
2135 void c_plsfam( PLINT fam, PLINT num, PLINT bmax );
2136 
2137 // Set FCI (font characterization integer)
2138 
2139 void c_plsfci( PLUNICODE fci );
2140 
2141 // Set the output file name.
2142 void c_plsfnam( const char *fnam );
2143 
2144 // Set the current font family, style and weight
2145 
2146 void c_plsfont( PLINT family, PLINT style, PLINT weight );
2147 
2148 // Shade region.
2149 void c_plshade( PLFLT **a, PLINT nx, PLINT ny, PLINT function( PLFLT, PLFLT ) defined, PLFLT left,
2150  PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap,
2151  PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color,
2152  PLFLT max_width, void function( PLINT, PLFLT *, PLFLT* ) fill, PLBOOL rectangular,
2153  void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
2154 
2155 void c_plshades( PLFLT **a, PLINT nx, PLINT ny, PLINT function( PLFLT, PLFLT ) defined, PLFLT xmin,
2156  PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLFLT fill_width,
2157  PLINT cont_color, PLFLT cont_width, void function( PLINT, PLFLT *, PLFLT* ) fill,
2158  PLBOOL rectangular, void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr,
2159  PLPointer pltr_data );
2160 
2161 void plfshade( PLFLT function( PLINT, PLINT, PLPointer ) f2eval, PLPointer f2eval_data, PLFLT function( PLINT, PLINT, PLPointer ) c2eval, PLPointer c2eval_data, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void function( PLINT, PLFLT *, PLFLT * ) fill, PLBOOL rectangular, void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ) pltr, PLPointer pltr_data );
2162 
2163 // Set up lengths of major tick marks.
2164 
2165 void c_plsmaj( PLFLT def, PLFLT scale );
2166 
2167 // Set the memory area to be plotted (with the 'mem' driver)
2168 
2169 void c_plsmem( PLINT maxx, PLINT maxy, void *plotmem );
2170 
2171 // Set up lengths of minor tick marks.
2172 
2173 void c_plsmin( PLFLT def, PLFLT scale );
2174 
2175 // Set orientation. Must be done before calling plinit.
2176 
2177 void c_plsori( PLINT ori );
2178 
2179 // Set output device parameters. Usually ignored by the driver.
2180 void c_plspage( PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff );
2181 
2182 // Set the colors for color table 0 from a cmap0 file
2183 void c_plspal0( const char* filename );
2184 
2185 // Set the colors for color table 1 from a cmap1 file
2186 void c_plspal1( const char *filename, PLBOOL interpolate );
2187 
2188 // Set the pause (on end-of-page) status
2189 void c_plspause( PLBOOL pause );
2190 
2191 // Set stream number.
2192 
2193 void c_plsstrm( PLINT strm );
2194 
2195 // Set the number of subwindows in x and y
2196 
2197 void c_plssub( PLINT nx, PLINT ny );
2198 
2199 // Set symbol height.
2200 
2201 void c_plssym( PLFLT def, PLFLT scale );
2202 
2203 // Initialize PLplot, passing in the windows/page settings.
2204 void c_plstar( PLINT nx, PLINT ny );
2205 
2206 // Initialize PLplot, passing the device name and windows/page settings.
2207 void c_plstart( const char *devname, PLINT nx, PLINT ny );
2208 
2209 // Set the coordinate transform
2210 void c_plstransform( ct_func coordinate_transform = null, PLPointer coordinate_transform_data = null );
2211 
2212 // Add a point to a stripchart.
2213 void c_plstripa( PLINT id, PLINT pen, PLFLT x, PLFLT y );
2214 
2215 // Create 1d stripchart
2216 void c_plstripc( PLINT *id, const char *xspec, const char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, PLINT *colline, PLINT *styline, const char **legline, const char *labx, const char *laby, const char *labtop );
2217 
2218 // Deletes and releases memory used by a stripchart.
2219 void c_plstripd( PLINT id );
2220 
2221 // plots a 2d image (or a matrix too large for plshade() )
2222 void c_plimagefr( PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
2223  PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax,
2224  void function( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data );
2225 
2226 // plots a 2d image (or a matrix too large for plshade() ) - colors
2227 // automatically scaled
2228 void c_plimage( PLFLT **idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
2229  PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax );
2230 
2231 // Set up a new line style
2232 void c_plstyl( PLINT nms, PLINT *mark, PLINT *space );
2233 
2234 // Plots the 3d surface representation of the function z[x][y].
2235 void c_plsurf3d( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt,
2236  PLFLT *clevel, PLINT nlevel );
2237 
2238 // Plots the 3d surface representation of the function z[x][y] with y
2239 // index limits.
2240 void c_plsurf3dl( PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel,
2241  PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax );
2242 
2243 // Sets the edges of the viewport to the specified absolute coordinates
2244 void c_plsvpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
2245 
2246 // Set x axis labeling parameters
2247 void c_plsxax( PLINT digmax, PLINT digits );
2248 
2249 // Set inferior X window
2250 void plsxwin( PLINT window_id );
2251 
2252 // Set y axis labeling parameters
2253 void c_plsyax( PLINT digmax, PLINT digits );
2254 
2255 // Plots array y against x for n points using Hershey symbol "code"
2256 void c_plsym( PLINT n, PLFLT *x, PLFLT *y, PLINT code );
2257 
2258 // Set z axis labeling parameters
2259 
2260 void c_plszax( PLINT digmax, PLINT digits );
2261 
2262 // Switches to text screen.
2263 
2264 void c_pltext();
2265 
2266 // Set the format for date / time labels
2267 void c_pltimefmt( const char *fmt );
2268 
2269 // Sets the edges of the viewport with the given aspect ratio, leaving
2270 // room for labels.
2271 
2272 void c_plvasp( PLFLT aspect );
2273 
2274 // Creates the largest viewport of the specified aspect ratio that fits
2275 // within the specified normalized subpage coordinates.
2276 
2277 void c_plvpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect );
2278 
2279 // Creates a viewport with the specified normalized subpage coordinates.
2280 
2281 void c_plvpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
2282 
2283 // Defines a "standard" viewport with seven character heights for
2284 // the left margin and four character heights everywhere else.
2285 
2286 void c_plvsta();
2287 
2288 // Set up a window for three-dimensional plotting.
2289 
2290 void c_plw3d( PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin0, PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0, PLFLT zmax0, PLFLT alt, PLFLT az );
2291 
2292 // Set pen width.
2293 
2294 void c_plwidth( PLFLT width );
2295 
2296 // Set up world coordinates of the viewport boundaries (2d plots).
2297 
2298 void c_plwind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
2299 
2300 // set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device
2301 
2302 void c_plxormod( PLBOOL mode, PLBOOL *status );
2303 
2304 //--------------------------------------------------------------------------* * Functions for use from C or C++ only
2305 //--------------------------------------------------------------------------
2306 
2307 // Returns a list of file-oriented device names and their menu strings
2308 
2309 void plgFileDevs( char ***p_menustr, char ***p_devname, int *p_ndev );
2310 
2311 // Returns a list of all device names and their menu strings
2312 
2313 void plgDevs( char ***p_menustr, char ***p_devname, int *p_ndev );
2314 
2315 // Set the function pointer for the keyboard event handler
2316 
2317 void plsKeyEH( void function( PLGraphicsIn *, void *, int * ) KeyEH, void *KeyEH_data );
2318 
2319 // Set the function pointer for the (mouse) button event handler
2320 
2321 void plsButtonEH( void function( PLGraphicsIn *, void *, int * ) ButtonEH, void *ButtonEH_data );
2322 
2323 // Sets an optional user bop handler
2324 
2325 void plsbopH( void function( void *, int * ) handler, void *handler_data );
2326 
2327 // Sets an optional user eop handler
2328 
2329 void plseopH( void function( void *, int * ) handler, void *handler_data );
2330 
2331 // Set the variables to be used for storing error info
2332 
2333 void plsError( PLINT *errcode, const char *errmsg );
2334 
2335 // Sets an optional user exit handler.
2336 
2337 void plsexit( int function( const char * ) handler );
2338 
2339 // Sets an optional user abort handler.
2340 
2341 void plsabort( void function( const char * ) handler );
2342 
2343 // Transformation routines
2344 
2345 // Identity transformation.
2346 void pltr0( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2347 
2348 // Does linear interpolation from singly dimensioned coord arrays.
2349 void pltr1( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2350 
2351 // Does linear interpolation from doubly dimensioned coord arrays
2352 // (column dominant, as per normal C 2d arrays).
2353 void pltr2( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2354 
2355 // Just like pltr2() but uses pointer arithmetic to get coordinates from
2356 // 2d grid tables.
2357 void pltr2p( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, PLPointer pltr_data );
2358 
2359 // Identity transformation for plots from Fortran.
2360 void pltr0f( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data );
2361 
2362 // Does linear interpolation from doubly dimensioned coord arrays
2363 // (row dominant, i.e. Fortran ordering).
2364 void pltr2f( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data );
2365 
2366 // Function evaluators
2367 
2368 // Does a lookup from a 2d function array. Array is of type (PLFLT **),
2369 // and is column dominant (normal C ordering).
2370 
2371 PLFLT plf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data );
2372 
2373 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
2374 // and is column dominant (normal C ordering).
2375 
2376 PLFLT plf2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data );
2377 
2378 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
2379 // and is row dominant (Fortran ordering).
2380 
2381 PLFLT plf2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data );
2382 
2383 // Command line parsing utilities
2384 // Clear internal option table info structure.
2385 void plClearOpts();
2386 
2387 // Reset internal option table info structure.
2388 void plResetOpts();
2389 
2390 // Merge user option table into internal info structure.
2391 
2392 int plMergeOpts( PLOptionTable *options, const char *name, const char **notes );
2393 
2394 // Set the strings used in usage and syntax messages.
2395 
2396 void plSetUsage( const char *program_string, const char *usage_string );
2397 
2398 // Process input strings, treating them as an option and argument pair.
2399 int c_plsetopt( const char *opt, const char *optarg );
2400 
2401 // Process options list using current options info.
2402 int c_plparseopts( int *p_argc, const char **argv, PLINT mode );
2403 
2404 // Print usage & syntax message.
2405 
2406 void plOptUsage();
2407 
2408 // Miscellaneous
2409 
2410 // Get the escape character for text strings.
2411 
2412 void plgesc( char *p_esc );
2413 
2414 // Front-end to driver escape function.
2415 
2416 void pl_cmd( PLINT op, void *ptr );
2417 
2418 // Return full pathname for given file if executable
2419 
2420 int plFindName( char *p );
2421 
2422 // Looks for the specified executable file according to usual search path.
2423 
2424 char * plFindCommand( const char *fn );
2425 
2426 // Gets search name for file by concatenating the dir, subdir, and file
2427 // name, allocating memory as needed.
2428 
2429 void plGetName( const char *dir, const char *subdir, const char *filename, char **filespec );
2430 
2431 // Prompts human to input an integer in response to given message.
2432 
2433 PLINT plGetInt( const char *s );
2434 
2435 // Prompts human to input a float in response to given message.
2436 
2437 PLFLT plGetFlt( const char *s );
2438 
2439 // Nice way to allocate space for a vectored 2d grid
2440 
2441 // Allocates a block of memory for use as a 2-d grid of PLFLT's.
2442 
2443 void plAlloc2dGrid( PLFLT ***f, PLINT nx, PLINT ny );
2444 
2445 // Frees a block of memory allocated with plAlloc2dGrid().
2446 
2447 void plFree2dGrid( PLFLT **f, PLINT nx, PLINT ny );
2448 
2449 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid().
2450 void plMinMax2dGrid( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmax, PLFLT *fmin );
2451 
2452 // Wait for graphics input event and translate to world coordinates
2453 
2454 int plGetCursor( PLGraphicsIn *gin );
2455 
2456 // Translates relative device coordinates to world coordinates.
2457 
2458 int plTranslateCursor( PLGraphicsIn *gin );
2459