From: <hez...@us...> - 2011-01-29 17:11:33
|
Revision: 11524 http://plplot.svn.sourceforge.net/plplot/?rev=11524&view=rev Author: hezekiahcarty Date: 2011-01-29 17:11:27 +0000 (Sat, 29 Jan 2011) Log Message: ----------- Finish propagation of pllegend API changes to OCaml bindings and examples Modified Paths: -------------- trunk/bindings/ocaml/plplot.mli trunk/bindings/ocaml/plplot_core.idl trunk/bindings/ocaml/plplot_impl.c trunk/examples/ocaml/x04.ml trunk/examples/ocaml/x26.ml Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2011-01-29 17:10:54 UTC (rev 11523) +++ trunk/bindings/ocaml/plplot.mli 2011-01-29 17:11:27 UTC (rev 11524) @@ -558,7 +558,7 @@ | PL_POSITION_OUTSIDE | PL_POSITION_VIEWPORT | PL_POSITION_SUBPAGE -and plplot_legend_position = plplot_position_enum list +and plplot_position_opt = plplot_position_enum list and plplot_legend_enum = PL_LEGEND_NONE | PL_LEGEND_COLOR_BOX @@ -695,7 +695,7 @@ float -> int -> int -> float -> int -> string -> string -> float array -> float array -> unit = "camlidl_plplot_core_c_plcolorbar_bytecode" "camlidl_plplot_core_c_plcolorbar" -external pllegend : plplot_legend_position -> plplot_legend_opt -> +external pllegend : plplot_position_opt -> 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 -> Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2011-01-29 17:10:54 UTC (rev 11523) +++ trunk/bindings/ocaml/plplot_core.idl 2011-01-29 17:11:27 UTC (rev 11524) @@ -68,7 +68,7 @@ PL_POSITION_VIEWPORT = 64, PL_POSITION_SUBPAGE = 128, }; -typedef [set] enum plplot_position_enum plplot_legend_position; +typedef [set] enum plplot_position_enum plplot_position_opt; enum plplot_legend_enum { PL_LEGEND_NONE = 1, @@ -83,20 +83,16 @@ 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, - PL_COLORBAR_SHADE_LABEL = 8192, + PL_COLORBAR_LABEL_LEFT = 1, + PL_COLORBAR_LABEL_RIGHT = 2, + PL_COLORBAR_LABEL_UPPER = 4, + PL_COLORBAR_LABEL_LOWER = 8, + PL_COLORBAR_IMAGE = 16, + PL_COLORBAR_SHADE = 32, + PL_COLORBAR_GRADIENT = 64, + PL_COLORBAR_CAP_LOW = 128, + PL_COLORBAR_CAP_HIGH = 256, + PL_COLORBAR_SHADE_LABEL = 512, }; typedef [set] enum plplot_colorbar_enum plplot_colorbar_opt; @@ -295,5 +291,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_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") +RAW_ML(external pllegend : plplot_position_opt -> 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_impl.c =================================================================== --- trunk/bindings/ocaml/plplot_impl.c 2011-01-29 17:10:54 UTC (rev 11523) +++ trunk/bindings/ocaml/plplot_impl.c 2011-01-29 17:11:27 UTC (rev 11524) @@ -748,18 +748,30 @@ 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, +int translate_position_option( int position_option ) +{ + int translated_option; + switch ( position_option ) + { + case 0: translated_option = PL_POSITION_LEFT; break; + case 1: translated_option = PL_POSITION_RIGHT; break; + case 2: translated_option = PL_POSITION_UPPER; break; + case 3: translated_option = PL_POSITION_LOWER; break; + case 4: translated_option = PL_POSITION_INSIDE; break; + case 5: translated_option = PL_POSITION_OUTSIDE; break; + case 6: translated_option = PL_POSITION_VIEWPORT; break; + case 7: translated_option = PL_POSITION_SUBPAGE; break; + default: translated_option = -1; + } + return translated_option; +} + +value ml_pllegend( value position, value opt, value x, value y, value plot_width, value bg_color, value bb_color, value bb_style, value nrow, value ncolumn, @@ -772,21 +784,19 @@ value symbol_colors, value symbol_scales, value symbol_numbers, value symbols ) { - CAMLparam5( opt, x, y, plot_width, bg_color ); - 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 ); - CAMLxparam2( symbol_numbers, symbols ); + CAMLparam5( position, opt, x, y, plot_width ); + CAMLxparam5( bg_color, bb_color, bb_style, nrow, ncolumn ); + CAMLxparam5( opt_array, text_offset, text_scale, text_spacing, text_justification ); + CAMLxparam5( text_colors, text, box_colors, box_patterns, box_scales ); + CAMLxparam5( box_line_widths, line_colors, line_styles, line_widths, symbol_colors ); + CAMLxparam3( symbol_scales, symbol_numbers, symbols ); CAMLlocal1( result ); result = caml_alloc( 2, 0 ); // Counter int i; // General legend options - int c_opt; + int c_position, c_opt; // Number of legend entries int n_legend; n_legend = Wosize_val( opt_array ); @@ -811,6 +821,7 @@ // Translate the legend configuration options c_opt = lor_ml_list( opt, translate_legend_option ); + c_position = lor_ml_list( position, translate_position_option ); for ( i = 0; i < n_legend; i++ ) { @@ -821,7 +832,7 @@ // The returned width and height of the legend PLFLT width, height; - pllegend( &width, &height, c_opt, Double_val( x ), Double_val( y ), + pllegend( &width, &height, c_position, 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 ), @@ -850,7 +861,7 @@ 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[22], argv[23], argv[24], - argv[25], argv[26] ); + argv[25], argv[26], argv[27] ); } // pltr* function implementations Modified: trunk/examples/ocaml/x04.ml =================================================================== --- trunk/examples/ocaml/x04.ml 2011-01-29 17:10:54 UTC (rev 11523) +++ trunk/examples/ocaml/x04.ml 2011-01-29 17:11:27 UTC (rev 11524) @@ -88,7 +88,7 @@ plscol0a 15 32 32 32 0.70; ignore ( - pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + pllegend [] [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] 0.0 0.0 0.1 15 1 1 0 0 opt_array @@ -117,7 +117,7 @@ plscol0a 15 32 32 32 0.70; ignore ( - pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + pllegend [] [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] 0.0 0.0 0.1 15 1 1 0 0 opt_array Modified: trunk/examples/ocaml/x26.ml =================================================================== --- trunk/examples/ocaml/x26.ml 2011-01-29 17:10:54 UTC (rev 11523) +++ trunk/examples/ocaml/x26.ml 2011-01-29 17:11:27 UTC (rev 11524) @@ -183,7 +183,7 @@ plscol0a 15 32 32 32 0.70; let _, _ = - pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] + pllegend [] [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] 0.0 0.0 0.10 15 1 1 0 0 opt_array This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |