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 );
181 c.nx = cast(
PLINT) cgrid.xg.length;
183 c.ny = cast(
PLINT) cgrid.yg.length;
185 c.nz = cast(
PLINT) cgrid.zg.length;
201 c2.nx = cast(
PLINT) cgrid2.xg.length;
202 c2.ny = cast(
PLINT) cgrid2.xg[0].length;
205 assert( c2.nx == cgrid2.yg.length,
"plcont(): Arrays must be of same length!" );
206 assert( c2.ny == cgrid2.yg[0].length,
"plcont(): Arrays must be of same length!" );
210 assert( c2.nx == cgrid2.zg.length,
"plcont(): Arrays must be of same length!" );
211 assert( c2.ny == cgrid2.zg[0].length,
"plcont(): Arrays must be of same length!" );
228 assert( n == xmin.length,
"plerrx(): Arrays must be of same length!" );
229 assert( n == xmax.length,
"plerrx(): Arrays must be of same length!" );
230 c_plerrx( n, xmin.ptr, xmax.ptr, y.ptr );
237 assert( n == ymin.length,
"plerry(): Arrays must be of same length!" );
238 assert( n == ymax.length,
"plerry(): Arrays must be of same length!" );
239 c_plerry( n, x.ptr, ymin.ptr, ymax.ptr );
246 assert( n == y.length,
"plfill(): Arrays must be of same length!" );
254 assert( n == y.length,
"plfill3(): Arrays must be of same length!" );
255 assert( n == z.length,
"plfill3(): Arrays must be of same length!" );
264 p_dev = to!string( cdev.ptr );
272 fnam = to!string( cfnam.ptr );
279 assert( n == y.length,
"plgradient(): Arrays must be of same length!" );
287 assert( npts == y.length,
"plgriddata(): Arrays must be of same length!" );
288 assert( npts == z.length,
"plgriddata(): Arrays must be of same length!" );
292 assert( nxg == zg.length,
"plgriddata(): Arrays must be of same length!" );
293 assert( nyg == zg[0].length,
"plgriddata(): Arrays must be of same length!" );
295 c_plgriddata( x.ptr, y.ptr, z.ptr, npts, xg.ptr, nxg, yg.ptr, nyg,
convert_array( zg ), type, data );
303 p_ver = to!string( cver.ptr );
309 c_plhist( cast(
PLINT) data.length, data.ptr, datmin, datmax, nbin, opt );
313 void pllab(
string xlabel,
string ylabel,
string tlabel )
315 c_pllab( toStringz( xlabel ), toStringz( ylabel ), toStringz( tlabel ) );
325 PLFLT text_justification,
332 PLINT[] symbol_numbers,
string[] symbols )
335 immutable(
char ) * *textz = array( map!toStringz( text ) ).ptr;
336 immutable(
char ) * *symbolsz = array( map!toStringz( symbols ) ).ptr;
337 assert( nlegend == text_colors.length,
"pllegend(): Arrays must be of same length!" );
338 assert( nlegend == text.length,
"pllegend(): Arrays must be of same length!" );
339 assert( nlegend == box_colors.length,
"pllegend(): Arrays must be of same length!" );
340 assert( nlegend == box_patterns.length,
"pllegend(): Arrays must be of same length!" );
341 assert( nlegend == box_scales.length,
"pllegend(): Arrays must be of same length!" );
342 assert( nlegend == box_line_widths.length,
"pllegend(): Arrays must be of same length!" );
343 assert( nlegend == line_colors.length,
"pllegend(): Arrays must be of same length!" );
344 assert( nlegend == line_styles.length,
"pllegend(): Arrays must be of same length!" );
345 assert( nlegend == line_widths.length,
"pllegend(): Arrays must be of same length!" );
346 assert( nlegend == symbol_colors.length,
"pllegend(): Arrays must be of same length!" );
347 assert( nlegend == symbol_scales.length,
"pllegend(): Arrays must be of same length!" );
348 assert( nlegend == symbol_numbers.length,
"pllegend(): Arrays must be of same length!" );
349 assert( nlegend == symbols.length,
"pllegend(): Arrays must be of same length!" );
351 opt, position, x, y, plot_width,
352 bg_color, bb_color, bb_style,
354 nlegend, opt_array.ptr,
355 text_offset, text_scale, text_spacing,
357 text_colors.ptr, textz,
358 box_colors.ptr, box_patterns.ptr,
359 box_scales.ptr, box_line_widths.ptr,
360 line_colors.ptr, line_styles.ptr,
362 symbol_colors.ptr, symbol_scales.ptr,
363 symbol_numbers.ptr, symbolsz );
370 assert( n == y.length,
"plline(): Arrays must be of same length!" );
378 assert( n == y.length,
"plline3(): Arrays must be of same length!" );
379 assert( n == z.length,
"plline3(): Arrays must be of same length!" );
387 c_plmap( mapform, toStringz( type ), minlong, maxlong, minlat, maxlat );
396 assert( nx == x.length,
"plmesh(): Arrays must be of same length!" );
397 assert( ny == y.length,
"plmesh(): Arrays must be of same length!" );
408 assert( nx == x.length,
"plmeshc(): Arrays must be of same length!" );
409 assert( ny == y.length,
"plmeshc(): Arrays must be of same length!" );
417 c_plmtex( toStringz( side ), disp, pos, just, toStringz( text ) );
423 c_plmtex3( toStringz( side ), disp, pos, just, toStringz( text ) );
432 assert( nx == x.length,
"plot3d(): Arrays must be of same length!" );
433 assert( ny == y.length,
"plot3d(): Arrays must be of same length!" );
444 assert( nx == x.length,
"plot3dc(): Arrays must be of same length!" );
445 assert( ny == y.length,
"plot3dc(): Arrays must be of same length!" );
458 assert( nx == x.length,
"plot3dcl(): Arrays must be of same length!" );
459 assert( ny == y.length,
"plot3dcl(): Arrays must be of same length!" );
462 ixstart, ixn, indexymin.ptr, indexymax.ptr );
469 assert( nlin == del.length,
"plpat(): Arrays must be of same length!" );
470 c_plpat( nlin, inc.ptr, del.ptr );
477 assert( n == y.length,
"plpoin(): Arrays must be of same length!" );
485 assert( n == y.length,
"plpoin3(): Arrays must be of same length!" );
486 assert( n == z.length,
"plpoin3(): Arrays must be of same length!" );
487 c_plpoin3( n, x.ptr, y.ptr, z.ptr, code );
494 assert( n == y.length,
"plstring(): Arrays must be of same length!" );
495 c_plstring( n, x.ptr, y.ptr, toStringz( text ) );
502 assert( n == y.length,
"plstring3(): Arrays must be of same length!" );
503 assert( n == z.length,
"plstring3(): Arrays must be of same length!" );
504 c_plstring3( n, x.ptr, y.ptr, z.ptr, toStringz( text ) );
511 assert( n == y.length,
"plpoly3(): Arrays must be of same length!" );
512 assert( n == z.length,
"plpoly3(): Arrays must be of same length!" );
513 assert( n - 1 == draw.length,
"plpoly3(): Array draw must be of same length then other arrays minus 1!" );
514 c_plpoly3( n, x.ptr, y.ptr, z.ptr, draw.ptr, ifcc );
520 c_plptex( x, y, dx, dy, just, toStringz( text ) );
527 c_plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, toStringz( text ) );
539 c_plspal1( toStringz( filename ), interpolate );
546 assert( ncol0 == g.length,
"plscmap0(): Arrays must be of same length!" );
547 assert( ncol0 == b.length,
"plscmap0(): Arrays must be of same length!" );
555 assert( ncol0 == g.length,
"plscmap0a(): Arrays must be of same length!" );
556 assert( ncol0 == b.length,
"plscmap0a(): Arrays must be of same length!" );
557 assert( ncol0 == a.length,
"plscmap0a(): Arrays must be of same length!" );
565 assert( ncol1 == g.length,
"plscmap1(): Arrays must be of same length!" );
566 assert( ncol1 == b.length,
"plscmap1(): Arrays must be of same length!" );
574 assert( ncol1 == g.length,
"plscmap1a(): Arrays must be of same length!" );
575 assert( ncol1 == b.length,
"plscmap1a(): Arrays must be of same length!" );
576 assert( ncol1 == a.length,
"plscmap1a(): Arrays must be of same length!" );
586 assert( npts == coord1.length,
"plscmap1l(): Arrays must be of same length!" );
587 assert( npts == coord2.length,
"plscmap1l(): Arrays must be of same length!" );
588 assert( npts == coord3.length,
"plscmap1l(): Arrays must be of same length!" );
589 if ( alt_hue_path != null )
591 assert( npts - 1 == alt_hue_path.length,
"plscmap1l(): Array alt_hue_path must be of same length then other arrays minus 1!" );
592 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, alt_hue_path.ptr );
595 c_plscmap1l( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, null );
606 assert( npts == coord1.length,
"plscmap1la(): Arrays must be of same length!" );
607 assert( npts == coord2.length,
"plscmap1la(): Arrays must be of same length!" );
608 assert( npts == coord3.length,
"plscmap1la(): Arrays must be of same length!" );
609 assert( npts == a.length,
"plscmap1la(): Arrays must be of same length!" );
610 if ( alt_hue_path != null )
612 assert( npts - 1 == alt_hue_path.length,
"plscmap1la(): Array alt_hue_path must be of same length then other arrays minus 1!" );
613 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, alt_hue_path.ptr );
616 c_plscmap1la( itype, npts, intensity.ptr, coord1.ptr, coord2.ptr, coord3.ptr, a.ptr, null );
641 c_plshade(
convert_array( a ), nx, ny, defined, left, right, bottom, top, shade_min, shade_max, sh_cmap,
642 sh_color, sh_width, min_color, min_width, max_color, max_width, &
c_plfill,
643 rectangular,
pltr, pltr_data );
653 c_plshades(
convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(
PLINT) clevel.length,
654 fill_width, cont_color, cont_width, &
c_plfill, rectangular,
pltr, pltr_data );
666 c.nx = cast(
PLINT) cgrid.xg.length;
668 c.ny = cast(
PLINT) cgrid.yg.length;
670 c.nz = cast(
PLINT) cgrid.zg.length;
672 c_plshades(
convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(
PLINT) clevel.length,
673 fill_width, cont_color, cont_width, &
c_plfill, rectangular, &
pltr1, &c );
687 c2.nx = cast(
PLINT) cgrid2.xg.length;
688 c2.ny = cast(
PLINT) cgrid2.xg[0].length;
691 assert( c2.nx == cgrid2.yg.length,
"plcont(): Arrays must be of same length!" );
692 assert( c2.ny == cgrid2.yg[0].length,
"plcont(): Arrays must be of same length!" );
696 assert( c2.nx == cgrid2.zg.length,
"plcont(): Arrays must be of same length!" );
697 assert( c2.ny == cgrid2.zg[0].length,
"plcont(): Arrays must be of same length!" );
700 c_plshades(
convert_array( a ), nx, ny, defined, xmin, xmax, ymin, ymax, clevel.ptr, cast(
PLINT) clevel.length,
701 fill_width, cont_color, cont_width, &
c_plfill, rectangular, &
pltr2, &c2 );
707 c_plstart( toStringz( devname ), nx, ny );
714 string labx,
string laby,
string labtop )
716 assert( 4 == colline.length,
"plstripc(): Arrays must be of length 4!" );
717 assert( 4 == styline.length,
"plstripc(): Arrays must be of length 4!" );
718 assert( 4 == legline.length,
"plstripc(): Arrays must be of length 4!" );
720 immutable(
char ) * *leglinez = array( map!toStringz( legline ) ).ptr;
726 c_plstripc(
id, toStringz( xspec ), toStringz( yspec ), xmin, xmax, xjump, ymin, ymax,
727 xlpos, ylpos, y_ascl, acc, colbox, collab, colline.ptr, styline.ptr, leglinez,
728 toStringz( labx ), toStringz( laby ), toStringz( labtop ) );
740 valuemin, valuemax,
pltr, pltr_data );
752 c.nx = cast(
PLINT) cgrid.
xg.length;
754 c.ny = cast(
PLINT) cgrid.
yg.length;
756 c.nz = cast(
PLINT) cgrid.
zg.length;
759 valuemin, valuemax, &
pltr1, &c );
773 c2.nx = cast(
PLINT) cgrid2.
xg.length;
774 c2.ny = cast(
PLINT) cgrid2.
xg[0].length;
777 assert( c2.nx == cgrid2.
yg.length,
"plcont(): Arrays must be of same length!" );
778 assert( c2.ny == cgrid2.
yg[0].length,
"plcont(): Arrays must be of same length!" );
782 assert( c2.nx == cgrid2.
zg.length,
"plcont(): Arrays must be of same length!" );
783 assert( c2.ny == cgrid2.
zg[0].length,
"plcont(): Arrays must be of same length!" );
787 valuemin, valuemax, &
pltr2, &c2 );
798 c_plimage(
convert_array( idata ), nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax,
806 assert( nms == space.length,
"plstyl(): Arrays must be of same length!" );
807 c_plstyl( nms, mark.ptr, space.ptr );
815 assert( nx == x.length,
"plsurf3d(): Arrays must be of same length!" );
816 assert( ny == y.length,
"plsurf3d(): Arrays must be of same length!" );
831 assert( nx == x.length,
"plsurf3d(): Arrays must be of same length!" );
832 assert( ny == y.length,
"plsurf3d(): Arrays must be of same length!" );
835 ixstart, ixn, indexymin.ptr, indexymax.ptr );
842 assert( n == y.length,
"plsym(): Arrays must be of same length!" );
843 c_plsym( n, x.ptr, y.ptr, code );
912 return c_plsetopt( toStringz( opt ), toStringz( optarg ) );
1083 int function(
char *,
char *,
void * ) handler;
1517 const char *yopt,
PLFLT ytick,
PLINT nysub );
1535 void c_plbox3(
const char *xopt,
const char *xlabel,
PLFLT xtick,
PLINT nsubx,
const char *yopt,
1536 const char *ylabel,
PLFLT ytick,
PLINT nsuby,
const char *zopt,
const char *zlabel,
1753 void c_pllab(
const char *xlabel,
const char *ylabel,
const char *tlabel );
1794 PLFLT text_justification,
1801 PLINT *symbol_numbers,
const char **symbols );
1907 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 );
1979 void c_plsdev(
const char *devname );
2035 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 );
2090 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 );
2164 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 );
2183 void plgFileDevs(
char ***p_menustr,
char ***p_devname,
int *p_ndev );
2187 void plgDevs(
char ***p_menustr,
char ***p_devname,
int *p_ndev );
2199 void plsbopH(
void function(
void *,
int * ) handler,
void *handler_data );
2203 void plseopH(
void function(
void *,
int * ) handler,
void *handler_data );
2211 void plsexit(
int function(
const char * ) handler );
2215 void plsabort(
void function(
const char * ) handler );
2270 void plSetUsage(
const char *program_string,
const char *usage_string );
2277 int plSetOpt(
const char *
opt,
const char *optarg );
2290 void plgesc(
char *p_esc );
2307 void plGetName(
const char *dir,
const char *subdir,
const char *filename,
char **filespec );