Commit 05dcb273 authored by Pietro Abate's avatar Pietro Abate

[r2005-01-28 12:57:21 by afrisch] Remove dependencies from types/, misc/

Original author: afrisch
Date: 2005-01-28 12:57:22+00:00
parent 14d97b7f
......@@ -154,3 +154,4 @@ evaluator: $(EVALUATOR:.cmo=.$(EXTENSION))
# Seems to be some problems with statically linking curl
# EXTRA_OPTS_WEBIFACE = -ccopt -static
......@@ -128,6 +128,7 @@ CLEAN_DIRS = $(DIRS) cdo2cmo tools tests
# Objects to build
SCHEMA_OBJS = \
schema/schema_pcre.cmo \
schema/schema_types.cmo \
schema/schema_xml.cmo \
schema/schema_common.cmo \
......
This diff is collapsed.
......@@ -7,20 +7,11 @@ struct
let empty = ""
(* TODO: handle UTF-8 viewport *)
let to_string s =
Netconversion.recode_string
~subst:(fun i -> Printf.sprintf "\\%i;" i)
~out_enc:`Enc_iso88591
~in_enc:`Enc_utf8 s
let print ppf s =
Format.fprintf ppf "%s" (to_string s)
let start_index s = 0
let end_index s = String.length s
let equal_index = (==)
let mk s = s
let mk_latin1 s = Netconversion.recode_string ~in_enc:`Enc_iso88591 ~out_enc:`Enc_utf8 s
let mk_idx i = i
let get_str s = s
let get_idx i = i
......@@ -112,6 +103,25 @@ struct
((Char.code s.[i+3] land 0b111111)), i + 4
| _ -> failwith "Malformed UTF-8 bufffer"
(* TODO: handle UTF-8 viewport *)
let rec to_string_aux buf s i n =
if (i = n) then ()
else
let (c,i) = next s i in
if (c <= 255) then Buffer.add_char buf (Char.chr c)
else Printf.bprintf buf"\\%i;" c;
to_string_aux buf s i n
let to_string s =
let b = Buffer.create (String.length s) in
to_string_aux b s 0 (String.length s);
Buffer.contents b
let print ppf s =
Format.fprintf ppf "%s" (to_string s)
let advance s i =
match s.[i] with
| '\000'..'\127' as c -> i + 1
......@@ -156,6 +166,15 @@ struct
(* Higher code points are not possible in XML: *)
failwith "Encodings.Utf8.store"
let rec mk_latin1_aux buf s i n =
if (i = n) then ()
else (store buf (Char.code s.[i]); mk_latin1_aux buf s (succ i) n)
let mk_latin1 s =
let b = Buffer.create (String.length s) in
mk_latin1_aux b s 0 (String.length s);
Buffer.contents b
let copy b s i j =
Buffer.add_substring b s i (j - i)
......@@ -186,16 +205,4 @@ struct
let concat s1 s2 = s1 ^ s2
module Pcre =
struct
let pcre_replace ~rex ?templ s =
match templ with
| None -> mk (Pcre.replace ~rex (get_str s))
| Some templ ->
mk (Pcre.replace ~rex ~templ:(get_str templ) (get_str s))
let pcre_extract ~rex s = Array.map mk (Pcre.extract ~rex (get_str s))
let pcre_regexp s = Pcre.regexp ~flags:[`UTF8] s
let pcre_split ~rex s = List.map mk (Pcre.split ~rex (get_str s))
end
end
......@@ -32,16 +32,4 @@ sig
val serialize_sub: Serialize.Put.t -> t -> uindex -> uindex -> unit
module Pcre:
(* Wrappers for some Pcre functions working on Utf8.t values.
* Given Pcre.regexp regular expressions should be compiled with `UTF8 flag
* or with pcre_regexp below *)
sig
val pcre_regexp: string -> Pcre.regexp (* compile using `UTF8 flag *)
val pcre_replace: rex:Pcre.regexp -> ?templ:t -> t -> t
val pcre_extract: rex:Pcre.regexp -> t -> t array
val pcre_split: rex:Pcre.regexp -> t -> t list
end
end
......@@ -2,7 +2,7 @@
open Printf
open Encodings
open Encodings.Utf8.Pcre
open Schema_pcre
open Schema_common
open Schema_types
......
......@@ -2,7 +2,7 @@
open Printf
open Encodings
open Encodings.Utf8.Pcre
open Schema_pcre
open Schema_types
let no_facets = {
......
......@@ -2,7 +2,7 @@ open Printf
open Pxp_document
open Encodings
open Encodings.Utf8.Pcre
open Schema_pcre
open Schema_common
open Schema_types
open Schema_validator
......
......@@ -4,7 +4,7 @@ let debug = false
open Printf
open Encodings
open Encodings.Utf8.Pcre
open Schema_pcre
open Schema_common
open Schema_types
open Value
......
......@@ -5,7 +5,7 @@ open Pxp_tree_parser
open Pxp_types
open Encodings
open Encodings.Utf8.Pcre
open Schema_pcre
type pxp_node =
('a Pxp_document.node Pxp_document.extension as 'a) Pxp_document.node
......
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