Commit bacc56cd authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-03-06 22:51:32 by afrisch] Empty log message

Original author: afrisch
Date: 2005-03-06 22:51:32+00:00
parent b8a3c04e
......@@ -22,22 +22,6 @@ let unsupported = [ "NOTATION"; "QName" ]
let is_empty s = Utf8.equal s (Utf8.mk "")
let int_types =
[ "integer", None, None;
"nonPositiveInteger", None, Some "0";
"negativeInteger", None, Some "-1";
"long", Some "-9223372036854775808", Some "9223372036854775807";
"int", Some "-2147483648", Some "2147483647";
"short", Some "-32768", Some "32767";
"byte", Some "-128", Some "127";
"nonNegativeInteger", Some "0", None;
"unsignedLong", Some "0", Some "18446744073709551615";
"unsignedInt", Some "0", Some "4294967295";
"unsignedShort", Some "0", Some "65535";
"unsignedByte", Some "0", Some "255";
"positiveInteger", Some "1", None ]
let xml_S_RE = pcre_regexp "[ \\t\\r\\n]+"
(* split a string at XML recommendation "S" production boundaries *)
let split_xml_S s = pcre_split ~rex:xml_S_RE s
......@@ -445,10 +429,6 @@ let any_simple_type =
primitive "anySimpleType" Builtin_defs.string validate_string
let string =
primitive "string" Builtin_defs.string validate_string
(*
let integer =
primitive "integer" Builtin_defs.int validate_integer
*)
let _ =
primitive "boolean" Builtin_defs.bool validate_bool
let _ =
......@@ -486,75 +466,37 @@ let _ =
let _ =
List.iter (fun n -> alias n string) unsupported
(* derived builtins *)
(*
let nonpos =
restrict "nonPositiveInteger" integer
{ no_facets with maxInclusive = Some (Value.Integer zero, false) }
nonPositiveInteger_type validate_nonPositiveInteger
let _ =
restrict "negativeInteger" nonpos
{ no_facets with maxInclusive = Some (Value.Integer minus_one, false) }
negativeInteger_type validate_negativeInteger
let nonneg =
restrict "nonNegativeInteger" integer
{ no_facets with minInclusive = Some (Value.Integer zero, false) }
nonNegativeInteger_type validate_nonNegativeInteger
let _ =
restrict "positiveInteger" nonneg
{ no_facets with minInclusive = Some (Value.Integer one, false) }
positiveInteger_type validate_positiveInteger
let long =
restrict "long" integer
{ no_facets with
minInclusive = Some (Value.Integer long_l, false);
maxInclusive = Some (Value.Integer long_r, false)}
long_type validate_long
let ulong =
restrict "unsignedLong" nonneg
{ no_facets with
minInclusive = Some (Value.Integer zero, false);
maxInclusive = Some (Value.Integer ulong, false)}
long_type validate_long
let int =
restrict "int" long
{ no_facets with
minInclusive = Some (Value.Integer int_l, false);
maxInclusive = Some (Value.Integer int_r, false)}
int_type validate_int
let short =
restrict "short" int
{ no_facets with
minInclusive = Some (Value.Integer short_l, false);
maxInclusive = Some (Value.Integer short_r, false)}
short_type validate_short
let _ =
restrict "byte" short
{ no_facets with
minInclusive = Some (Value.Integer byte_l, false);
maxInclusive = Some (Value.Integer byte_r, false)}
byte_type validate_short
*)
let _ =
List.iter
(fun (name,min,max) ->
let ival =
match min,max with
| Some min, Some max ->
let min = Intervals.V.mk min and max = Intervals.V.mk max in
Intervals.bounded min max
| None, Some max ->
let max = Intervals.V.mk max in
Intervals.left max
| Some min, None ->
let min = Intervals.V.mk min in
Intervals.right min
| None, None ->
Intervals.any in
ignore (primitive name (Types.interval ival) (validate_interval ival name))
)
let int_type (name,min,max) =
let ival = match min,max with
| Some min, Some max ->
let min = Intervals.V.mk min and max = Intervals.V.mk max in
Intervals.bounded min max
| None, Some max ->
let max = Intervals.V.mk max in
Intervals.left max
| Some min, None ->
let min = Intervals.V.mk min in
Intervals.right min
| None, None ->
Intervals.any in
ignore (primitive name (Types.interval ival) (validate_interval ival name
let () =
List.iter int_type [
"integer", None, None;
"nonPositiveInteger", None, Some "0";
"negativeInteger", None, Some "-1";
"long", Some "-9223372036854775808", Some "9223372036854775807";
"int", Some "-2147483648", Some "2147483647";
"short", Some "-32768", Some "32767";
"byte", Some "-128", Some "127";
"nonNegativeInteger", Some "0", None;
"unsignedLong", Some "0", Some "18446744073709551615";
"unsignedInt", Some "0", Some "4294967295";
"unsignedShort", Some "0", Some "65535";
"unsignedByte", Some "0", Some "255";
"positiveInteger", Some "1", None
]
let normalized_string =
......
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