From: <hez...@us...> - 2011-04-11 03:15:13
|
Revision: 11694 http://plplot.svn.sourceforge.net/plplot/?rev=11694&view=rev Author: hezekiahcarty Date: 2011-04-11 03:15:07 +0000 (Mon, 11 Apr 2011) Log Message: ----------- OCaml: Change plsfont to take variants rather than integers The result should be more readable and matches the C API more clearly. 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/x23.ml Modified: trunk/bindings/ocaml/plplot.mli =================================================================== --- trunk/bindings/ocaml/plplot.mli 2011-04-10 20:59:22 UTC (rev 11693) +++ trunk/bindings/ocaml/plplot.mli 2011-04-11 03:15:07 UTC (rev 11694) @@ -628,6 +628,22 @@ | PL_COLORBAR_CAP_HIGH | PL_COLORBAR_SHADE_LABEL and plplot_colorbar_opt = plplot_colorbar_enum list +and plplot_fci_family_enum = + | PL_FCI_FAMILY_UNCHANGED + | PL_FCI_SANS + | PL_FCI_SERIF + | PL_FCI_MONO + | PL_FCI_SCRIPT + | PL_FCI_SYMBOL +and plplot_fci_style_enum = + | PL_FCI_STYLE_UNCHANGED + | PL_FCI_UPRIGHT + | PL_FCI_ITALIC + | PL_FCI_OBLIQUE +and plplot_fci_weight_enum = + | PL_FCI_WEIGHT_UNCHANGED + | PL_FCI_MEDIUM + | PL_FCI_BOLD external pl_setcontlabelformat : int -> int -> unit = "camlidl_plplot_core_c_pl_setcontlabelformat" external pl_setcontlabelparam : float -> float -> float -> int -> unit @@ -848,7 +864,8 @@ external plsfam : int -> int -> int -> unit = "camlidl_plplot_core_c_plsfam" external plsfci : int64 -> unit = "camlidl_plplot_core_c_plsfci" external plsfnam : string -> unit = "camlidl_plplot_core_c_plsfnam" -external plsfont : int -> int -> int -> unit +external plsfont : plplot_fci_family_enum -> plplot_fci_style_enum -> + plplot_fci_weight_enum -> unit = "camlidl_plplot_core_c_plsfont" external plsmaj : float -> float -> unit = "camlidl_plplot_core_c_plsmaj" external plsmin : float -> float -> unit = "camlidl_plplot_core_c_plsmin" Modified: trunk/bindings/ocaml/plplot_core.idl =================================================================== --- trunk/bindings/ocaml/plplot_core.idl 2011-04-10 20:59:22 UTC (rev 11693) +++ trunk/bindings/ocaml/plplot_core.idl 2011-04-11 03:15:07 UTC (rev 11694) @@ -96,6 +96,29 @@ }; typedef [set] enum plplot_colorbar_enum plplot_colorbar_opt; +enum plplot_fci_family_enum { + // = These are legal values for font family attribute + PL_FCI_FAMILY_UNCHANGED = -1, + PL_FCI_SANS = 0x0, + PL_FCI_SERIF = 0x1, + PL_FCI_MONO = 0x2, + PL_FCI_SCRIPT = 0x3, + PL_FCI_SYMBOL = 0x4 +}; +enum plplot_fci_style_enum { + // = These are legal values for font style attribute + PL_FCI_STYLE_UNCHANGED = -1, + PL_FCI_UPRIGHT = 0x0, + PL_FCI_ITALIC = 0x1, + PL_FCI_OBLIQUE = 0x2 +}; +enum plplot_fci_weight_enum { + // = These are legal values for font weight attribute + PL_FCI_WEIGHT_UNCHANGED = -1, + PL_FCI_MEDIUM = 0x0, + PL_FCI_BOLD = 0x1 +}; + // 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 2011-04-10 20:59:22 UTC (rev 11693) +++ trunk/bindings/ocaml/plplot_h 2011-04-11 03:15:07 UTC (rev 11694) @@ -463,7 +463,7 @@ c_plsfnam(const char *fnam); void -c_plsfont(PLINT family, PLINT style, PLINT weight); +c_plsfont( enum plplot_fci_family_enum family, enum plplot_fci_style_enum style, enum plplot_fci_weight_enum weight); /* void Modified: trunk/bindings/ocaml/plplot_h.inc =================================================================== --- trunk/bindings/ocaml/plplot_h.inc 2011-04-10 20:59:22 UTC (rev 11693) +++ trunk/bindings/ocaml/plplot_h.inc 2011-04-11 03:15:07 UTC (rev 11694) @@ -108,7 +108,7 @@ [mlname(plsfam)] void c_plsfam ( int fam, int num, int bmax ); [mlname(plsfci)] void c_plsfci ( long long fci ); [mlname(plsfnam)] void c_plsfnam ( [string] const char * fnam ); -[mlname(plsfont)] void c_plsfont ( int family, int style, int weight ); +[mlname(plsfont)] void c_plsfont ( enum plplot_fci_family_enum family, enum plplot_fci_style_enum style, enum plplot_fci_weight_enum weight ); [mlname(plsmaj)] void c_plsmaj ( double def, double scale ); [mlname(plsmin)] void c_plsmin ( double def, double scale ); [mlname(plsori)] void c_plsori ( int ori ); Modified: trunk/examples/ocaml/x23.ml =================================================================== --- trunk/examples/ocaml/x23.ml 2011-04-10 20:59:22 UTC (rev 11693) +++ trunk/examples/ocaml/x23.ml 2011-04-11 03:15:07 UTC (rev 11694) @@ -215,6 +215,25 @@ "bold"; |] +let family_of_int = [| + PL_FCI_SANS; + PL_FCI_SERIF; + PL_FCI_MONO; + PL_FCI_SCRIPT; + PL_FCI_SYMBOL; +|] + +let style_of_int = [| + PL_FCI_UPRIGHT; + PL_FCI_ITALIC; + PL_FCI_OBLIQUE; +|] + +let weight_of_int = [| + PL_FCI_MEDIUM; + PL_FCI_BOLD; +|] + let () = plparseopts Sys.argv [PL_PARSE_FULL]; @@ -320,7 +339,8 @@ style.(style_index) weight.(weight_index); | 12 -> - plsfont family_index style_index weight_index; + plsfont family_of_int.(family_index) style_of_int.(style_index) + weight_of_int.(weight_index); sprintf "Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog" family.(family_index) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |