From: <hez...@us...> - 2011-01-01 00:26:42
|
Revision: 11409 http://plplot.svn.sourceforge.net/plplot/?rev=11409&view=rev Author: hezekiahcarty Date: 2011-01-01 00:26:35 +0000 (Sat, 01 Jan 2011) Log Message: ----------- plstring, plstring3, plcolorbar, pllegend for OCaml The OCaml examples should all match their C counterparts now, with the exception of example 33 which has not been propagated to OCaml yet. Modified Paths: -------------- trunk/bindings/ocaml/plplot.mli trunk/bindings/ocaml/plplot_core.idl trunk/bindings/ocaml/plplot_h trunk/bindings/ocaml/plplot_h.inc trunk/bindings/ocaml/plplot_impl.c trunk/bindings/ocaml/touchup.ml trunk/examples/ocaml/x04.ml trunk/examples/ocaml/x18.ml trunk/examples/ocaml/x26.ml Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot.mli 2011-01-01 00:26:35 UTC (rev 11409) @@ -29,14 +29,6 @@ | PL_Y_AXIS | PL_Z_AXIS -type plplot_legend_option_type = - PL_LEGEND_NONE - | PL_LEGEND_COLOR_BOX - | PL_LEGEND_LINE - | PL_LEGEND_SYMBOL - | PL_LEGEND_TEXT_LEFT - | PL_LEGEND_BACKGROUND - (** {3 A higher-level OCaml interface to PLplot} *) module Plot : sig @@ -557,6 +549,37 @@ | PL_VIEWPORT_DEFINED | PL_WORLD_COORDINATES_DEFINED and plplot_run_level = plplot_run_level_enum +and plplot_legend_enum = + PL_LEGEND_NONE + | PL_LEGEND_COLOR_BOX + | PL_LEGEND_LINE + | PL_LEGEND_SYMBOL + | PL_LEGEND_TEXT_LEFT + | PL_LEGEND_BACKGROUND + | PL_LEGEND_BOUNDING_BOX + | PL_LEGEND_ROW_MAJOR + | PL_LEGEND_LEFT + | PL_LEGEND_RIGHT + | PL_LEGEND_UPPER + | PL_LEGEND_LOWER + | PL_LEGEND_INSIDE + | PL_LEGEND_OUTSIDE +and plplot_legend_opt = plplot_legend_enum list +and plplot_colorbar_enum = + | PL_COLORBAR_LEFT + | PL_COLORBAR_RIGHT + | PL_COLORBAR_UPPER + | PL_COLORBAR_LOWER + | PL_COLORBAR_LABEL_LEFT + | PL_COLORBAR_LABEL_RIGHT + | PL_COLORBAR_LABEL_UPPER + | PL_COLORBAR_LABEL_LOWER + | PL_COLORBAR_IMAGE + | PL_COLORBAR_SHADE + | PL_COLORBAR_GRADIENT + | PL_COLORBAR_CAP_LOW + | PL_COLORBAR_CAP_HIGH +and plplot_colorbar_opt = plplot_colorbar_enum list external pl_setcontlabelformat : int -> int -> unit = "camlidl_plplot_core_c_pl_setcontlabelformat" external pl_setcontlabelparam : float -> float -> float -> int -> unit @@ -663,11 +686,15 @@ = "camlidl_plplot_core_c_pljoin" external pllab : string -> string -> string -> unit = "camlidl_plplot_core_c_pllab" -external pllegend : plplot_legend_option_type list -> float -> float -> - float -> int -> plplot_legend_option_type list array -> float -> float -> +external plcolorbar : plplot_colorbar_opt -> float -> float -> float -> + float -> string -> string -> float array -> float array -> unit + = "camlidl_plplot_core_c_plcolorbar_bytecode" "camlidl_plplot_core_c_plcolorbar" +external pllegend : plplot_legend_opt -> float -> float -> + float -> int -> int -> int -> int -> int -> + plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> - float array -> int array -> int array -> unit + int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend" external pllightsource : float -> float -> float -> unit = "camlidl_plplot_core_c_pllightsource" @@ -788,6 +815,10 @@ external plstar : int -> int -> unit = "camlidl_plplot_core_c_plstar" external plstart : string -> int -> int -> unit = "camlidl_plplot_core_c_plstart" +external plstring : float array -> float array -> string -> unit + = "camlidl_plplot_core_c_plstring" +external plstring3 : float array -> float array -> float array -> string -> unit + = "camlidl_plplot_core_c_plstring3" external plstripa : int -> int -> float -> float -> unit = "camlidl_plplot_core_c_plstripa" external plstripd : int -> unit = "camlidl_plplot_core_c_plstripd" Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_core.idl 2011-01-01 00:26:35 UTC (rev 11409) @@ -58,6 +58,41 @@ }; typedef enum plplot_run_level_enum plplot_run_level; +enum plplot_legend_enum { + PL_LEGEND_NONE = 1, + PL_LEGEND_COLOR_BOX = 2, + PL_LEGEND_LINE = 4, + PL_LEGEND_SYMBOL = 8, + PL_LEGEND_TEXT_LEFT = 16, + PL_LEGEND_BACKGROUND = 32, + PL_LEGEND_BOUNDING_BOX = 64, + PL_LEGEND_ROW_MAJOR = 128, + PL_LEGEND_LEFT = 256, + PL_LEGEND_RIGHT = 512, + PL_LEGEND_UPPER = 1024, + PL_LEGEND_LOWER = 2048, + PL_LEGEND_INSIDE = 4096, + PL_LEGEND_OUTSIDE = 8192, +}; +typedef [set] enum plplot_legend_enum plplot_legend_opt; + +enum plplot_colorbar_enum { + PL_COLORBAR_LEFT = 1, + PL_COLORBAR_RIGHT = 2, + PL_COLORBAR_UPPER = 4, + PL_COLORBAR_LOWER = 8, + PL_COLORBAR_LABEL_LEFT = 16, + PL_COLORBAR_LABEL_RIGHT = 32, + PL_COLORBAR_LABEL_UPPER = 64, + PL_COLORBAR_LABEL_LOWER = 128, + PL_COLORBAR_IMAGE = 256, + PL_COLORBAR_SHADE = 512, + PL_COLORBAR_GRADIENT = 1024, + PL_COLORBAR_CAP_LOW = 2048, + PL_COLORBAR_CAP_HIGH = 4096, +}; +typedef [set] enum plplot_colorbar_enum plplot_colorbar_opt; + // Any function which has a nonzero_error_int return type will raise // an Invalid_argument error if the return value is <> 0. typedef [errorcheck(plplot_check_nonzero_result), errorcode] int nonzero_error_int; @@ -212,15 +247,6 @@ PL_Y_AXIS | \ PL_Z_AXIS"); -// Hand-translated PL_LEGEND_* flags for use with pllegend -quote(mlmli, "type plplot_legend_option_type = \ - PL_LEGEND_NONE | \ - PL_LEGEND_COLOR_BOX | \ - PL_LEGEND_LINE | \ - PL_LEGEND_SYMBOL | \ - PL_LEGEND_TEXT_LEFT | \ - PL_LEGEND_BACKGROUND"); - // Custom axis labeling quote(ml, "external ml_plslabelfunc : unit -> unit = \"ml_plslabelfunc\""); quote(ml, @@ -262,5 +288,5 @@ RAW_ML(external plgriddata : float array -> float array -> float array -> float array -> float array -> plplot_grid_method_type -> float -> float array array = "ml_plgriddata_bytecode" "ml_plgriddata") RAW_ML(external plparseopts : string array -> plplot_parse_method_type list -> unit = "ml_plparseopts") -RAW_ML(external pllegend : plplot_legend_option_type list -> float -> float -> float -> int -> plplot_legend_option_type list array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> float array -> int array -> int array -> unit = "ml_pllegend_byte" "ml_pllegend") +RAW_ML(external pllegend : plplot_legend_opt -> float -> float -> float -> int -> int -> int -> int -> int -> plplot_legend_opt array -> float -> float -> float -> float -> int array -> string array -> int array -> int array -> float array -> int array -> int array -> int array -> int array -> int array -> float array -> int array -> string array -> float * float = "ml_pllegend_byte" "ml_pllegend") Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_h 2011-01-01 00:26:35 UTC (rev 11409) @@ -190,6 +190,11 @@ c_plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data); + + void +plfgriddata( PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, + PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, + PLF2OPS zops, PLPointer zgp, PLINT type, PLFLT data ); */ void @@ -234,17 +239,28 @@ /* void -c_pllegend( PLINT opt, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, - PLINT nlegend, PLINT *opt_array, +c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, + plplot_legend_opt opt, PLFLT x, PLFLT y, PLFLT plot_width, + PLINT bg_color, PLINT bb_color, PLINT bb_style, + PLINT nrow, PLINT ncolumn, + PLINT nlegend, const plplot_legend_opt *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, - PLFLT text_justification, PLINT *text_colors, char **text, - PLINT *box_colors, PLINT *box_patterns, PLFLT *box_scales, - PLINT *line_colors, PLINT *line_styles, PLINT *line_widths, - PLINT *symbol_colors, PLFLT *symbol_scales, - PLINT *symbol_numbers, PLINT *symbols ); + PLFLT text_justification, + const PLINT *text_colors, const char **text, + const PLINT *box_colors, const PLINT *box_patterns, + const PLFLT *box_scales, const PLINT *box_line_widths, + const PLINT *line_colors, const PLINT *line_styles, + const PLINT *line_widths, + const PLINT *symbol_colors, const PLFLT *symbol_scales, + const PLINT *symbol_numbers, const char **symbols ); */ void +c_plcolorbar( plplot_colorbar_opt opt, PLFLT x, PLFLT y, PLFLT length, PLFLT width, + const char *axis_opts, const char *label, + PLINT n_colors, PLFLT *colors, PLFLT *values ); + + void c_pllightsource(PLFLT x, PLFLT y, PLFLT z); void @@ -274,7 +290,13 @@ c_plmeshc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, plplot3d_style opt, PLFLT *clevel, PLINT nlevel); +/* void +plfmeshc( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); +*/ + + void c_plmkstrm(PLINT *p_strm); void @@ -289,17 +311,33 @@ c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, plplot3d_style opt, PLBOOL side); +/* void +plfplot3d( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); +*/ + + void c_plot3dc(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, plplot3d_style opt, PLFLT *clevel, PLINT nlevel); /* void +plfplot3dc( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + + void c_plot3dcl(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax); + + void +plfplot3dcl( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, + PLFLT *clevel, PLINT nlevel, + PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); */ void @@ -458,6 +496,16 @@ PLPointer pltr_data); void +plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT ( *defined )( PLFLT, PLFLT ), + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT *clevel, PLINT nlevel, PLINT fill_width, + PLINT cont_color, PLINT cont_width, + void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + + void plfshade(PLFLT (*f2eval) (PLINT, PLINT, PLPointer), PLPointer f2eval_data, PLFLT (*c2eval) (PLINT, PLINT, PLPointer), @@ -473,6 +521,18 @@ PLPointer pltr_data); void +plfshade1( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT ( *defined )( PLFLT, PLFLT ), + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, + PLFLT shade_min, PLFLT shade_max, + PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, + PLINT min_color, PLINT min_width, + PLINT max_color, PLINT max_width, + void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); + + void c_plslabelfunc(void (*label_func)(PLINT, PLFLT, char *, PLINT, PLPointer), PLPointer label_data); */ @@ -483,6 +543,9 @@ /* void c_plsmem(PLINT maxx, PLINT maxy, void *plotmem); + + void +c_plsmema( PLINT maxx, PLINT maxy, void *plotmem ); */ void @@ -519,7 +582,18 @@ void c_plstart(const char *devname, PLINT nx, PLINT ny); +/* void +c_plstransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), PLPointer coordinate_transform_data ); +*/ + + void +c_plstring( PLINT n, PLFLT *x, PLFLT *y, const char *string ); + + void +c_plstring3( PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, const char *string ); + + void c_plstripa(PLINT id, PLINT pen, PLFLT x, PLFLT y); /* @@ -543,6 +617,13 @@ PLFLT valuemin, PLFLT valuemax, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); + + void +plfimagefr( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT valuemin, PLFLT valuemax, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); */ void @@ -550,7 +631,14 @@ PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax); +/* void +plfimage( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, + PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, + PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); +*/ + + void c_plstyl(PLINT nms, PLINT *mark, PLINT *space); void @@ -559,9 +647,18 @@ /* void +plfsurf3d( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, + PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); + + void c_plsurf3dl(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax); + + void +plfsurf3dl( PLFLT *x, PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, + PLINT opt, PLFLT *clevel, PLINT nlevel, + PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax ); */ void @@ -599,6 +696,13 @@ c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data); + + void +plfvect( PLFLT ( *getuv )( PLINT, PLINT, PLPointer ), + PLPointer up, PLPointer vp, + PLINT nx, PLINT ny, PLFLT scale, + void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), + PLPointer pltr_data ); */ void @@ -679,7 +783,22 @@ void pltr2f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data); + PLF2OPS +plf2ops_c(); + + PLF2OPS +plf2ops_grid_c(); + + PLF2OPS +plf2ops_grid_row_major(); + + PLF2OPS +plf2ops_grid_col_major(); + PLFLT +plf2eval1( PLINT ix, PLINT iy, PLPointer plf2eval_data ); + + PLFLT plf2eval2(PLINT ix, PLINT iy, PLPointer plf2eval_data); PLFLT Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_h.inc 2011-01-01 00:26:35 UTC (rev 11409) @@ -59,6 +59,7 @@ [mlname(plinit)] void c_plinit ( void ); [mlname(pljoin)] void c_pljoin ( double x1, double y1, double x2, double y2 ); [mlname(pllab)] void c_pllab ( [string] const char * xlabel, [string] const char * ylabel, [string] const char * tlabel ); +[mlname(plcolorbar)] void c_plcolorbar ( plplot_colorbar_opt opt, double x, double y, double length, double width, [string] const char * axis_opts, [string] const char * label, int n_colors, [in, size_is(n_colors)] double * colors, [in, size_is(n_colors)] double * values ); [mlname(pllightsource)] void c_pllightsource ( double x, double y, double z ); [mlname(plline)] void c_plline ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y ); [mlname(plline3)] void c_plline3 ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [in, size_is(n)] double * z ); @@ -120,6 +121,8 @@ [mlname(plssym)] void c_plssym ( double def, double scale ); [mlname(plstar)] void c_plstar ( int nx, int ny ); [mlname(plstart)] void c_plstart ( [string] const char * devname, int nx, int ny ); +[mlname(plstring)] void c_plstring ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [string] const char * string ); +[mlname(plstring3)] void c_plstring3 ( int n, [in, size_is(n)] double * x, [in, size_is(n)] double * y, [in, size_is(n)] double * z, [string] const char * string ); [mlname(plstripa)] void c_plstripa ( int id, int pen, double x, double y ); [mlname(plstripd)] void c_plstripd ( int id ); [mlname(plimage)] void c_plimage ( [in, size_is(nx, ny)] double ** idata, int nx, int ny, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, double Dxmin, double Dxmax, double Dymin, double Dymax ); Modified: trunk/bindings/ocaml/plplot_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/plplot_impl.c 2011-01-01 00:26:35 UTC (rev 11409) @@ -746,27 +746,42 @@ case 3: translated_option = PL_LEGEND_SYMBOL; break; case 4: translated_option = PL_LEGEND_TEXT_LEFT; break; case 5: translated_option = PL_LEGEND_BACKGROUND; break; + case 6: translated_option = PL_LEGEND_BOUNDING_BOX; break; + case 7: translated_option = PL_LEGEND_ROW_MAJOR; break; + case 8: translated_option = PL_LEGEND_LEFT; break; + case 9: translated_option = PL_LEGEND_RIGHT; break; + case 10: translated_option = PL_LEGEND_UPPER; break; + case 11: translated_option = PL_LEGEND_LOWER; break; + case 12: translated_option = PL_LEGEND_INSIDE; break; + case 13: translated_option = PL_LEGEND_OUTSIDE; break; default: translated_option = -1; } return translated_option; } value ml_pllegend( value opt, value x, value y, value plot_width, - value bg_color, value opt_array, + value bg_color, + value bb_color, value bb_style, + value nrow, value ncolumn, + value opt_array, value text_offset, value text_scale, value text_spacing, value text_justification, value text_colors, value text, value box_colors, value box_patterns, value box_scales, + value box_line_widths, value line_colors, value line_styles, value line_widths, value symbol_colors, value symbol_scales, value symbol_numbers, value symbols ) { CAMLparam5( opt, x, y, plot_width, bg_color ); - CAMLxparam5( opt_array, text_offset, text_scale, text_spacing, - text_justification ); - CAMLxparam5( text_colors, text, box_colors, box_patterns, box_scales ); + CAMLxparam5( bb_color, bb_style, nrow, ncolumn, opt_array ); + CAMLxparam5( text_offset, text_scale, text_spacing, text_justification, + text_colors ); + CAMLxparam5( text, box_colors, box_patterns, box_scales, box_line_widths ); CAMLxparam5( line_colors, line_styles, line_widths, symbol_colors, - symbol_scales ); + symbol_scales ); CAMLxparam2( symbol_numbers, symbols ); + CAMLlocal1( result ); + result = caml_alloc( 2, 0 ); // Counter int i; @@ -786,12 +801,13 @@ INIT_INT_ARRAY( text_colors ) INIT_INT_ARRAY( box_colors ) INIT_INT_ARRAY( box_patterns ) + INIT_INT_ARRAY( box_line_widths ) INIT_INT_ARRAY( line_colors ) INIT_INT_ARRAY( line_styles ) INIT_INT_ARRAY( line_widths ) INIT_INT_ARRAY( symbol_colors ) INIT_INT_ARRAY( symbol_numbers ) - INIT_INT_ARRAY( symbols ) + INIT_STRING_ARRAY( symbols ) // Translate the legend configuration options c_opt = lor_ml_list( opt, translate_legend_option ); @@ -802,18 +818,29 @@ lor_ml_list( Field( opt_array, i ), translate_legend_option ); } - // pllegend( c_opt, Double_val( x ), Double_val( y ), -// Double_val( plot_width ), Int_val( bg_color ), n_legend, -// c_opt_array, -// Double_val( text_offset ), Double_val( text_scale ), -// Double_val( text_spacing ), Double_val( text_justification ), -// c_text_colors, c_text, -// c_box_colors, c_box_patterns, (double *) box_scales, -// c_line_colors, c_line_styles, c_line_widths, -// c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, -// c_symbols ); + // The returned width and height of the legend + PLFLT width, height; - CAMLreturn( Val_unit ); + pllegend( &width, &height, c_opt, Double_val( x ), Double_val( y ), + Double_val( plot_width ), Int_val( bg_color ), + Int_val( bb_color ), Int_val( bb_style ), + Int_val( nrow ), Int_val( ncolumn ), + n_legend, c_opt_array, + Double_val( text_offset ), Double_val( text_scale ), + Double_val( text_spacing ), + Double_val( text_justification ), + c_text_colors, c_text, + c_box_colors, c_box_patterns, (double *) box_scales, + c_box_line_widths, + c_line_colors, c_line_styles, c_line_widths, + c_symbol_colors, (double *) symbol_scales, c_symbol_numbers, + c_symbols ); + + // Return a tuple with the legend's size + Store_field( result, 0, caml_copy_double( width ) ); + Store_field( result, 1, caml_copy_double( height ) ); + + CAMLreturn( result ); } value ml_pllegend_byte( value* argv, int argn ) @@ -822,7 +849,8 @@ argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13], argv[14], argv[15], argv[16], argv[17], argv[18], argv[19], - argv[20], argv[21] ); + argv[20], argv[21], argv[22], argv[23], argv[24], + argv[25], argv[26] ); } // pltr* function implementations Modified: trunk/bindings/ocaml/touchup.ml =================================================================== --- trunk/bindings/ocaml/touchup.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/bindings/ocaml/touchup.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -79,6 +79,12 @@ function_attrs = None; parameter_attrs = Some ["ctime", ["out"]]; }; + { + function_name = "c_plcolorbar"; + function_attrs = None; + parameter_attrs = Some ["colors", ["in"; "size_is(n_colors)"]; + "values", ["in"; "size_is(n_colors)"]]; + }; (* For now, this will be wrapped by hand... { function_name = "c_plgriddata"; @@ -280,7 +286,7 @@ ["string"]; (* Pointers to arrays of n elements *) true, - pmatch "\\*" p_type, + pmatch "\\*" p_type && not (pmatch "const char" p_type), true, List.mem "n" names, ["in"; "size_is(n)"]; Modified: trunk/examples/ocaml/x04.ml =================================================================== --- trunk/examples/ocaml/x04.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/examples/ocaml/x04.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -63,7 +63,7 @@ plbox "" 0.0 0 "cmstv" 30.0 3; plcol0 3; plline freql phase; - plpoin freql phase 3; + plstring freql phase "*"; plcol0 3; plmtex "r" 5.0 0.5 0.5 "Phase shift (degrees)"; @@ -82,17 +82,22 @@ let symbol_colors = [| 0; 3 |] in let symbol_scales = [| 0.0; 1.0 |] in let symbol_numbers = [| 0; 4 |] in - let symbols = [| 0; 3 |] in + let symbols = [| ""; "*" |] in (* from the above opt_arrays we can completely ignore everything to do with boxes *) - plscol0a 15 32 32 32 0.90; - (*pllegend [PL_LEGEND_BACKGROUND] 0.57 0.85 0.06 15 opt_array - 1.0 1.0 2.0 - 1.0 text_colors text - [||] [||] [||] - line_colors line_styles line_widths - symbol_colors symbol_scales symbol_numbers symbols; *) + plscol0a 15 32 32 32 0.70; + ignore ( + pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + 0.0 0.0 0.1 15 + 1 1 0 0 + opt_array + 1.0 1.0 2.0 + 1.0 text_colors text + [||] [||] [||] [||] + line_colors line_styles line_widths + symbol_colors symbol_scales symbol_numbers symbols + ); () ) else if plot_type = 1 then ( @@ -110,13 +115,18 @@ (* from the above opt_arrays we can completely ignore everything to do with boxes and symbols *) - plscol0a 15 32 32 32 0.90; - (*pllegend [PL_LEGEND_BACKGROUND] 0.57 0.85 0.06 15 opt_array - 1.0 1.0 2.0 - 1.0 text_colors text - [||] [||] [||] - line_colors line_styles line_widths - [||] [||] [||] [||];*) + plscol0a 15 32 32 32 0.70; + ignore ( + pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + 0.0 0.0 0.1 15 + 1 1 0 0 + opt_array + 1.0 1.0 2.0 + 1.0 text_colors text + [||] [||] [||] [||] + line_colors line_styles line_widths + [||] [||] [||] [||] + ); () ) Modified: trunk/examples/ocaml/x18.ml =================================================================== --- trunk/examples/ocaml/x18.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/examples/ocaml/x18.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -120,7 +120,8 @@ if opt.(k) <> 0 then plline3 x y z else - plpoin3 x y z 1; + (* U+22C5 DOT OPERATOR. *) + plstring3 x y z "⋅"; plcol0 3; let title = Modified: trunk/examples/ocaml/x26.ml =================================================================== --- trunk/examples/ocaml/x26.ml 2010-12-31 23:58:49 UTC (rev 11408) +++ trunk/examples/ocaml/x26.ml 2011-01-01 00:26:35 UTC (rev 11409) @@ -158,7 +158,7 @@ plbox "" 0.0 0 "cmstv" 30.0 3; plcol0 3; plline freql phase; - plpoin freql phase 3; + plstring freql phase "*"; plcol0 3; plmtex "r" 5.0 0.5 0.5 alty_label; ); @@ -177,17 +177,22 @@ let symbol_colors = [| 0; 3 |] in let symbol_scales = [| 0.0; 1.0 |] in let symbol_numbers = [| 0; 4 |] in - let symbols = [| 0; 3 |] in + let symbols = [| ""; "*" |] in (* from the above opt_arrays we can completely ignore everything to do with boxes *) - plscol0a 15 32 32 32 0.90; - (*pllegend [PL_LEGEND_BACKGROUND] 0.57 0.85 0.06 15 opt_array - 1.0 1.0 2.0 - 1.0 text_colors legend_text - [||] [||] [||] - line_colors line_styles line_widths - symbol_colors symbol_scales symbol_numbers symbols;*) + plscol0a 15 32 32 32 0.70; + let _, _ = + pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + 0.0 0.0 0.10 15 + 1 1 0 0 + opt_array + 1.0 1.0 2.0 + 1.0 text_colors legend_text + [||] [||] [||] [||] + line_colors line_styles line_widths + symbol_colors symbol_scales symbol_numbers symbols + in () (*--------------------------------------------------------------------------*\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |