demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Demexp-dev] OCaml/CDuce interface issue with 32 bits/64 bits architectu


From: David MENTRE
Subject: [Demexp-dev] OCaml/CDuce interface issue with 32 bits/64 bits architectures
Date: Mon, 02 Oct 2006 23:02:13 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Hello CDuce users,

I'm using CDuce to read and write XML files.

I have following definition in my xml.cd file:
 type Ocaml_int = -1073741824 -- 1073741823 ;;
 type Ocaml_vote = { voter = Ocaml_string; 
                     choices = [ Ocaml_int* ] } ;;


And corresponding definition in xml.mli:
 type vote = {
     voter : string;
     choices : int list;
   }

That works on 32 bits arch but breaks on 64 bits one, because OCaml int
is wider[1].

I'm using CDuce 0.4.0.

Any idea how to fix that cleanly, for example by reference to
Pervasives.min_int and max_int? 

I tried to call them but apparently CDuce only accepts literal integer
or a Cduce type/pattern expression:
  Parsing error: '*' or INT expected after '--' (in [type/pattern expression])


I also tried following definition:
 <<xml.cd>>=
 type Ocaml_int = !int ;;
but it breaks at type inference in CDuce:

 This expression should have type:
 [ Int* ]
 but its inferred type is:
 Ocaml_tagid_list

with following type definition in my code:
 type Ocaml_tagid_list = [ Ocaml_int* ] ;;


Best wishes,
david

Footnotes: 
[1]  

cduce -I [...]  -pp "cduce --mlstub" \
                -impl xml.cdo
The type for the value save is invalid
Expected Caml type:string -> xml_content -> unit
Expected CDuce type:Latin1 -> {
                              tags=[ [
-4611686018427387904--4611686018427387903
                                     Latin1 Byte* ]* ]
                              tagged_questions=[ [
-4611686018427387904--4611686018427387903+ ]* ]
                              version=Latin1
                              participants=[
(-4611686018427387904--4611686018427387903,
                                             { kind=`Individual | `Delegate
                                             password=Latin1
                                             p_timestamp=Latin1 login=Latin1
                                             groups=[ Latin1* ] })* ]
                              questions=[
(-4611686018427387904--4611686018427387903,
                                          { q_timestamp=Latin1
                                          limit_date=Latin1
                                          elected=[
-4611686018427387904--4611686018427387903* ]
                                          status=`Public | `Tagging_only
                                          q_author=Latin1 q_desc=Latin1
                                          responses=[ { r_author=Latin1
                                                      r_links=[ Latin1* ]
                                                      r_desc=Latin1 }* ]
                                          votes=[ {
                                                  choices=[
-4611686018427387904--4611686018427387903* ]
                                                  voter=Latin1 }* ] })* ] }
->
                    [  ]
Inferred type:Latin1 -> { tags=[ [ -1073741824--1073741823 Latin1 Byte* ]* ]
                        tagged_questions=[ [ -1073741824--1073741823+ ]* ]
                        version=Latin1
                        participants=[ (-1073741824--1073741823,{

kind=`Individual |
                                                                `Delegate

password=Latin1

p_timestamp=Latin1
                                                                login=Latin1
                                                                groups=X1
})* ]
                        questions=[ (-1073741824--1073741823,{

q_timestamp=Latin1

limit_date=Latin1
                                                             elected=X2
                                                             status=`Public
|
                                                             `Tagging_only
                                                             q_author=Latin1
                                                             q_desc=Latin1
                                                             responses=
                                                             [ {

r_author=Latin1
                                                               r_links=X1
                                                               r_desc=Latin1
}* ]
                                                             votes=[
                                                                   {

choices=X2

voter=Latin1 }* ] })* ] } ->
              [  ] where
              X1 = [ Latin1* ] and
              X2 = [ -1073741824--1073741823* ]
Preprocessor error


-- 
GPG/PGP key: A3AD7A2A David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A




reply via email to

[Prev in Thread] Current Thread [Next in Thread]