Commit 7fbd2315 authored by Pietro Abate's avatar Pietro Abate

[r2005-03-04 14:35:48 by afrisch] doc

Original author: afrisch
Date: 2005-03-04 14:35:49+00:00
parent a0171f82
......@@ -109,7 +109,7 @@ let rec unfold seen constrs ty =
let loop = unfold seen constrs in
slot.def <-
(match ty.desc with
| Tarrow (l,t1,t2,_) -> Arrow (l, loop t1, loop t2)
| Tarrow (l,t1,t2,_) -> let t1 = loop t1 in let t2 = loop t2 in Arrow (l, t1,t2)
| Ttuple tyl -> Tuple (List.map loop tyl)
| Tvariant rd ->
let fields =
......
......@@ -5,17 +5,8 @@
exceptions are available here. See Schema_common.
*)
(**
Glossary:
XSD XML Schema Document
PSV Post Schema Validation
PSVI Post Schema Validation Infoset
*)
open Encodings
(** {2 XSD representation} *)
type derivation_type = [ `Extension | `Restriction ]
type white_space_handling = [ `Preserve | `Replace | `Collapse ]
......@@ -138,8 +129,6 @@ type schema = {
model_groups: model_group_definition list;
}
(** {2 Events} see Schema_events module *)
type event =
| E_start_tag of Ns.qname
| E_end_tag of Ns.qname
......
......@@ -409,7 +409,7 @@ and validate_content_type ctx content_type =
| CT_empty ->
Value.nil
| CT_simple st_def ->
Value.sequence [ validate_simple_type_wrapper ctx st_def ]
validate_simple_type_wrapper ctx st_def
| CT_model (particle, mixed) ->
let mixold = ctx.ctx_mixed in
let ctx = subctx mixed ctx in
......
......@@ -2,7 +2,7 @@
(*
XML Schema validator
Usage: validate <schema_document> [ <instance_document> ... ]
Usage: validate <schema_document> [<instance_document> ...]
Exit codes:
0 validation ok
......@@ -32,7 +32,6 @@ let main () =
in
debug_print "Parsing schema document ...";
let schema = Schema_parser.schema_of_uri schema_file in
print_schema Format.std_formatter schema
(*
for i = 2 to Array.length Sys.argv - 1 do
let instance_stream = Schema_xml.pxp_stream_of_file Sys.argv.(i) in
......@@ -67,6 +66,7 @@ let main () =
flush stdout)
done
*)
()
let _ =
try
......
......@@ -1844,15 +1844,15 @@ let register_schema schema_name uri schema =
env := Env.add (Ident.ident name) (cd_type, v def) !env
) lst
in
defs "type" name_of_type_definition type_def validate_type schema.types;
defs "attribute" (fun a -> a.attr_name) att_decl
(fun _ -> assert false) schema.attributes;
defs "element" (fun e -> e.elt_name) elt_decl
validate_element schema.elements;
(* defs "attribute" (fun a -> a.attr_name) att_decl
(fun _ _ -> assert false) schema.attributes; *)
defs "attribute group" (fun ag -> ag.ag_name) attr_group
validate_attribute_group schema.attribute_groups;
defs "model group" (fun mg -> mg.mg_name) model_group
validate_model_group schema.model_groups;
defs "type" name_of_type_definition type_def validate_type schema.types;
defs "element" (fun e -> e.elt_name) elt_decl
validate_element schema.elements;
!env
let real_load_schema schema_name uri =
......
......@@ -204,22 +204,22 @@ more details).
</p>
<p>
In a CDuce module, you can write <code>external "M.f"</code>
In a CDuce module, you can write <code>M.f</code>
to denote the result of translating the OCaml value <code>M.f</code>
to CDuce. Actually, you can simply write <code>M.f</code>.
to CDuce.
</p>
<p>
If the value you want to use has a polymorphic type, you can make
the translation work by explicitly instantiating its type
variables with CDuce types. The syntax is <code>external { "M.f" t1
variables with CDuce types. The syntax is <code>M.f with { t1
... tn }</code> where the <code>ti</code> are CDuce types. The type
variables are listed in the order they appear in a left-to-right
reading of the OCaml type. Example:
</p>
<sample>
let listmap = external { "List.map" Int String }
let listmap = List.map with { Int String }
</sample>
<p>
......@@ -354,6 +354,27 @@ Here is the protocol to compile a single CDuce module:
</box>
<box title="Calling OCaml from the toplevel" link="topl">
<p>
The tool <code>cduce_mktop</code> creates custom versions of the CDuce
toplevel with built-in support for some OCaml modules / functions.
</p>
<sample>
cduce_mktop [target] [primitive file]
</sample>
<p>
The first argument is the file name of the resulting toplevel.
The second points to a file whose contents specify a set of built-in
OCaml values to be embedded in the toplevel. Each line must either
be a qualified value (like <code>List.map</code>) or
the name of an OCaml unit (like <code>List</code>).
</p>
</box>
<box title="Examples" link="examples">
<section title="Getting the value of an environment variable">
......
This diff is collapsed.
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