[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Demexp-dev] Interface between OCaml and Cduce
From: |
David MENTRE |
Subject: |
[Demexp-dev] Interface between OCaml and Cduce |
Date: |
Mon, 01 Nov 2004 21:07:52 +0100 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Hello Serge,
As we agree on phone, here is the interface between OCaml and CDuce. I
think the file is self explanatory. I tried to make the structures as
simple as possible for you. Let me know of any issue or error I might
have done.
Each hash table is indexed by the respective question, tag or
participant identifiers (i.e. XML <... id="..">).
The next_id parts are skipped. I think I will erase them from the DTD
altogether.
The save part is probably not the most optimal, but it is a first try.
There is no hurry, take your time. :)
(* interface between OCaml and CDuce to load/save XML files.
version: 2004-11-01 *)
type participant_kind =
Individual
| Delegate
type participant = {
kind : participant_kind;
login : string;
password : string;
groups : string list;
}
type response = {
r_id : int;
r_desc : string;
r_author : string;
r_link : string option;
}
type vote = {
voter : int;
choices : int list;
}
type question = {
q_desc : string;
q_author : string;
limit_date : string;
responses : response list;
votes : vote list;
elected : int list;
}
type xml_content = {
version : string;
participants : (int, participant) Hashtbl.t;
(* participant_id -> participant *)
tags : (int, string) Hashtbl.t;
(* tag_id -> label *)
questions : (int, question) Hashtbl.t;
(* question_id -> question *)
(* no classification right now *)
}
(* usage: let xml = load_xml_demexp "path/to/file" in *)
val load_xml_demexp : string -> xml_content
(* usage: save_xml_demexp "path/to/file" xml *)
val save_xml_demexp : string -> xml_content -> unit
Yours,
d.
--
pub 1024D/A3AD7A2A 2004-10-03 David MENTRE <address@hidden>
5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A
- [Demexp-dev] Interface between OCaml and Cduce,
David MENTRE <=