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;
43 size_t ny = a[0].length;
46 for (
size_t i = 0; i < nx; i++ )
48 assert( ny == a[i].length,
"convert_array(): Array must be 2 dimensional!" );
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;
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!" );
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!" );
85 c.nx = cast(
PLINT) cgrid.xg.length;
87 c.ny = cast(
PLINT) cgrid.yg.length;
89 c.nz = cast(
PLINT) cgrid.zg.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!" );
105 c2.nx = cast(
PLINT) cgrid2.xg.length;
106 c2.ny = cast(
PLINT) cgrid2.xg[0].length;
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!" );
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!" );
124 assert( npts == arrowy.length,
"plsvect(): Arrays must be of same length!" );
125 c_plsvect( arrowx.ptr, arrowy.ptr, npts, fill );
133 c_plaxes( x0, y0, toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub );
140 assert( nbin == y.length,
"plbin(): Arrays must be of same length!" );
141 c_plbin( nbin, x.ptr, y.ptr, opt );
147 c_plbox( toStringz( xopt ), xtick, nxsub, toStringz( yopt ), ytick, nysub );
152 string yopt,
string ylabel,
PLFLT ytick,
PLINT nsuby,
153 string zopt,
string zlabel,
PLFLT ztick,
PLINT nsubz )
155 c_plbox3( toStringz( xopt ), toStringz( xlabel ), xtick, nsubx,
156 toStringz( yopt ), toStringz( ylabel ), ytick, nsuby,
157 toStringz( zopt ), toStringz( zlabel ), ztick, nsubz );
167 PLINT[] label_opts,
string[] label,
172 PLINT n_labels = cast(
PLINT) label_opts.length;
175 for (
size_t i = 0; i < values.length; i++ )
177 n_values[i] = cast(
PLINT) values[i].length;
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!" );
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,
195 ticks.ptr, sub_ticks.ptr,
220 c.nx = cast(
PLINT) cgrid.xg.length;
222 c.ny = cast(
PLINT) cgrid.yg.length;
224 c.nz = cast(
PLINT) cgrid.zg.length;
240 c2.nx = cast(
PLINT) cgrid2.xg.length;
241 c2.ny = cast(
PLINT) cgrid2.xg[0].length;
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!" );
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!" );
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 );
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 );
285 assert( n == y.length,
"plfill(): Arrays must be of same 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!" );
303 p_dev = to!string( cdev.ptr );
311 fnam = to!string( cfnam.ptr );
318 assert( n == y.length,
"plgradient(): Arrays must be of same 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!" );
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!" );
334 c_plgriddata( x.ptr, y.ptr, z.ptr, npts, xg.ptr, nxg, yg.ptr, nyg,
convert_array( zg ), type, data );
342 p_ver = to!string( cver.ptr );
348 c_plhist( cast(
PLINT) data.length, data.ptr, datmin, datmax, nbin, opt );
352 void pllab(
string xlabel,
string ylabel,
string tlabel )
354 c_pllab( toStringz( xlabel ), toStringz( ylabel ), toStringz( tlabel ) );
364 PLFLT text_justification,
371 PLINT[] symbol_numbers,
string[] symbols )
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!" );
390 opt, position, x, y, plot_width,
391 bg_color, bb_color, bb_style,
393 nlegend, opt_array.ptr,
394 text_offset, text_scale, text_spacing,
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,
401 symbol_colors.ptr, symbol_scales.ptr,
402 symbol_numbers.ptr, symbolsz );
409 assert( n == y.length,
"plline(): Arrays must be of same 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!" );
426 c_plmap( mapform, toStringz( type ), minlong, maxlong, minlat, maxlat );
433 const PLINT[] plotentries )
436 c_plmapline( mapform, toStringz( name ), minx, maxx, miny, maxy, plotentries.ptr, n );
445 c_plmapstring( mapform, toStringz( name ), toStringz(
string ), minx, maxx, miny, maxy, plotentries.ptr, n );
453 c_plmaptex( mapform, toStringz( name ), dx, dy, just, toStringz( text ), minx, maxx, miny, maxy, plotentry );
458 const PLINT[] plotentries )
461 c_plmapfill( mapform, toStringz( name ), minx, maxx, miny, maxy, plotentries.ptr, n );
469 assert( nx == x.length,
"plmesh(): Arrays must be of same length!" );
470 assert( ny == y.length,
"plmesh(): Arrays must be of same length!" );
481 assert( nx == x.length,
"plmeshc(): Arrays must be of same length!" );
482 assert( ny == y.length,
"plmeshc(): Arrays must be of same length!" );
490 c_plmtex( toStringz( side ), disp, pos, just, toStringz( text ) );
496 c_plmtex3( toStringz( side ), disp, pos, just, toStringz( text ) );
505 assert( nx == x.length,
"plot3d(): Arrays must be of same length!" );
506 assert( ny == y.length,
"plot3d(): Arrays must be of same length!" );
517 assert( nx == x.length,
"plot3dc(): Arrays must be of same length!" );
518 assert( ny == y.length,
"plot3dc(): Arrays must be of same length!" );
531 assert( nx == x.length,
"plot3dcl(): Arrays must be of same length!" );
532 assert( ny == y.length,
"plot3dcl(): Arrays must be of same length!" );
535 ixstart, ixn, indexymin.ptr, indexymax.ptr );
542 assert( nlin == del.length,
"plpat(): Arrays must be of same length!" );
543 c_plpat( nlin, inc.ptr, del.ptr );
550 assert( n == y.length,
"plpoin(): Arrays must be of same 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 );
567 assert( n == y.length,
"plstring(): Arrays must be of same length!" );
568 c_plstring( n, x.ptr, y.ptr, toStringz( text ) );
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 ) );
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 );
593 c_plptex( x, y, dx, dy, just, toStringz( text ) );
600 c_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz( text ) );
612 c_plspal1( toStringz( filename ), interpolate );
619 assert( ncol0 == g.length,
"plscmap0(): Arrays must be of same length!" );
620 assert( ncol0 == b.length,
"plscmap0(): Arrays must be of same 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!" );
638 assert( ncol1 == g.length,
"plscmap1(): Arrays must be of same length!" );
639 assert( ncol1 == b.length,
"plscmap1(): Arrays must be of same 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!" );
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 )
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 );
668 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, null );
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 )
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 );
689 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, null );
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 );
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 );
739 c.nx = cast(
PLINT) cgrid.xg.length;
741 c.ny = cast(
PLINT) cgrid.yg.length;
743 c.nz = cast(
PLINT) cgrid.zg.length;
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 );
760 c2.nx = cast(
PLINT) cgrid2.xg.length;
761 c2.ny = cast(
PLINT) cgrid2.xg[0].length;
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!" );
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!" );
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 );
780 c_plstart( toStringz( devname ), nx, ny );
787 string labx,
string laby,
string labtop )
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!" );
793 immutable(
char ) * *leglinez = array( map!toStringz( legline ) ).ptr;
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 ) );
813 valuemin, valuemax,
pltr, pltr_data );
825 c.nx = cast(
PLINT) cgrid.
xg.length;
827 c.ny = cast(
PLINT) cgrid.
yg.length;
829 c.nz = cast(
PLINT) cgrid.
zg.length;
832 valuemin, valuemax, &
pltr1, &c );
846 c2.nx = cast(
PLINT) cgrid2.
xg.length;
847 c2.ny = cast(
PLINT) cgrid2.
xg[0].length;
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!" );
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!" );
860 valuemin, valuemax, &
pltr2, &c2 );
871 c_plimage(
convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax,
879 assert( nms == space.length,
"plstyl(): Arrays must be of same length!" );
880 c_plstyl( nms, mark.ptr, space.ptr );
888 assert( nx == x.length,
"plsurf3d(): Arrays must be of same length!" );
889 assert( ny == y.length,
"plsurf3d(): Arrays must be of same 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!" );
908 ixstart, ixn, indexymin.ptr, indexymax.ptr );
915 assert( n == y.length,
"plsym(): Arrays must be of same length!" );
916 c_plsym( n, x.ptr, y.ptr, code );
983 return c_plsetopt( toStringz( opt ), toStringz( optarg ) );
1154 int function(
char *,
char *,
void * ) handler;
1591 const char *yopt,
PLFLT ytick,
PLINT nysub );
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,
1828 void c_pllab(
const char *xlabel,
const char *ylabel,
const char *tlabel );
1877 PLFLT text_justification,
1884 PLINT *symbol_numbers,
const char **symbols );
1893 PLINT n_labels,
const PLINT *label_opts,
const char **label,
1894 PLINT n_axes,
const char ** axis_opts,
1896 const PLINT *n_values,
const PLFLT **values );
1917 const PLINT *plotentries,
PLINT nplotentries );
1921 const char *
name,
const char *
string,
1923 const PLINT *plotentries,
PLINT nplotentries );
1934 const PLINT *plotentries,
PLINT nplotentries );
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 );
2105 void c_plsdev(
const char *devname );
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 );
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 );
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 );
2309 void plgFileDevs(
char ***p_menustr,
char ***p_devname,
int *p_ndev );
2313 void plgDevs(
char ***p_menustr,
char ***p_devname,
int *p_ndev );
2325 void plsbopH(
void function(
void *,
int * ) handler,
void *handler_data );
2329 void plseopH(
void function(
void *,
int * ) handler,
void *handler_data );
2337 void plsexit(
int function(
const char * ) handler );
2341 void plsabort(
void function(
const char * ) handler );
2396 void plSetUsage(
const char *program_string,
const char *usage_string );
2399 int c_plsetopt(
const char *opt,
const char *optarg );
2412 void plgesc(
char *p_esc );
2429 void plGetName(
const char *dir,
const char *subdir,
const char *filename,
char **filespec );