From: <hez...@us...> - 2009-09-23 20:57:55
|
Revision: 10464 http://plplot.svn.sourceforge.net/plplot/?rev=10464&view=rev Author: hezekiahcarty Date: 2009-09-23 20:57:49 +0000 (Wed, 23 Sep 2009) Log Message: ----------- Change plglevel to return a variant type in the OCaml bindings This also fixes the use of ( != ) when ( <> ) should have been used in example 31. 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/examples/ocaml/x31.ml Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2009-09-23 20:56:58 UTC (rev 10463) +++ trunk/bindings/ocaml/plplot.mli 2009-09-23 20:57:49 UTC (rev 10464) @@ -480,6 +480,12 @@ | PL_HIST_NOEXPAND | PL_HIST_NOEMPTY and plplot_hist_style = plplot_hist_enum list +and plplot_run_level_enum = + | PL_UNINITIALIZED + | PL_INITIALIZED + | PL_VIEWPORT_DEFINED + | PL_WORLD_COORDINATES_DEFINED +and plplot_run_level = plplot_run_level_enum external pl_setcontlabelformat : int -> int -> unit = "camlidl_plplot_core_c_pl_setcontlabelformat" external pl_setcontlabelparam : float -> float -> float -> int -> unit @@ -559,7 +565,7 @@ external plgfam : unit -> int * int * int = "camlidl_plplot_core_c_plgfam" external plgfnam : unit -> string = "camlidl_plplot_core_c_plgfnam" external plgfont : unit -> int * int * int = "camlidl_plplot_core_c_plgfont" -external plglevel : unit -> int = "camlidl_plplot_core_c_plglevel" +external plglevel : unit -> plplot_run_level = "camlidl_plplot_core_c_plglevel" external plgpage : unit -> float * float * int * int * int * int = "camlidl_plplot_core_c_plgpage" external plgra : unit -> unit = "camlidl_plplot_core_c_plgra" Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2009-09-23 20:56:58 UTC (rev 10463) +++ trunk/bindings/ocaml/plplot_core.idl 2009-09-23 20:57:49 UTC (rev 10464) @@ -50,6 +50,14 @@ }; typedef [set] enum plplot_hist_enum plplot_hist_style; +enum plplot_run_level_enum { + PL_UNINITIALIZED = 0, + PL_INITIALIZED = 1, + PL_VIEWPORT_DEFINED = 2, + PL_WORLD_COORDINATES_DEFINED = 3, +}; +typedef enum plplot_run_level_enum plplot_run_level; + // 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; Modified: trunk/bindings/ocaml/plplot_h =================================================================== --- trunk/bindings/ocaml/plplot_h 2009-09-23 20:56:58 UTC (rev 10463) +++ trunk/bindings/ocaml/plplot_h 2009-09-23 20:57:49 UTC (rev 10464) @@ -173,7 +173,7 @@ c_plgfont(PLINT *p_family, PLINT *p_style, PLINT *p_weight); void -c_plglevel(PLINT *p_level); +c_plglevel(plplot_run_level *p_level); void c_plgpage(PLFLT *p_xp, PLFLT *p_yp, Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2009-09-23 20:56:58 UTC (rev 10463) +++ trunk/bindings/ocaml/plplot_h.inc 2009-09-23 20:57:49 UTC (rev 10464) @@ -42,7 +42,7 @@ [mlname(plgfam)] void c_plgfam ( [out] int * p_fam, [out] int * p_num, [out] int * p_bmax ); [mlname(plgfnam)] void c_plgfnam ( [string, out, length_is(1024)] char * fnam ); [mlname(plgfont)] void c_plgfont ( [out] int * p_family, [out] int * p_style, [out] int * p_weight ); -[mlname(plglevel)] void c_plglevel ( [out] int * p_level ); +[mlname(plglevel)] void c_plglevel ( [out] plplot_run_level * p_level ); [mlname(plgpage)] void c_plgpage ( [out] double * p_xp, [out] double * p_yp, [out] int * p_xleng, [out] int * p_yleng, [out] int * p_xoff, [out] int * p_yoff ); [mlname(plgra)] void c_plgra ( void ); [mlname(plgspa)] void c_plgspa ( [out] double * xmin, [out] double * xmax, [out] double * ymin, [out] double * ymax ); Modified: trunk/examples/ocaml/x31.ml =================================================================== --- trunk/examples/ocaml/x31.ml 2009-09-23 20:56:58 UTC (rev 10463) +++ trunk/examples/ocaml/x31.ml 2009-09-23 20:57:49 UTC (rev 10464) @@ -107,10 +107,14 @@ plscol0 1 255 0 0; plscmap1 r1 g1 b1; plscmap1a r1 g1 b1 a1; - + let level2 = plglevel () in - printf "level parameter = %d\n" level2; - failed_if (level2 != 1) "plglevel test failed.\n"; + (* WARNING: The use of Obj.magic here is a cheat. This really should be + replaced by a proper int_of_plplot_run_level function. This example is + the only place it would be needed though, so it is not worth it at + this time. *) + printf "level parameter = %d\n" (Obj.magic level2); + failed_if (level2 <> PL_INITIALIZED) "plglevel test failed.\n"; pladv 0; plvpor 0.01 0.99 0.02 0.49; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |