Commit 2d92c704 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-06-28 09:55:12 by afrisch] Get rid of cdml

Original author: afrisch
Date: 2004-06-28 09:55:12+00:00
parent c6c27cbf
......@@ -92,10 +92,10 @@ INSTALL := $(shell which install)
all: cduce dtd2cduce validate cdo2ml
ifneq ($(ML_INTERFACE), false)
all: cdml.$(EXTENSION_LIB)
all: cDuce_all.$(EXTENSION_LIB)
endif
install: all install_cdml
install: all install_lib
mkdir -p $(BINDIR)
mkdir -p $(MANDIR)/man1
$(INSTALL) -m755 cduce$(EXE) dtd2cduce$(EXE) \
......@@ -104,12 +104,12 @@ install: all install_cdml
$(INSTALL) -m644 doc/dtd2cduce.1 $(MANDIR)/man1/
$(INSTALL) -m644 doc/validate.1 $(MANDIR)/man1/
install_cdml:
install_lib:
ifneq ($(ML_INTERFACE), false)
$(OCAMLFIND) install cduce META \
cdml.$(EXTENSION_LIB) cdo2cmo/cdml.cmi \
cDuce_all.cmi oCaml_all.$(EXTENSION_LIB) \
$(wildcard *.a) oCaml_all.cmi
cDuce_all.cmi cDuce_all.$(EXTENSION_LIB) \
oCaml_all.cmi oCaml_all.$(EXTENSION_LIB) \
$(wildcard *.a)
endif
uninstall:
......@@ -212,18 +212,15 @@ cduce_packed: cduce_packed.$(EXTENSION)
$(LINK) $(INCLUDES) -o $@ $(ML_LIB) $^ $(EXTRA_LINK_OPTS)
cdml.$(EXTENSION_LIB): $(OBJECTS:.cmo=.$(EXTENSION))
cDuce_all.$(EXTENSION_LIB): $(OBJECTS:.cmo=.$(EXTENSION))
echo 'version="$(VERSION)"' > META
echo 'requires="$(PACKAGES) camlp4.gramlib"' >> META
echo 'description="Runtime support for CDuce"' >> META
echo 'archive(byte)="oCaml_all.cma,cdml.cma"' >> META
echo 'archive(native)="oCaml_all.cmxa,cdml.cmxa"' >> META
echo 'archive(byte)="oCaml_all.cma,cDuce_all.cma"' >> META
echo 'archive(native)="oCaml_all.cmxa,cDuce_all.cmxa"' >> META
$(COMPILE) -o cDuce_all.$(EXTENSION) -pack $^
$(COMPILE) -c cdo2cmo/cdml.mli
$(COMPILE) -c cdo2cmo/cdml.ml
$(COMPILE) -a -o cdml.$(EXTENSION_LIB) \
cDuce_all.$(EXTENSION) \
cdo2cmo/cdml.$(EXTENSION)
$(COMPILE) -a -o cDuce_all.$(EXTENSION_LIB) \
cDuce_all.$(EXTENSION)
oCaml_all.$(EXTENSION_LIB):
cd cdo2cmo; $(MAKE) PREFIX=$(ML_MODULES) MODEL=$(ML_INTERFACE) $@
......
(** [any] is the used to represent all CDuce possible values ( = Value.t ). *)
(*
type any
open CDuce_all
......@@ -64,3 +65,4 @@ val cduce2ocaml_tuple_4 : 'a cd2ml -> 'b cd2ml -> 'c cd2ml -> 'd cd2ml -> Value.
val ocaml2cduce_unit : unit -> Value.t
val cduce2ocaml_unit : Value.t -> unit
*)
......@@ -225,9 +225,9 @@ and to_cd_descr e = function
in
<:expr< Value.record $list_lit l$ >>)
| Abstract "int" -> <:expr< ocaml2cduce_int $e$ >>
| Abstract "char" -> <:expr< ocaml2cduce_char $e$ >>
| Abstract "string" -> <:expr< ocaml2cduce_string $e$ >>
| Abstract "int" -> <:expr< Value.ocaml2cduce_int $e$ >>
| Abstract "char" -> <:expr< Value.ocaml2cduce_char $e$ >>
| Abstract "string" -> <:expr< Value.ocaml2cduce_string $e$ >>
| Abstract s -> <:expr< Value.abstract $str:String.escaped s$ $e$ >>
| Builtin ("list",[t]) ->
(* Value.sequence_rev (List.rev_map fun_t <...>) *)
......@@ -351,9 +351,9 @@ and to_ml_descr e = function
<:expr< Value.get_field $x$ $label_ascii lab$ >> t)) l in
<:expr< {$list:l$} >>)
| Abstract "int" -> <:expr< cduce2ocaml_int $e$ >>
| Abstract "char" -> <:expr< cduce2ocaml_char $e$ >>
| Abstract "string" -> <:expr< cduce2ocaml_string $e$ >>
| Abstract "int" -> <:expr< Value.cduce2ocaml_int $e$ >>
| Abstract "char" -> <:expr< Value.cduce2ocaml_char $e$ >>
| Abstract "string" -> <:expr< Value.cduce2ocaml_string $e$ >>
| Abstract s -> <:expr< Value.get_abstract $e$ >>
| Builtin ("list",[t]) ->
(* List.rev_map fun_t (Value.get_sequence_rev <...> *)
......@@ -451,7 +451,6 @@ let stub name ty_env c_env values =
let (v1,v2,...,vn) =
let module C = struct
let cu = ...
open Cdml
open CDuce_all
let types = ...
let rec <global translation functions>
......@@ -466,8 +465,7 @@ let stub name ty_env c_env values =
let items_pat = List.map (fun (p,_,_) -> p) items in
let m =
[ <:str_item< open Cdml >>;
<:str_item< open CDuce_all >>;
[ <:str_item< open CDuce_all >>;
<:str_item< value types = Librarian.registered_types cu >> ] @
(if g = [] then [] else [ <:str_item< value rec $list:g$ >> ]) @
[ <:str_item< declare $list:exts$ end >>;
......
......@@ -589,3 +589,21 @@ let mk_ext_ref t get set =
and set = Abstraction ([t, Sequence.nil_type], fun v -> set v; nil) in
Record (Builtin_defs.mk_ref ~get ~set)
let ocaml2cduce_int i =
Integer (Intervals.V.from_int i)
let cduce2ocaml_int = function
| Integer i -> Intervals.V.get_int i
| _ -> assert false
let ocaml2cduce_string = string_latin1
let cduce2ocaml_string = get_string_latin1
let ocaml2cduce_char c =
Char (Chars.V.mk_char c)
let cduce2ocaml_char = function
| Char c -> Chars.V.to_char c
| _ -> assert false
......@@ -103,3 +103,10 @@ val ( |<>| ): t -> t -> bool
val set_cdr : t -> t -> unit
val append_cdr : t -> t -> t
val ocaml2cduce_int : int -> t
val cduce2ocaml_int : t -> int
val ocaml2cduce_string : string -> t
val cduce2ocaml_string : t -> string
val ocaml2cduce_char : char -> t
val cduce2ocaml_char : t -> char
# Do "make install_cdml" before running this test
STATIC=
STATIC=-static
run:
ocamlc -c a.mli
......
......@@ -15,6 +15,7 @@ let equal = eq_big_int
let check i = ()
let from_int i = big_int_of_int i
(* TODO: better serialization of bigints !!! *)
let serialize t i = Serialize.Put.string t (string_of_big_int i)
......
......@@ -2,6 +2,7 @@ module V : sig
include Custom.T
val print : Format.formatter -> t -> unit
val mk: string -> t
val from_int: int -> t
val to_string: t -> string
val is_int: t -> bool
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment