diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-10-18 09:40:59 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-10-18 09:40:59 +0000 |
commit | cdcb658c29409c8aef94ca3e22c14a90b396aea0 (patch) | |
tree | 8981d0a2312604c6b8ab8a8acb108f39f1cd1377 /lib/Camlcoq.ml | |
parent | f535ac931c2b7dc65fefa83e47bb8c79ca90e92d (diff) | |
download | compcert-kvx-cdcb658c29409c8aef94ca3e22c14a90b396aea0.tar.gz compcert-kvx-cdcb658c29409c8aef94ca3e22c14a90b396aea0.zip |
Extraction: map Coq pairs to Caml pairs and Coq chars (type ascii) to Caml chars
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1732 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'lib/Camlcoq.ml')
-rw-r--r-- | lib/Camlcoq.ml | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/Camlcoq.ml b/lib/Camlcoq.ml index 34aaa0fd..cfbca6e6 100644 --- a/lib/Camlcoq.ml +++ b/lib/Camlcoq.ml @@ -109,27 +109,11 @@ let extern_atom a = (* Strings *) -let char_of_ascii (Ascii.Ascii(a0, a1, a2, a3, a4, a5, a6, a7)) = - Char.chr( (if a0 then 1 else 0) - + (if a1 then 2 else 0) - + (if a2 then 4 else 0) - + (if a3 then 8 else 0) - + (if a4 then 16 else 0) - + (if a5 then 32 else 0) - + (if a6 then 64 else 0) - + (if a7 then 128 else 0)) - -let coqstring_length s = - let rec len accu = function - | String0.EmptyString -> accu - | String0.String(_, s) -> len (accu + 1) s - in len 0 s - -let camlstring_of_coqstring s = - let r = String.create (coqstring_length s) in +let camlstring_of_coqstring (s: char list) = + let r = String.create (List.length s) in let rec fill pos = function - | String0.EmptyString -> r - | String0.String(c, s) -> r.[pos] <- char_of_ascii c; fill (pos + 1) s + | [] -> r + | c :: s -> r.[pos] <- c; fill (pos + 1) s in fill 0 s (* Timing facility *) |