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 );
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 );
435 assert( nx == x.length,
"plmesh(): Arrays must be of same length!" );
436 assert( ny == y.length,
"plmesh(): Arrays must be of same length!" );
447 assert( nx == x.length,
"plmeshc(): Arrays must be of same length!" );
448 assert( ny == y.length,
"plmeshc(): Arrays must be of same length!" );
456 c_plmtex( toStringz( side ), disp, pos, just, toStringz( text ) );
462 c_plmtex3( toStringz( side ), disp, pos, just, toStringz( text ) );
471 assert( nx == x.length,
"plot3d(): Arrays must be of same length!" );
472 assert( ny == y.length,
"plot3d(): Arrays must be of same length!" );
483 assert( nx == x.length,
"plot3dc(): Arrays must be of same length!" );
484 assert( ny == y.length,
"plot3dc(): Arrays must be of same length!" );
497 assert( nx == x.length,
"plot3dcl(): Arrays must be of same length!" );
498 assert( ny == y.length,
"plot3dcl(): Arrays must be of same length!" );
501 ixstart, ixn, indexymin.ptr, indexymax.ptr );
508 assert( nlin == del.length,
"plpat(): Arrays must be of same length!" );
509 c_plpat( nlin, inc.ptr, del.ptr );
516 assert( n == y.length,
"plpoin(): Arrays must be of same length!" );
524 assert( n == y.length,
"plpoin3(): Arrays must be of same length!" );
525 assert( n == z.length,
"plpoin3(): Arrays must be of same length!" );
526 c_plpoin3( n, x.ptr, y.ptr, z.ptr, code );
533 assert( n == y.length,
"plstring(): Arrays must be of same length!" );
534 c_plstring( n, x.ptr, y.ptr, toStringz( text ) );
541 assert( n == y.length,
"plstring3(): Arrays must be of same length!" );
542 assert( n == z.length,
"plstring3(): Arrays must be of same length!" );
543 c_plstring3( n, x.ptr, y.ptr, z.ptr, toStringz( text ) );
550 assert( n == y.length,
"plpoly3(): Arrays must be of same length!" );
551 assert( n == z.length,
"plpoly3(): Arrays must be of same length!" );
552 assert( n - 1 == draw.length,
"plpoly3(): Array draw must be of same length then other arrays minus 1!" );
553 c_plpoly3( n, x.ptr, y.ptr, z.ptr, draw.ptr, ifcc );
559 c_plptex( x, y, dx, dy, just, toStringz( text ) );
566 c_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz( text ) );
578 c_plspal1( toStringz( filename ), interpolate );
585 assert( ncol0 == g.length,
"plscmap0(): Arrays must be of same length!" );
586 assert( ncol0 == b.length,
"plscmap0(): Arrays must be of same length!" );
594 assert( ncol0 == g.length,
"plscmap0a(): Arrays must be of same length!" );
595 assert( ncol0 == b.length,
"plscmap0a(): Arrays must be of same length!" );
596 assert( ncol0 == a.length,
"plscmap0a(): Arrays must be of same length!" );
604 assert( ncol1 == g.length,
"plscmap1(): Arrays must be of same length!" );
605 assert( ncol1 == b.length,
"plscmap1(): Arrays must be of same length!" );
613 assert( ncol1 == g.length,
"plscmap1a(): Arrays must be of same length!" );
614 assert( ncol1 == b.length,
"plscmap1a(): Arrays must be of same length!" );
615 assert( ncol1 == a.length,
"plscmap1a(): Arrays must be of same length!" );
625 assert( npts == coord1.length,
"plscmap1l(): Arrays must be of same length!" );
626 assert( npts == coord2.length,
"plscmap1l(): Arrays must be of same length!" );
627 assert( npts == coord3.length,
"plscmap1l(): Arrays must be of same length!" );
628 if ( alt_hue_path != null )
630 assert( npts - 1 == alt_hue_path.length,
"plscmap1l(): Array alt_hue_path must be of same length then other arrays minus 1!" );
631 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, alt_hue_path.ptr );
634 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, null );
645 assert( npts == coord1.length,
"plscmap1la(): Arrays must be of same length!" );
646 assert( npts == coord2.length,
"plscmap1la(): Arrays must be of same length!" );
647 assert( npts == coord3.length,
"plscmap1la(): Arrays must be of same length!" );
648 assert( npts == a.length,
"plscmap1la(): Arrays must be of same length!" );
649 if ( alt_hue_path != null )
651 assert( npts - 1 == alt_hue_path.length,
"plscmap1la(): Array alt_hue_path must be of same length then other arrays minus 1!" );
652 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, alt_hue_path.ptr );
655 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, null );
680 c_plshade(
convert_array( a ), nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap,
681 sh_color, sh_width, min_color, min_width, max_color, max_width, &
c_plfill,
682 rectangular,
pltr, pltr_data );
692 c_plshades(
convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(
PLINT) clevel.length,
693 fill_width, cont_color, cont_width, &
c_plfill, rectangular,
pltr, pltr_data );
705 c.nx = cast(
PLINT) cgrid.xg.length;
707 c.ny = cast(
PLINT) cgrid.yg.length;
709 c.nz = cast(
PLINT) cgrid.zg.length;
711 c_plshades(
convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(
PLINT) clevel.length,
712 fill_width, cont_color, cont_width, &
c_plfill, rectangular, &
pltr1, &c );
726 c2.nx = cast(
PLINT) cgrid2.xg.length;
727 c2.ny = cast(
PLINT) cgrid2.xg[0].length;
730 assert( c2.nx == cgrid2.yg.length,
"plcont(): Arrays must be of same length!" );
731 assert( c2.ny == cgrid2.yg[0].length,
"plcont(): Arrays must be of same length!" );
735 assert( c2.nx == cgrid2.zg.length,
"plcont(): Arrays must be of same length!" );
736 assert( c2.ny == cgrid2.zg[0].length,
"plcont(): Arrays must be of same length!" );
739 c_plshades(
convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(
PLINT) clevel.length,
740 fill_width, cont_color, cont_width, &
c_plfill, rectangular, &
pltr2, &c2 );
746 c_plstart( toStringz( devname ), nx, ny );
753 string labx,
string laby,
string labtop )
755 assert( 4 == colline.length,
"plstripc(): Arrays must be of length 4!" );
756 assert( 4 == styline.length,
"plstripc(): Arrays must be of length 4!" );
757 assert( 4 == legline.length,
"plstripc(): Arrays must be of length 4!" );
759 immutable(
char ) * *leglinez = array( map!toStringz( legline ) ).ptr;
765 c_plstripc(
id, toStringz( xspec ), toStringz( yspec ), xmin, xmax, xjump, ymin, ymax,
766 xlpos, ylpos, y_ascl, acc, colbox, collab, colline.ptr, styline.ptr, leglinez,
767 toStringz( labx ), toStringz( laby ), toStringz( labtop ) );
779 valuemin, valuemax,
pltr, pltr_data );
791 c.nx = cast(
PLINT) cgrid.
xg.length;
793 c.ny = cast(
PLINT) cgrid.
yg.length;
795 c.nz = cast(
PLINT) cgrid.
zg.length;
798 valuemin, valuemax, &
pltr1, &c );
812 c2.nx = cast(
PLINT) cgrid2.
xg.length;
813 c2.ny = cast(
PLINT) cgrid2.
xg[0].length;
816 assert( c2.nx == cgrid2.
yg.length,
"plcont(): Arrays must be of same length!" );
817 assert( c2.ny == cgrid2.
yg[0].length,
"plcont(): Arrays must be of same length!" );
821 assert( c2.nx == cgrid2.
zg.length,
"plcont(): Arrays must be of same length!" );
822 assert( c2.ny == cgrid2.
zg[0].length,
"plcont(): Arrays must be of same length!" );
826 valuemin, valuemax, &
pltr2, &c2 );
837 c_plimage(
convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax,
845 assert( nms == space.length,
"plstyl(): Arrays must be of same length!" );
846 c_plstyl( nms, mark.ptr, space.ptr );
854 assert( nx == x.length,
"plsurf3d(): Arrays must be of same length!" );
855 assert( ny == y.length,
"plsurf3d(): Arrays must be of same length!" );
870 assert( nx == x.length,
"plsurf3d(): Arrays must be of same length!" );
871 assert( ny == y.length,
"plsurf3d(): Arrays must be of same length!" );
874 ixstart, ixn, indexymin.ptr, indexymax.ptr );
881 assert( n == y.length,
"plsym(): Arrays must be of same length!" );
882 c_plsym( n, x.ptr, y.ptr, code );
951 return c_plsetopt( toStringz( opt ), toStringz( optarg ) );
1122 int function(
char *,
char *,
void * ) handler;
1559 const char *yopt,
PLFLT ytick,
PLINT nysub );
1577 void c_plbox3(
const char *xopt,
const char *xlabel,
PLFLT xtick,
PLINT nsubx,
const char *yopt,
1578 const char *ylabel,
PLFLT ytick,
PLINT nsuby,
const char *zopt,
const char *zlabel,
1796 void c_pllab(
const char *xlabel,
const char *ylabel,
const char *tlabel );
1845 PLFLT text_justification,
1852 PLINT *symbol_numbers,
const char **symbols );
1973 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 );
2051 void c_plsdev(
const char *devname );
2107 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 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 );
2236 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 );
2255 void plgFileDevs(
char ***p_menustr,
char ***p_devname,
int *p_ndev );
2259 void plgDevs(
char ***p_menustr,
char ***p_devname,
int *p_ndev );
2271 void plsbopH(
void function(
void *,
int * ) handler,
void *handler_data );
2275 void plseopH(
void function(
void *,
int * ) handler,
void *handler_data );
2283 void plsexit(
int function(
const char * ) handler );
2287 void plsabort(
void function(
const char * ) handler );
2342 void plSetUsage(
const char *program_string,
const char *usage_string );
2349 int plSetOpt(
const char *
opt,
const char *optarg );
2362 void plgesc(
char *p_esc );
2379 void plGetName(
const char *dir,
const char *subdir,
const char *filename,
char **filespec );