From: Tiphaine Turpin <Tiphaine.Turpin@irisa.fr>
To: dmitry grebeniuk <gdsfh1@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Batteries and portability
Date: Fri, 12 Jun 2009 15:08:47 +0200 [thread overview]
Message-ID: <4A32535F.6020109@irisa.fr> (raw)
In-Reply-To: <b364036a0906110859p656a92e3n48850d63a7593628@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 335 bytes --]
The following completed patch works for me.
Tiphaine
dmitry grebeniuk a écrit :
> If you really don't use camomile and it is not used
> in batteries indirectly, you can defer initialization.
> Apply the patch to camomile:
> http://overbld.abcname.net/files/camomile-noprecomp.html
> But the patch has a [small] runtime cost.
>
[-- Attachment #2: camomile.patch --]
[-- Type: text/plain, Size: 6210 bytes --]
diff -aur camomile.orig/camomile-0.7.1/public/caseMap.ml camomile-0.7.1/public/caseMap.ml
--- camomile.orig/camomile-0.7.1/public/caseMap.ml 2006-08-14 13:35:03.000000000 +0200
+++ camomile-0.7.1/public/caseMap.ml 2009-06-12 14:45:22.000000000 +0200
@@ -17,35 +17,35 @@
module UCharInfo = UCharInfo.Make(Config)
open UCharInfo
-let uppercase_tbl = load_property_tbl `Uppercase
+let uppercase_tbl = lazy (load_property_tbl `Uppercase)
-let is_uppercase u = UCharTbl.Bool.get uppercase_tbl u
+let is_uppercase u = UCharTbl.Bool.get (Lazy.force uppercase_tbl) u
-let lowercase_tbl = load_property_tbl `Lowercase
-let is_lowercase u = UCharTbl.Bool.get lowercase_tbl u
+let lowercase_tbl = lazy (load_property_tbl `Lowercase)
+let is_lowercase u = UCharTbl.Bool.get (Lazy.force lowercase_tbl) u
-let conditional_casing_tbl = load_conditional_casing_tbl ()
-let conditional_casing u = UCharTbl.get conditional_casing_tbl u
+let conditional_casing_tbl = lazy (load_conditional_casing_tbl ())
+let conditional_casing u = UCharTbl.get (Lazy.force conditional_casing_tbl) u
-let casefolding_tbl = load_casefolding_tbl ()
-let casefolding_char u = UCharTbl.get casefolding_tbl u
+let casefolding_tbl = lazy (load_casefolding_tbl ())
+let casefolding_char u = UCharTbl.get (Lazy.force casefolding_tbl) u
let is_null u = UChar.uint_code u = 0
-let to_lower1_tbl = load_to_lower1_tbl ()
+let to_lower1_tbl = lazy (load_to_lower1_tbl ())
let to_lower1 u =
- let u' = UCharTbl.get to_lower1_tbl u in
+ let u' = UCharTbl.get (Lazy.force to_lower1_tbl) u in
if is_null u' then u else u'
-let to_upper1_tbl = load_to_upper1_tbl ()
+let to_upper1_tbl = lazy (load_to_upper1_tbl ())
let to_upper1 u =
- let u' = UCharTbl.get to_upper1_tbl u in
+ let u' = UCharTbl.get (Lazy.force to_upper1_tbl) u in
if is_null u' then u else u'
-let to_title1_tbl = load_to_title1_tbl ()
+let to_title1_tbl = lazy (load_to_title1_tbl ())
let to_title1 u =
- let u' = UCharTbl.get to_title1_tbl u in
+ let u' = UCharTbl.get (Lazy.force to_title1_tbl) u in
if is_null u' then u else u'
let is_case_ignorable u =
@@ -92,8 +92,8 @@
in
search (Text.next t i)
- let soft_dotted_tbl = UCharInfo.load_property_tbl `Soft_Dotted
- let is_soft_dotted u = UCharTbl.Bool.get soft_dotted_tbl u
+ let soft_dotted_tbl = lazy (UCharInfo.load_property_tbl `Soft_Dotted)
+ let is_soft_dotted u = UCharTbl.Bool.get (Lazy.force soft_dotted_tbl) u
let is_after_soft_dotted t i =
let rec search i =
diff -aur camomile.orig/camomile-0.7.1/public/uCharInfo.ml camomile-0.7.1/public/uCharInfo.ml
--- camomile.orig/camomile-0.7.1/public/uCharInfo.ml 2006-08-14 13:35:03.000000000 +0200
+++ camomile-0.7.1/public/uCharInfo.ml 2009-06-11 18:46:19.000000000 +0200
@@ -251,11 +251,11 @@
(* General category *)
-let general_category_tbl : UCharTbl.Bits.t =
- read_data "general_category"
+let general_category_tbl : UCharTbl.Bits.t Lazy.t =
+ lazy (read_data "general_category")
let general_category u =
- match UCharTbl.Bits.get general_category_tbl u with
+ match UCharTbl.Bits.get (Lazy.force general_category_tbl) u with
0 ->
let n = UChar.uint_code u in
if n >= 0x0f0000 && n <= 0x100000 then `Co else
@@ -426,9 +426,9 @@
(* Scripts *)
-let script_tbl : UCharTbl.Bits.t = read_data "scripts"
+let script_tbl : UCharTbl.Bits.t Lazy.t = lazy (read_data "scripts")
-let script u = script_of_num (UCharTbl.Bits.get script_tbl u)
+let script u = script_of_num (UCharTbl.Bits.get (Lazy.force script_tbl) u)
let load_script_map () = read_data "scripts_map"
(* Casing *)
@@ -495,10 +495,10 @@
(* Combined class *)
-let combined_class_tbl : UCharTbl.Char.t =
- read_data "combined_class"
+let combined_class_tbl : UCharTbl.Char.t Lazy.t =
+ lazy (read_data "combined_class")
-let combined_class u = Char.code (UCharTbl.Char.get combined_class_tbl u)
+let combined_class u = Char.code (UCharTbl.Char.get (Lazy.force combined_class_tbl) u)
(* Decomposition *)
diff -aur camomile.orig/camomile-0.7.1/public/uCol.ml camomile-0.7.1/public/uCol.ml
--- camomile.orig/camomile-0.7.1/public/uCol.ml 2006-08-14 13:35:03.000000000 +0200
+++ camomile-0.7.1/public/uCol.ml 2009-06-12 14:47:16.000000000 +0200
@@ -58,10 +58,10 @@
open UCharInfo
let logical_order_exception_tbl =
- UCharInfo.load_property_tbl `Logical_Order_Exception
+ lazy (UCharInfo.load_property_tbl `Logical_Order_Exception)
let is_logical_order_exception u =
- UCharTbl.Bool.get logical_order_exception_tbl u
+ UCharTbl.Bool.get (Lazy.force logical_order_exception_tbl) u
let rec rearrange_aux x pos =
if pos > XString.length x - 2 then () else
@@ -97,10 +97,10 @@
loop0 0
let noncharacter_code_point_tbl =
- UCharInfo.load_property_tbl `Noncharacter_Code_Point
+ lazy (UCharInfo.load_property_tbl `Noncharacter_Code_Point)
let is_noncharacter_code_point u =
- UCharTbl.Bool.get noncharacter_code_point_tbl u
+ UCharTbl.Bool.get (Lazy.force noncharacter_code_point_tbl) u
let reverse s =
if String.length s = 0 then () else
diff -aur camomile.orig/camomile-0.7.1/public/uNF.ml camomile-0.7.1/public/uNF.ml
--- camomile.orig/camomile-0.7.1/public/uNF.ml 2006-08-14 13:35:03.000000000 +0200
+++ camomile-0.7.1/public/uNF.ml 2009-06-12 14:49:42.000000000 +0200
@@ -64,14 +64,14 @@
let null = UChar.chr_of_uint 0
-let decomposition_tbl = load_decomposition_tbl ()
-let decomposition u = UCharTbl.get decomposition_tbl u
+let decomposition_tbl = lazy (load_decomposition_tbl ())
+let decomposition u = UCharTbl.get (Lazy.force decomposition_tbl) u
-let composition_exclusion_tbl = load_composition_exclusion_tbl ()
-let composition_exclusion u = UCharTbl.Bool.get composition_exclusion_tbl u
+let composition_exclusion_tbl = lazy (load_composition_exclusion_tbl ())
+let composition_exclusion u = UCharTbl.Bool.get (Lazy.force composition_exclusion_tbl) u
-let composition_tbl = load_composition_tbl ()
-let composition u = UCharTbl.get composition_tbl u
+let composition_tbl = lazy (load_composition_tbl ())
+let composition u = UCharTbl.get (Lazy.force composition_tbl) u
let rec add_list x = function
[] -> ()
next prev parent reply other threads:[~2009-06-12 13:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-11 9:24 Tiphaine Turpin
2009-06-11 14:10 ` [Caml-list] " Edgar Friendly
2009-06-11 14:23 ` Tiphaine Turpin
2009-06-11 15:42 ` David MENTRE
2009-06-12 12:09 ` David Rajchenbach-Teller
2009-06-11 15:46 ` dmitry grebeniuk
2009-06-11 16:38 ` Tiphaine Turpin
2009-06-11 15:59 ` dmitry grebeniuk
2009-06-12 13:08 ` Tiphaine Turpin [this message]
2009-06-13 17:50 ` Peng Zang
2009-06-13 21:44 ` dmitry grebeniuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A32535F.6020109@irisa.fr \
--to=tiphaine.turpin@irisa.fr \
--cc=caml-list@yquem.inria.fr \
--cc=gdsfh1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox