Release coccinelle-0.2.3rc2
[bpt/coccinelle.git] / pycaml / pycamltest.ml
CommitLineData
34e49164
C
1(*
2 * (C) arty 2002
3 * This software is covered under the GNU lesser general public license
4 *)
5open Pycaml ;;
6
7let colorsys = pyimport_importmodule "colorsys"
8let dict = pymodule_getdict colorsys
9
10let triplet = pytuple3 (pyfloat_fromdouble 1.0,
11 pyfloat_fromdouble 0.5,
12 pyfloat_fromdouble 0.2) ;;
13
14let rgbtoyiq = pydict_getitemstring (dict,"rgb_to_yiq")
15let triplet = pyeval_callobject (rgbtoyiq,triplet)
16
17let _ = print_endline ((string_of_float
ae4735db 18 (pyfloat_asdouble (pytuple_getitem (triplet,0)))) ^
34e49164
C
19 " " ^
20 (string_of_float
21 (pyfloat_asdouble (pytuple_getitem (triplet,1)))) ^
22 " " ^
23 (string_of_float
24 (pyfloat_asdouble (pytuple_getitem (triplet,2))))) ;;
25
ae4735db
C
26let x = pywrap_closure
27 (fun x -> print_string (pystring_asstring (pytuple_getitem (x,0))) ;
34e49164
C
28 pynone ())
29
ae4735db 30let _ = pyeval_callobject
34e49164 31 (x,pytuple_fromsingle (pystring_fromstring "hi there"))