1999-11-30 06:59:39 -08:00
|
|
|
let cCAMLtoTKunits : units -> tkArgs = function
|
2000-02-16 03:51:37 -08:00
|
|
|
| `Pix (foo) -> TkToken (string_of_int foo)
|
1999-11-30 06:59:39 -08:00
|
|
|
| `Mm (foo) -> TkToken(string_of_float foo^"m")
|
|
|
|
| `In (foo) -> TkToken(string_of_float foo^"i")
|
|
|
|
| `Pt (foo) -> TkToken(string_of_float foo^"p")
|
|
|
|
| `Cm (foo) -> TkToken(string_of_float foo^"c")
|
|
|
|
|
|
|
|
let cTKtoCAMLunits str =
|
|
|
|
let len = String.length str in
|
2000-04-11 20:43:25 -07:00
|
|
|
let num_part str = String.sub str ~pos:0 ~len:(len - 1) in
|
1999-11-30 06:59:39 -08:00
|
|
|
match String.get str (pred len) with
|
2000-02-16 03:51:37 -08:00
|
|
|
| 'c' -> `Cm (float_of_string (num_part str))
|
1999-11-30 06:59:39 -08:00
|
|
|
| 'i' -> `In (float_of_string (num_part str))
|
|
|
|
| 'm' -> `Mm (float_of_string (num_part str))
|
|
|
|
| 'p' -> `Pt (float_of_string (num_part str))
|
|
|
|
| _ -> `Pix(int_of_string str)
|
|
|
|
|