1 |
commit: 5875c310922f8596089ad0e53b5adafc40e05d0b |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun May 1 14:03:13 2016 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 3 09:13:52 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5875c310 |
7 |
|
8 |
dev-ml/batteries: fix build with ocaml 4.03 |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org> |
12 |
|
13 |
dev-ml/batteries/batteries-2.4.0.ebuild | 5 + |
14 |
dev-ml/batteries/files/oc43-1.patch | 762 ++++++++++++++++++++++++++++++++ |
15 |
dev-ml/batteries/files/oc43-2.patch | 344 ++++++++++++++ |
16 |
dev-ml/batteries/files/oc43-3.patch | 21 + |
17 |
4 files changed, 1132 insertions(+) |
18 |
|
19 |
diff --git a/dev-ml/batteries/batteries-2.4.0.ebuild b/dev-ml/batteries/batteries-2.4.0.ebuild |
20 |
index 1548038..7ea0d79 100644 |
21 |
--- a/dev-ml/batteries/batteries-2.4.0.ebuild |
22 |
+++ b/dev-ml/batteries/batteries-2.4.0.ebuild |
23 |
@@ -22,3 +22,8 @@ DEPEND="${RDEPEND} |
24 |
DOCS=( "ChangeLog" "FAQ" "README.folders" "README.md" ) |
25 |
|
26 |
S="${WORKDIR}/${PN}-included-${PV}" |
27 |
+PATCHES=( |
28 |
+ "${FILESDIR}/oc43-1.patch" |
29 |
+ "${FILESDIR}/oc43-2.patch" |
30 |
+ "${FILESDIR}/oc43-3.patch" |
31 |
+) |
32 |
|
33 |
diff --git a/dev-ml/batteries/files/oc43-1.patch b/dev-ml/batteries/files/oc43-1.patch |
34 |
new file mode 100644 |
35 |
index 0000000..a032374 |
36 |
--- /dev/null |
37 |
+++ b/dev-ml/batteries/files/oc43-1.patch |
38 |
@@ -0,0 +1,762 @@ |
39 |
+commit 45bcb681e4218586b66f3a0d83d7f5a51f5548e0 |
40 |
+Author: KC Sivaramakrishnan <sk826@×××××××××.uk> |
41 |
+Date: Wed Mar 23 09:42:33 2016 +0000 |
42 |
+ |
43 |
+ Upgrading to 4.03 |
44 |
+ |
45 |
+diff --git a/src/batArray.mliv b/src/batArray.mliv |
46 |
+index 51b4e28..025887f 100644 |
47 |
+--- a/src/batArray.mliv |
48 |
++++ b/src/batArray.mliv |
49 |
+@@ -82,8 +82,7 @@ external make : int -> 'a -> 'a array = "caml_make_vect" |
50 |
+ If the value of [x] is a floating-point number, then the maximum |
51 |
+ size is only [Sys.max_array_length / 2].*) |
52 |
+ |
53 |
+-##V<4.2##val make_float : int -> float array |
54 |
+-##V>=4.2##external make_float : int -> float array = "caml_make_float_vect" |
55 |
++val make_float : int -> float array |
56 |
+ (** [Array.make_float n] returns a fresh float array of length [n], |
57 |
+ with uninitialized data. |
58 |
+ |
59 |
+diff --git a/src/batCharParser.mli b/src/batCharParser.mli |
60 |
+index 52c00d8..80ff8a8 100644 |
61 |
+--- a/src/batCharParser.mli |
62 |
++++ b/src/batCharParser.mli |
63 |
+@@ -52,7 +52,7 @@ val source_of_string : string -> (char, position) Source.t |
64 |
+ val source_of_enum : char BatEnum.t -> (char, position) Source.t |
65 |
+ (** Create a source from a latin-1 character.*) |
66 |
+ |
67 |
+-val parse : (char, 'a, position) t -> string -> ('a, position report) BatPervasives.result |
68 |
++val parse : (char, 'a, position) t -> string -> ('a, position report) result |
69 |
+ (**Apply a parser to a string.*) |
70 |
+ |
71 |
+ (**{6 Utilities}*) |
72 |
+diff --git a/src/batGc.mli b/src/batGc.mli |
73 |
+index f3e6f54..ecffb79 100644 |
74 |
+--- a/src/batGc.mli |
75 |
++++ b/src/batGc.mli |
76 |
+@@ -34,18 +34,18 @@ |
77 |
+ type stat = Gc.stat = |
78 |
+ { minor_words : float; |
79 |
+ (** Number of words allocated in the minor heap since |
80 |
+- the program was started. This number is accurate in |
81 |
+- byte-code programs, but only an approximation in programs |
82 |
+- compiled to native code. *) |
83 |
++ the program was started. This number is accurate in |
84 |
++ byte-code programs, but only an approximation in programs |
85 |
++ compiled to native code. *) |
86 |
+ |
87 |
+ promoted_words : float; |
88 |
+ (** Number of words allocated in the minor heap that |
89 |
+- survived a minor collection and were moved to the major heap |
90 |
+- since the program was started. *) |
91 |
++ survived a minor collection and were moved to the major heap |
92 |
++ since the program was started. *) |
93 |
+ |
94 |
+ major_words : float; |
95 |
+ (** Number of words allocated in the major heap, including |
96 |
+- the promoted words, since the program was started. *) |
97 |
++ the promoted words, since the program was started. *) |
98 |
+ |
99 |
+ minor_collections : int; |
100 |
+ (** Number of minor collections since the program was started. *) |
101 |
+@@ -62,7 +62,7 @@ type stat = Gc.stat = |
102 |
+ |
103 |
+ live_words : int; |
104 |
+ (** Number of words of live data in the major heap, including the header |
105 |
+- words. *) |
106 |
++ words. *) |
107 |
+ |
108 |
+ live_blocks : int; |
109 |
+ (** Number of live blocks in the major heap. *) |
110 |
+@@ -78,8 +78,8 @@ type stat = Gc.stat = |
111 |
+ |
112 |
+ fragments : int; |
113 |
+ (** Number of wasted words due to fragmentation. These are |
114 |
+- 1-words free blocks placed between two live blocks. They |
115 |
+- are not available for allocation. *) |
116 |
++ 1-words free blocks placed between two live blocks. They |
117 |
++ are not available for allocation. *) |
118 |
+ |
119 |
+ compactions : int; |
120 |
+ (** Number of heap compactions since the program was started. *) |
121 |
+@@ -89,62 +89,68 @@ type stat = Gc.stat = |
122 |
+ |
123 |
+ stack_size: int; |
124 |
+ (** Current size of the stack, in words. @since 3.12.0 *) |
125 |
+- } |
126 |
++} |
127 |
+ (** The memory management counters are returned in a [stat] record. |
128 |
+ |
129 |
+- The total amount of memory allocated by the program since it was started |
130 |
+- is (in words) [minor_words + major_words - promoted_words]. Multiply by |
131 |
+- the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get |
132 |
+- the number of bytes. |
133 |
++ The total amount of memory allocated by the program since it was started |
134 |
++ is (in words) [minor_words + major_words - promoted_words]. Multiply by |
135 |
++ the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get |
136 |
++ the number of bytes. |
137 |
+ *) |
138 |
+ |
139 |
+ type control = Gc.control = |
140 |
+ { mutable minor_heap_size : int; |
141 |
+ (** The size (in words) of the minor heap. Changing |
142 |
+- this parameter will trigger a minor collection. Default: 32k. *) |
143 |
++ this parameter will trigger a minor collection. Default: 256k. *) |
144 |
+ |
145 |
+ mutable major_heap_increment : int; |
146 |
+- (** The minimum number of words to add to the |
147 |
+- major heap when increasing it. Default: 124k. *) |
148 |
++ (** How much to add to the major heap when increasing it. If this |
149 |
++ number is less than or equal to 1000, it is a percentage of |
150 |
++ the current heap size (i.e. setting it to 100 will double the heap |
151 |
++ size at each increase). If it is more than 1000, it is a fixed |
152 |
++ number of words that will be added to the heap. Default: 15. *) |
153 |
+ |
154 |
+ mutable space_overhead : int; |
155 |
+ (** The major GC speed is computed from this parameter. |
156 |
+- This is the memory that will be "wasted" because the GC does not |
157 |
+- immediatly collect unreachable blocks. It is expressed as a |
158 |
+- percentage of the memory used for live data. |
159 |
+- The GC will work more (use more CPU time and collect |
160 |
+- blocks more eagerly) if [space_overhead] is smaller. |
161 |
+- Default: 80. *) |
162 |
++ This is the memory that will be "wasted" because the GC does not |
163 |
++ immediatly collect unreachable blocks. It is expressed as a |
164 |
++ percentage of the memory used for live data. |
165 |
++ The GC will work more (use more CPU time and collect |
166 |
++ blocks more eagerly) if [space_overhead] is smaller. |
167 |
++ Default: 80. *) |
168 |
+ |
169 |
+ mutable verbose : int; |
170 |
+ (** This value controls the GC messages on standard error output. |
171 |
+- It is a sum of some of the following flags, to print messages |
172 |
+- on the corresponding events: |
173 |
+- - [0x001] Start of major GC cycle. |
174 |
+- - [0x002] Minor collection and major GC slice. |
175 |
+- - [0x004] Growing and shrinking of the heap. |
176 |
+- - [0x008] Resizing of stacks and memory manager tables. |
177 |
+- - [0x010] Heap compaction. |
178 |
+- - [0x020] Change of GC parameters. |
179 |
+- - [0x040] Computation of major GC slice size. |
180 |
+- - [0x080] Calling of finalisation functions. |
181 |
+- - [0x100] Bytecode executable search at start-up. |
182 |
+- - [0x200] Computation of compaction triggering condition. |
183 |
+- Default: 0. *) |
184 |
++ It is a sum of some of the following flags, to print messages |
185 |
++ on the corresponding events: |
186 |
++ - [0x001] Start of major GC cycle. |
187 |
++ - [0x002] Minor collection and major GC slice. |
188 |
++ - [0x004] Growing and shrinking of the heap. |
189 |
++ - [0x008] Resizing of stacks and memory manager tables. |
190 |
++ - [0x010] Heap compaction. |
191 |
++ - [0x020] Change of GC parameters. |
192 |
++ - [0x040] Computation of major GC slice size. |
193 |
++ - [0x080] Calling of finalisation functions. |
194 |
++ - [0x100] Bytecode executable and shared library search at start-up. |
195 |
++ - [0x200] Computation of compaction-triggering condition. |
196 |
++ - [0x400] Output GC statistics at program exit. |
197 |
++ Default: 0. *) |
198 |
+ |
199 |
+ mutable max_overhead : int; |
200 |
+ (** Heap compaction is triggered when the estimated amount |
201 |
+- of "wasted" memory is more than [max_overhead] percent of the |
202 |
+- amount of live data. If [max_overhead] is set to 0, heap |
203 |
+- compaction is triggered at the end of each major GC cycle |
204 |
+- (this setting is intended for testing purposes only). |
205 |
+- If [max_overhead >= 1000000], compaction is never triggered. |
206 |
+- Default: 500. *) |
207 |
++ of "wasted" memory is more than [max_overhead] percent of the |
208 |
++ amount of live data. If [max_overhead] is set to 0, heap |
209 |
++ compaction is triggered at the end of each major GC cycle |
210 |
++ (this setting is intended for testing purposes only). |
211 |
++ If [max_overhead >= 1000000], compaction is never triggered. |
212 |
++ If compaction is permanently disabled, it is strongly suggested |
213 |
++ to set [allocation_policy] to 1. |
214 |
++ Default: 500. *) |
215 |
+ |
216 |
+ mutable stack_limit : int; |
217 |
+ (** The maximum size of the stack (in words). This is only |
218 |
+- relevant to the byte-code runtime, as the native code runtime |
219 |
+- uses the operating system's stack. Default: 256k. *) |
220 |
++ relevant to the byte-code runtime, as the native code runtime |
221 |
++ uses the operating system's stack. Default: 1024k. *) |
222 |
+ |
223 |
+ mutable allocation_policy : int; |
224 |
+ (** The policy used for allocating in the heap. Possible |
225 |
+@@ -153,16 +159,22 @@ type control = Gc.control = |
226 |
+ first-fit policy, which can be slower in some cases but |
227 |
+ can be better for programs with fragmentation problems. |
228 |
+ Default: 0. @since 3.11.0 *) |
229 |
+- } |
230 |
++ |
231 |
++ window_size : int; |
232 |
++ (** The size of the window used by the major GC for smoothing |
233 |
++ out variations in its workload. This is an integer between |
234 |
++ 1 and 50. |
235 |
++ Default: 1. @since 4.03.0 *) |
236 |
++} |
237 |
+ (** The GC parameters are given as a [control] record. Note that |
238 |
+ these parameters can also be initialised by setting the |
239 |
+ OCAMLRUNPARAM environment variable. See the documentation of |
240 |
+- ocamlrun. *) |
241 |
++ [ocamlrun]. *) |
242 |
+ |
243 |
+ external stat : unit -> stat = "caml_gc_stat" |
244 |
+ (** Return the current values of the memory management counters in a |
245 |
+- [stat] record. This function examines every heap block to get the |
246 |
+- statistics. *) |
247 |
++ [stat] record. This function examines every heap block to get the |
248 |
++ statistics. *) |
249 |
+ |
250 |
+ external quick_stat : unit -> stat = "caml_gc_quick_stat" |
251 |
+ (** Same as [stat] except that [live_words], [live_blocks], [free_words], |
252 |
+@@ -172,117 +184,144 @@ external quick_stat : unit -> stat = "caml_gc_quick_stat" |
253 |
+ |
254 |
+ external counters : unit -> float * float * float = "caml_gc_counters" |
255 |
+ (** Return [(minor_words, promoted_words, major_words)]. This function |
256 |
+- is as fast at [quick_stat]. *) |
257 |
++ is as fast as [quick_stat]. *) |
258 |
+ |
259 |
+ external get : unit -> control = "caml_gc_get" |
260 |
+ (** Return the current values of the GC parameters in a [control] record. *) |
261 |
+ |
262 |
+ external set : control -> unit = "caml_gc_set" |
263 |
+ (** [set r] changes the GC parameters according to the [control] record [r]. |
264 |
+- The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }] *) |
265 |
++ The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }] *) |
266 |
+ |
267 |
+ external minor : unit -> unit = "caml_gc_minor" |
268 |
+ (** Trigger a minor collection. *) |
269 |
+ |
270 |
+-external major_slice : int -> int = "caml_gc_major_slice";; |
271 |
+-(** Do a minor collection and a slice of major collection. The argument |
272 |
+- is the size of the slice, 0 to use the automatically-computed |
273 |
+- slice size. In all cases, the result is the computed slice size. *) |
274 |
++external major_slice : int -> int = "caml_gc_major_slice" |
275 |
++(** [major_slice n] |
276 |
++ Do a minor collection and a slice of major collection. [n] is the |
277 |
++ size of the slice: the GC will do enough work to free (on average) |
278 |
++ [n] words of memory. If [n] = 0, the GC will try to do enough work |
279 |
++ to ensure that the next slice has no work to do. |
280 |
++ Return an approximation of the work that the next slice will have |
281 |
++ to do. *) |
282 |
+ |
283 |
+ external major : unit -> unit = "caml_gc_major" |
284 |
+ (** Do a minor collection and finish the current major collection cycle. *) |
285 |
+ |
286 |
+ external full_major : unit -> unit = "caml_gc_full_major" |
287 |
+ (** Do a minor collection, finish the current major collection cycle, |
288 |
+- and perform a complete new cycle. This will collect all currently |
289 |
+- unreachable blocks. *) |
290 |
++ and perform a complete new cycle. This will collect all currently |
291 |
++ unreachable blocks. *) |
292 |
+ |
293 |
+ external compact : unit -> unit = "caml_gc_compaction" |
294 |
+ (** Perform a full major collection and compact the heap. Note that heap |
295 |
+- compaction is a lengthy operation. *) |
296 |
++ compaction is a lengthy operation. *) |
297 |
+ |
298 |
+ val print_stat : _ BatInnerIO.output -> unit |
299 |
+ (** Print the current values of the memory management counters (in |
300 |
+- human-readable form) into the channel argument. *) |
301 |
++ human-readable form) into the channel argument. *) |
302 |
+ |
303 |
+ val allocated_bytes : unit -> float |
304 |
+ (** Return the total number of bytes allocated since the program was |
305 |
+- started. It is returned as a [float] to avoid overflow problems |
306 |
+- with [int] on 32-bit machines. *) |
307 |
++ started. It is returned as a [float] to avoid overflow problems |
308 |
++ with [int] on 32-bit machines. *) |
309 |
++ |
310 |
++external get_minor_free : unit -> int = "caml_get_minor_free" [@@noalloc] |
311 |
++(** Return the current size of the free space inside the minor heap. *) |
312 |
++ |
313 |
++external get_bucket : int -> int = "caml_get_major_bucket" [@@noalloc] |
314 |
++(** [get_bucket n] returns the current size of the [n]-th future bucket |
315 |
++ of the GC smoothing system. The unit is one millionth of a full GC. |
316 |
++ Raise [Invalid_argument] if [n] is negative, return 0 if n is larger |
317 |
++ than the smoothing window. *) |
318 |
++ |
319 |
++external get_credit : unit -> int = "caml_get_major_credit" [@@noalloc] |
320 |
++(** [get_credit ()] returns the current size of the "work done in advance" |
321 |
++ counter of the GC smoothing system. The unit is one millionth of a |
322 |
++ full GC. *) |
323 |
++ |
324 |
++external huge_fallback_count : unit -> int = "caml_gc_huge_fallback_count" |
325 |
++(** Return the number of times we tried to map huge pages and had to fall |
326 |
++ back to small pages. This is always 0 if [OCAMLRUNPARAM] contains [H=1]. |
327 |
++ @since 4.03.0 *) |
328 |
+ |
329 |
+ val finalise : ('a -> unit) -> 'a -> unit |
330 |
+ (** [finalise f v] registers [f] as a finalisation function for [v]. |
331 |
+- [v] must be heap-allocated. [f] will be called with [v] as |
332 |
+- argument at some point between the first time [v] becomes unreachable |
333 |
+- and the time [v] is collected by the GC. Several functions can |
334 |
+- be registered for the same value, or even several instances of the |
335 |
+- same function. Each instance will be called once (or never, |
336 |
+- if the program terminates before [v] becomes unreachable). |
337 |
+- |
338 |
+- The GC will call the finalisation functions in the order of |
339 |
+- deallocation. When several values become unreachable at the |
340 |
+- same time (i.e. during the same GC cycle), the finalisation |
341 |
+- functions will be called in the reverse order of the corresponding |
342 |
+- calls to [finalise]. If [finalise] is called in the same order |
343 |
+- as the values are allocated, that means each value is finalised |
344 |
+- before the values it depends upon. Of course, this becomes |
345 |
+- false if additional dependencies are introduced by assignments. |
346 |
+- |
347 |
+- Anything reachable from the closure of finalisation functions |
348 |
+- is considered reachable, so the following code will not work |
349 |
+- as expected: |
350 |
+- - [ let v = ... in Gc.finalise (fun x -> ...) v ] |
351 |
+- |
352 |
+- Instead you should write: |
353 |
+- - [ let f = fun x -> ... ;; let v = ... in Gc.finalise f v ] |
354 |
+- |
355 |
+- |
356 |
+- The [f] function can use all features of OCaml, including |
357 |
+- assignments that make the value reachable again. It can also |
358 |
+- loop forever (in this case, the other |
359 |
+- finalisation functions will not be called during the execution of f, |
360 |
+- unless it calls [finalise_release]). |
361 |
+- It can call [finalise] on [v] or other values to register other |
362 |
+- functions or even itself. It can raise an exception; in this case |
363 |
+- the exception will interrupt whatever the program was doing when |
364 |
+- the function was called. |
365 |
+- |
366 |
+- |
367 |
+- [finalise] will raise [Invalid_argument] if [v] is not |
368 |
+- heap-allocated. Some examples of values that are not |
369 |
+- heap-allocated are integers, constant constructors, booleans, |
370 |
+- the empty array, the empty list, the unit value. The exact list |
371 |
+- of what is heap-allocated or not is implementation-dependent. |
372 |
+- Some constant values can be heap-allocated but never deallocated |
373 |
+- during the lifetime of the program, for example a list of integer |
374 |
+- constants; this is also implementation-dependent. |
375 |
+- You should also be aware that compiler optimisations may duplicate |
376 |
+- some immutable values, for example floating-point numbers when |
377 |
+- stored into arrays, so they can be finalised and collected while |
378 |
+- another copy is still in use by the program. |
379 |
+- |
380 |
+- |
381 |
+- The results of calling {!String.make}, {!String.create}, |
382 |
+- {!Array.make}, and {!Pervasives.ref} are guaranteed to be |
383 |
+- heap-allocated and non-constant except when the length argument is [0]. |
384 |
++ [v] must be heap-allocated. [f] will be called with [v] as |
385 |
++ argument at some point between the first time [v] becomes unreachable |
386 |
++ (including through weak pointers) and the time [v] is collected by |
387 |
++ the GC. Several functions can |
388 |
++ be registered for the same value, or even several instances of the |
389 |
++ same function. Each instance will be called once (or never, |
390 |
++ if the program terminates before [v] becomes unreachable). |
391 |
++ |
392 |
++ The GC will call the finalisation functions in the order of |
393 |
++ deallocation. When several values become unreachable at the |
394 |
++ same time (i.e. during the same GC cycle), the finalisation |
395 |
++ functions will be called in the reverse order of the corresponding |
396 |
++ calls to [finalise]. If [finalise] is called in the same order |
397 |
++ as the values are allocated, that means each value is finalised |
398 |
++ before the values it depends upon. Of course, this becomes |
399 |
++ false if additional dependencies are introduced by assignments. |
400 |
++ |
401 |
++ In the presence of multiple OCaml threads it should be assumed that |
402 |
++ any particular finaliser may be executed in any of the threads. |
403 |
++ |
404 |
++ Anything reachable from the closure of finalisation functions |
405 |
++ is considered reachable, so the following code will not work |
406 |
++ as expected: |
407 |
++ - [ let v = ... in Gc.finalise (fun _ -> ...v...) v ] |
408 |
++ |
409 |
++ Instead you should make sure that [v] is not in the closure of |
410 |
++ the finalisation function by writing: |
411 |
++ - [ let f = fun x -> ... ;; let v = ... in Gc.finalise f v ] |
412 |
++ |
413 |
++ |
414 |
++ The [f] function can use all features of OCaml, including |
415 |
++ assignments that make the value reachable again. It can also |
416 |
++ loop forever (in this case, the other |
417 |
++ finalisation functions will not be called during the execution of f, |
418 |
++ unless it calls [finalise_release]). |
419 |
++ It can call [finalise] on [v] or other values to register other |
420 |
++ functions or even itself. It can raise an exception; in this case |
421 |
++ the exception will interrupt whatever the program was doing when |
422 |
++ the function was called. |
423 |
++ |
424 |
++ |
425 |
++ [finalise] will raise [Invalid_argument] if [v] is not |
426 |
++ guaranteed to be heap-allocated. Some examples of values that are not |
427 |
++ heap-allocated are integers, constant constructors, booleans, |
428 |
++ the empty array, the empty list, the unit value. The exact list |
429 |
++ of what is heap-allocated or not is implementation-dependent. |
430 |
++ Some constant values can be heap-allocated but never deallocated |
431 |
++ during the lifetime of the program, for example a list of integer |
432 |
++ constants; this is also implementation-dependent. |
433 |
++ Note that values of types [float] and ['a lazy] (for any ['a]) are |
434 |
++ sometimes allocated and sometimes not, so finalising them is unsafe, |
435 |
++ and [finalise] will also raise [Invalid_argument] for them. |
436 |
++ |
437 |
++ |
438 |
++ The results of calling {!String.make}, {!Bytes.make}, {!Bytes.create}, |
439 |
++ {!Array.make}, and {!Pervasives.ref} are guaranteed to be |
440 |
++ heap-allocated and non-constant except when the length argument is [0]. |
441 |
+ *) |
442 |
+ |
443 |
+-val finalise_release : unit -> unit;; |
444 |
++val finalise_release : unit -> unit |
445 |
+ (** A finalisation function may call [finalise_release] to tell the |
446 |
+ GC that it can launch the next finalisation function without waiting |
447 |
+ for the current one to return. *) |
448 |
+ |
449 |
+ type alarm = Gc.alarm |
450 |
+ (** An alarm is a piece of data that calls a user function at the end of |
451 |
+- each major GC cycle. The following functions are provided to create |
452 |
+- and delete alarms. *) |
453 |
++ each major GC cycle. The following functions are provided to create |
454 |
++ and delete alarms. *) |
455 |
+ |
456 |
+ val create_alarm : (unit -> unit) -> alarm |
457 |
+ (** [create_alarm f] will arrange for [f] to be called at the end of each |
458 |
+- major GC cycle, starting with the current cycle or the next one. |
459 |
+- A value of type [alarm] is returned that you can |
460 |
+- use to call [delete_alarm]. *) |
461 |
++ major GC cycle, starting with the current cycle or the next one. |
462 |
++ A value of type [alarm] is returned that you can |
463 |
++ use to call [delete_alarm]. *) |
464 |
+ |
465 |
+ val delete_alarm : alarm -> unit |
466 |
+- (** [delete_alarm a] will stop the calls to the function associated |
467 |
+- to [a]. Calling [delete_alarm a] again has no effect. *) |
468 |
++(** [delete_alarm a] will stop the calls to the function associated |
469 |
++ to [a]. Calling [delete_alarm a] again has no effect. *) |
470 |
+diff --git a/src/batHashtbl.mli b/src/batHashtbl.mli |
471 |
+index d3a9118..dd95c0c 100644 |
472 |
+--- a/src/batHashtbl.mli |
473 |
++++ b/src/batHashtbl.mli |
474 |
+@@ -276,7 +276,7 @@ val print : ?first:string -> ?last:string -> ?sep:string -> ?kvsep:string -> |
475 |
+ module Exceptionless : |
476 |
+ sig |
477 |
+ val find : ('a, 'b) t -> 'a -> 'b option |
478 |
+- val modify : 'a -> ('b -> 'b) -> ('a, 'b) t -> (unit, exn) BatPervasives.result |
479 |
++ val modify : 'a -> ('b -> 'b) -> ('a, 'b) t -> (unit, exn) result |
480 |
+ end |
481 |
+ |
482 |
+ (** Infix operators over a {!BatHashtbl} *) |
483 |
+@@ -402,7 +402,7 @@ sig |
484 |
+ module Exceptionless : |
485 |
+ sig |
486 |
+ val find : 'a t -> key -> 'a option |
487 |
+- val modify : key -> ('a -> 'a) -> 'a t -> (unit, exn) BatPervasives.result |
488 |
++ val modify : key -> ('a -> 'a) -> 'a t -> (unit, exn) result |
489 |
+ end |
490 |
+ |
491 |
+ (** Infix operators over a {!BatHashtbl} *) |
492 |
+@@ -562,7 +562,7 @@ sig |
493 |
+ module Exceptionless : |
494 |
+ sig |
495 |
+ val find : ('a, 'b, [>`Read]) t -> 'a -> 'b option |
496 |
+- val modify : 'a -> ('b -> 'b) -> ('a, 'b, [>`Read]) t -> (unit, exn) BatPervasives.result |
497 |
++ val modify : 'a -> ('b -> 'b) -> ('a, 'b, [>`Read]) t -> (unit, exn) result |
498 |
+ end |
499 |
+ |
500 |
+ (** Operations on {!BatHashtbl.Cap} with labels.*) |
501 |
+diff --git a/src/batHashtbl.mlv b/src/batHashtbl.mlv |
502 |
+index 6a79a33..ef7a030 100644 |
503 |
+--- a/src/batHashtbl.mlv |
504 |
++++ b/src/batHashtbl.mlv |
505 |
+@@ -413,7 +413,7 @@ sig |
506 |
+ module Exceptionless : |
507 |
+ sig |
508 |
+ val find : 'a t -> key -> 'a option |
509 |
+- val modify : key -> ('a -> 'a) -> 'a t -> (unit, exn) BatPervasives.result |
510 |
++ val modify : key -> ('a -> 'a) -> 'a t -> (unit, exn) result |
511 |
+ end |
512 |
+ |
513 |
+ (** Infix operators over a {!BatHashtbl} *) |
514 |
+@@ -571,7 +571,7 @@ struct |
515 |
+ let map_inplace (f:key -> 'a -> 'b) h = map_inplace f (to_hash h) |
516 |
+ let filteri_inplace f h = filteri_inplace f (to_hash h) |
517 |
+ let filter_inplace f h = filter_inplace f (to_hash h) |
518 |
+- let filter_map_inplace f h = filter_map_inplace f (to_hash h) |
519 |
++ let filter_map_inplace f h = filter_map_inplace f h |
520 |
+ |
521 |
+ |
522 |
+ let find_option h key = |
523 |
+diff --git a/src/batInnerPervasives.mlv b/src/batInnerPervasives.mlv |
524 |
+index c86f1f7..c81cba4 100644 |
525 |
+--- a/src/batInnerPervasives.mlv |
526 |
++++ b/src/batInnerPervasives.mlv |
527 |
+@@ -43,20 +43,16 @@ let unique () = |
528 |
+ Q.unit (fun () -> unique () <> unique ()) |
529 |
+ *) |
530 |
+ |
531 |
+-type ('a, 'b) result = |
532 |
+- | Ok of 'a |
533 |
+- | Bad of 'b |
534 |
+- |
535 |
+ (* Ideas taken from Nicholas Pouillard's my_std.ml in ocamlbuild/ *) |
536 |
+ let ignore_ok = function |
537 |
+ Ok _ -> () |
538 |
+- | Bad ex -> raise ex |
539 |
++ | Error ex -> raise ex |
540 |
+ |
541 |
+ let ok = function |
542 |
+ Ok v -> v |
543 |
+- | Bad ex -> raise ex |
544 |
++ | Error ex -> raise ex |
545 |
+ |
546 |
+-let wrap f x = try Ok (f x) with ex -> Bad ex |
547 |
++let wrap f x = try Ok (f x) with ex -> Error ex |
548 |
+ |
549 |
+ let forever f x = ignore (while true do f x done) |
550 |
+ |
551 |
+diff --git a/src/batInnerWeaktbl.ml b/src/batInnerWeaktbl.ml |
552 |
+index 64bb15f..c525f62 100644 |
553 |
+--- a/src/batInnerWeaktbl.ml |
554 |
++++ b/src/batInnerWeaktbl.ml |
555 |
+@@ -120,6 +120,7 @@ module Make (H: Hashtbl.HashedType) : Hashtbl.S with type key = H.t = struct |
556 |
+ W.iter (fun cls -> W.add tbl' (Stack.copy cls)) tbl; tbl' |
557 |
+ let stats _ = assert false |
558 |
+ let reset _ = assert false |
559 |
++ let filter_map_inplace _ = assert false |
560 |
+ end |
561 |
+ |
562 |
+ module StdHash = Make |
563 |
+diff --git a/src/batParserCo.ml b/src/batParserCo.ml |
564 |
+index cac4701..75ac6fb 100644 |
565 |
+--- a/src/batParserCo.ml |
566 |
++++ b/src/batParserCo.ml |
567 |
+@@ -274,10 +274,10 @@ let lookahead p e = match apply p e with |
568 |
+ | Failure _ as result -> result |
569 |
+ |
570 |
+ let interpret_result = function |
571 |
+- | Setback f | Failure f -> BatInnerPervasives.Bad f |
572 |
+- | Success (r, _) | Backtrack (r, _, _) -> BatInnerPervasives.Ok r |
573 |
++ | Setback f | Failure f -> Error f |
574 |
++ | Success (r, _) | Backtrack (r, _, _) -> Ok r |
575 |
+ |
576 |
+-let suspend : ('a, 'b, 'c) t -> ('a, (unit -> ('b, 'c report) BatInnerPervasives.result), 'c) t = fun s e -> |
577 |
++let suspend : ('a, 'b, 'c) t -> ('a, (unit -> ('b, 'c report) Pervasives.result), 'c) t = fun s e -> |
578 |
+ let resume () = interpret_result (s e) in |
579 |
+ Success (resume, e) |
580 |
+ |
581 |
+diff --git a/src/batParserCo.mli b/src/batParserCo.mli |
582 |
+index 1fbe15a..40c5cf7 100644 |
583 |
+--- a/src/batParserCo.mli |
584 |
++++ b/src/batParserCo.mli |
585 |
+@@ -141,15 +141,15 @@ val filter: ('b -> bool) -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t |
586 |
+ (**[filter f p] is only accepts values [x] such that [p] |
587 |
+ accepts [x] and [f (p x)] is [true]*) |
588 |
+ |
589 |
+-val suspend : ('a, 'b, 'c) t -> ('a, (unit -> ('b, 'c report) BatPervasives.result), 'c) t |
590 |
++val suspend : ('a, 'b, 'c) t -> ('a, (unit -> ('b, 'c report) result), 'c) t |
591 |
+ (**[suspend s] returns the state of the parser in a form that can be |
592 |
+ resumed by calling the returned function. evaluation will resume |
593 |
+ from parser s *) |
594 |
+ |
595 |
+-val run: ('a, 'b, 'c) t -> ('a, 'c) Source.t -> ('b, 'c report) BatPervasives.result |
596 |
++val run: ('a, 'b, 'c) t -> ('a, 'c) Source.t -> ('b, 'c report) result |
597 |
+ (**[run p s] executes parser [p] on source [s]. In case of |
598 |
+ success, returns [Ok v], where [v] is the return value of [p]. |
599 |
+- In case of failure, returns [Bad f], with [f] containing |
600 |
++ In case of failure, returns [Error f], with [f] containing |
601 |
+ details on the parsing error.*) |
602 |
+ |
603 |
+ |
604 |
+diff --git a/src/batPathGen.ml b/src/batPathGen.ml |
605 |
+index 46a97ba..71d1084 100644 |
606 |
+--- a/src/batPathGen.ml |
607 |
++++ b/src/batPathGen.ml |
608 |
+@@ -512,7 +512,7 @@ module Make = functor (S : StringType) -> struct |
609 |
+ let full_match pars ss = |
610 |
+ let parser_final = BatParserCo.( >>> ) pars BatParserCo.eof in |
611 |
+ match BatParserCo.run parser_final (S.Parse.source ss) with |
612 |
+- | BatPervasives.Ok _ -> true |
613 |
++ | Ok _ -> true |
614 |
+ | _ -> false |
615 |
+ |
616 |
+ (* let full_match_none_of raw_excluded ss = |
617 |
+diff --git a/src/batPervasives.mliv b/src/batPervasives.mliv |
618 |
+index 6353214..c74b913 100644 |
619 |
+--- a/src/batPervasives.mliv |
620 |
++++ b/src/batPervasives.mliv |
621 |
+@@ -842,20 +842,14 @@ val print : ?first:string -> ?last:string -> ?sep:string -> ('a BatInnerIO.outp |
622 |
+ |
623 |
+ For more functions related to this type, see the {!BatResult} module. |
624 |
+ *) |
625 |
+-type ('a, 'b) result = ('a, 'b) BatInnerPervasives.result = |
626 |
+- | Ok of 'a |
627 |
+- | Bad of 'b |
628 |
+- (** The result of a computation - either an [Ok] with the normal |
629 |
+- result or a [Bad] with some value (often an exception) containing |
630 |
+- failure information*) |
631 |
+ |
632 |
+ val ignore_ok : ('a, exn) result -> unit |
633 |
+ (** [ignore_ok (f x)] ignores the result of [f x] if it's ok, but |
634 |
+- throws the exception contained if [Bad] is returned. *) |
635 |
++ throws the exception contained if [Error] is returned. *) |
636 |
+ |
637 |
+ val ok : ('a, exn) result -> 'a |
638 |
+ (** [f x |> ok] unwraps the [Ok] result of [f x] and returns it, or |
639 |
+- throws the exception contained if [Bad] is returned. *) |
640 |
++ throws the exception contained if [Error] is returned. *) |
641 |
+ |
642 |
+ val wrap : ('a -> 'b) -> 'a -> ('b, exn) result |
643 |
+ (** [wrap f x] wraps a function that would normally throw an exception |
644 |
+diff --git a/src/batResult.ml b/src/batResult.ml |
645 |
+index 1d98663..f90b4d9 100644 |
646 |
+--- a/src/batResult.ml |
647 |
++++ b/src/batResult.ml |
648 |
+@@ -1,45 +1,45 @@ |
649 |
+ |
650 |
+-type ('a, 'b) t = ('a, 'b) BatPervasives.result = |
651 |
++type ('a, 'b) t = ('a, 'b) result = |
652 |
+ | Ok of 'a |
653 |
+- | Bad of 'b |
654 |
++ | Error of 'b |
655 |
+ |
656 |
+-let catch f x = try Ok (f x) with e -> Bad e |
657 |
+-let catch2 f x y = try Ok (f x y) with e -> Bad e |
658 |
+-let catch3 f x y z = try Ok (f x y z) with e -> Bad e |
659 |
++let catch f x = try Ok (f x) with e -> Error e |
660 |
++let catch2 f x y = try Ok (f x y) with e -> Error e |
661 |
++let catch3 f x y z = try Ok (f x y z) with e -> Error e |
662 |
+ |
663 |
+ let of_option = function |
664 |
+ | Some x -> Ok x |
665 |
+- | None -> Bad () |
666 |
++ | None -> Error () |
667 |
+ |
668 |
+ let to_option = function |
669 |
+ | Ok x -> Some x |
670 |
+- | Bad _-> None |
671 |
++ | Error _-> None |
672 |
+ |
673 |
+ let default def = function |
674 |
+ | Ok x -> x |
675 |
+- | Bad _ -> def |
676 |
++ | Error _ -> def |
677 |
+ |
678 |
+ let map_default def f = function |
679 |
+ | Ok x -> f x |
680 |
+- | Bad _ -> def |
681 |
++ | Error _ -> def |
682 |
+ |
683 |
+-let is_ok = function Ok _ -> true | Bad _ -> false |
684 |
++let is_ok = function Ok _ -> true | Error _ -> false |
685 |
+ |
686 |
+-let is_bad = function Bad _ -> true | Ok _ -> false |
687 |
++let is_bad = function Error _ -> true | Ok _ -> false |
688 |
+ |
689 |
+-let is_exn e = function Bad exn -> exn = e | Ok _ -> false |
690 |
++let is_exn e = function Error exn -> exn = e | Ok _ -> false |
691 |
+ |
692 |
+-let get = function Ok x -> x | Bad e -> raise e |
693 |
++let get = function Ok x -> x | Error e -> raise e |
694 |
+ |
695 |
+ let print print_val oc = function |
696 |
+ | Ok x -> BatPrintf.fprintf oc "Ok(%a)" print_val x |
697 |
+- | Bad e -> BatPrintf.fprintf oc "Bad(%a)" BatPrintexc.print e |
698 |
++ | Error e -> BatPrintf.fprintf oc "Error(%a)" BatPrintexc.print e |
699 |
+ |
700 |
+ |
701 |
+ module Monad = struct |
702 |
+ let bind m k = match m with |
703 |
+ | Ok x -> k x |
704 |
+- | Bad _ as e -> e |
705 |
++ | Error _ as e -> e |
706 |
+ |
707 |
+ let return x = Ok x |
708 |
+ |
709 |
+diff --git a/src/batResult.mli b/src/batResult.mli |
710 |
+index a295c64..203c125 100644 |
711 |
+--- a/src/batResult.mli |
712 |
++++ b/src/batResult.mli |
713 |
+@@ -1,12 +1,12 @@ |
714 |
+ (** Monadic results of computations that can raise exceptions *) |
715 |
+ |
716 |
+ (** The type of a result. A result is either [Ok x] carrying the |
717 |
+- normal return value [x] or is [Bad e] carrying some indication of an |
718 |
++ normal return value [x] or is [Error e] carrying some indication of an |
719 |
+ error. The value associated with a bad result is usually an exception |
720 |
+ ([exn]) that can be raised. |
721 |
+ @since 1.0 |
722 |
+ *) |
723 |
+-type ('a, 'b) t = ('a, 'b) BatPervasives.result = Ok of 'a | Bad of 'b |
724 |
++type ('a, 'b) t = ('a, 'b) result = Ok of 'a | Error of 'b |
725 |
+ |
726 |
+ (** Execute a function and catch any exception as a result. This |
727 |
+ function encapsulates code that could throw an exception and returns |
728 |
+@@ -26,19 +26,19 @@ val catch2: ('a -> 'b -> 'c) -> 'a -> 'b -> ('c, exn) t |
729 |
+ val catch3: ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> ('d, exn) t |
730 |
+ |
731 |
+ |
732 |
+-(** [get (Ok x)] returns [x], and [get (Bad e)] raises [e]. This |
733 |
++(** [get (Ok x)] returns [x], and [get (Error e)] raises [e]. This |
734 |
+ function is, in a way, the opposite of the [catch] function |
735 |
+ @since 2.0 |
736 |
+ *) |
737 |
+ val get : ('a, exn) t -> 'a |
738 |
+ |
739 |
+-(** [default d r] evaluates to [d] if [r] is [Bad] else [x] when [r] is |
740 |
++(** [default d r] evaluates to [d] if [r] is [Error] else [x] when [r] is |
741 |
+ [Ok x] |
742 |
+ @since 2.0 |
743 |
+ *) |
744 |
+ val default: 'a -> ('a, _) t -> 'a |
745 |
+ |
746 |
+-(** [map_default d f r] evaluates to [d] if [r] is [Bad] else [f x] |
747 |
++(** [map_default d f r] evaluates to [d] if [r] is [Error] else [f x] |
748 |
+ when [r] is [Ok x] |
749 |
+ @since 2.0 |
750 |
+ *) |
751 |
+@@ -49,12 +49,12 @@ val map_default : 'b -> ('a -> 'b) -> ('a, _) t -> 'b |
752 |
+ *) |
753 |
+ val is_ok : ('a, 'b) t -> bool |
754 |
+ |
755 |
+-(** [is_bad (Bad _)] is [true], otherwise [false] |
756 |
++(** [is_bad (Error _)] is [true], otherwise [false] |
757 |
+ @since 2.0 |
758 |
+ *) |
759 |
+ val is_bad : ('a, 'b) t -> bool |
760 |
+ |
761 |
+-(** [is_exn e1 r] is [true] iff [r] is [Bad e2] with [e1=e2] *) |
762 |
++(** [is_exn e1 r] is [true] iff [r] is [Error e2] with [e1=e2] *) |
763 |
+ val is_exn : exn -> ('a, exn) t -> bool |
764 |
+ |
765 |
+ (** Convert an [option] to a [result] |
766 |
+@@ -96,5 +96,5 @@ module Infix : sig |
767 |
+ val ( >>= ): ('a, 'b) t -> ('a -> ('c, 'b) t) -> ('c, 'b) t |
768 |
+ end |
769 |
+ |
770 |
+-(** Print a result as Ok(x) or Bad(exn) *) |
771 |
++(** Print a result as Ok(x) or Error(exn) *) |
772 |
+ val print : ('b BatInnerIO.output -> 'a -> unit) -> 'b BatInnerIO.output -> ('a, exn) t -> unit |
773 |
+diff --git a/src/batSys.mliv b/src/batSys.mliv |
774 |
+index 510a661..add0b33 100644 |
775 |
+--- a/src/batSys.mliv |
776 |
++++ b/src/batSys.mliv |
777 |
+@@ -65,7 +65,8 @@ external getenv : string -> string = "caml_sys_getenv" |
778 |
+ external command : string -> int = "caml_sys_system_command" |
779 |
+ (** Execute the given shell command and return its exit code. *) |
780 |
+ |
781 |
+-external time : unit -> float = "caml_sys_time" |
782 |
++##V<4.3## external time : unit -> float = "caml_sys_time" |
783 |
++##V>=4.3## external time : unit -> (float [@unboxed]) = "caml_sys_time" "caml_sys_time_unboxed" [@@noalloc] |
784 |
+ (** Return the processor time, in seconds, used by the program |
785 |
+ since the beginning of execution. *) |
786 |
+ |
787 |
+diff --git a/src/batUnix.mliv b/src/batUnix.mliv |
788 |
+index 60a6ec4..069d63a 100644 |
789 |
+--- a/src/batUnix.mliv |
790 |
++++ b/src/batUnix.mliv |
791 |
+@@ -766,7 +766,8 @@ val create_process_env : |
792 |
+ (** {6 Symbolic links} *) |
793 |
+ |
794 |
+ |
795 |
+-val symlink : string -> string -> unit |
796 |
++##V>=4.3##val symlink : ?to_dir:bool -> string -> string -> unit |
797 |
++##V<4.3##val symlink : string -> string -> unit |
798 |
+ (** [symlink source dest] creates the file [dest] as a symbolic link |
799 |
+ to the file [source]. *) |
800 |
+ |
801 |
|
802 |
diff --git a/dev-ml/batteries/files/oc43-2.patch b/dev-ml/batteries/files/oc43-2.patch |
803 |
new file mode 100644 |
804 |
index 0000000..36d8e41 |
805 |
--- /dev/null |
806 |
+++ b/dev-ml/batteries/files/oc43-2.patch |
807 |
@@ -0,0 +1,344 @@ |
808 |
+commit 905cbb6a3ebf1edc11745737feeedd36708149a7 |
809 |
+Author: KC Sivaramakrishnan <sk826@×××××××××.uk> |
810 |
+Date: Wed Mar 23 10:11:46 2016 +0000 |
811 |
+ |
812 |
+ Spacing edits |
813 |
+ |
814 |
+diff --git a/src/batGc.mli b/src/batGc.mli |
815 |
+index ecffb79..494b9b1 100644 |
816 |
+--- a/src/batGc.mli |
817 |
++++ b/src/batGc.mli |
818 |
+@@ -34,18 +34,18 @@ |
819 |
+ type stat = Gc.stat = |
820 |
+ { minor_words : float; |
821 |
+ (** Number of words allocated in the minor heap since |
822 |
+- the program was started. This number is accurate in |
823 |
+- byte-code programs, but only an approximation in programs |
824 |
+- compiled to native code. *) |
825 |
++ the program was started. This number is accurate in |
826 |
++ byte-code programs, but only an approximation in programs |
827 |
++ compiled to native code. *) |
828 |
+ |
829 |
+ promoted_words : float; |
830 |
+ (** Number of words allocated in the minor heap that |
831 |
+- survived a minor collection and were moved to the major heap |
832 |
+- since the program was started. *) |
833 |
++ survived a minor collection and were moved to the major heap |
834 |
++ since the program was started. *) |
835 |
+ |
836 |
+ major_words : float; |
837 |
+ (** Number of words allocated in the major heap, including |
838 |
+- the promoted words, since the program was started. *) |
839 |
++ the promoted words, since the program was started. *) |
840 |
+ |
841 |
+ minor_collections : int; |
842 |
+ (** Number of minor collections since the program was started. *) |
843 |
+@@ -62,7 +62,7 @@ type stat = Gc.stat = |
844 |
+ |
845 |
+ live_words : int; |
846 |
+ (** Number of words of live data in the major heap, including the header |
847 |
+- words. *) |
848 |
++ words. *) |
849 |
+ |
850 |
+ live_blocks : int; |
851 |
+ (** Number of live blocks in the major heap. *) |
852 |
+@@ -78,8 +78,8 @@ type stat = Gc.stat = |
853 |
+ |
854 |
+ fragments : int; |
855 |
+ (** Number of wasted words due to fragmentation. These are |
856 |
+- 1-words free blocks placed between two live blocks. They |
857 |
+- are not available for allocation. *) |
858 |
++ 1-words free blocks placed between two live blocks. They |
859 |
++ are not available for allocation. *) |
860 |
+ |
861 |
+ compactions : int; |
862 |
+ (** Number of heap compactions since the program was started. *) |
863 |
+@@ -92,16 +92,16 @@ type stat = Gc.stat = |
864 |
+ } |
865 |
+ (** The memory management counters are returned in a [stat] record. |
866 |
+ |
867 |
+- The total amount of memory allocated by the program since it was started |
868 |
+- is (in words) [minor_words + major_words - promoted_words]. Multiply by |
869 |
+- the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get |
870 |
+- the number of bytes. |
871 |
++ The total amount of memory allocated by the program since it was started |
872 |
++ is (in words) [minor_words + major_words - promoted_words]. Multiply by |
873 |
++ the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get |
874 |
++ the number of bytes. |
875 |
+ *) |
876 |
+ |
877 |
+ type control = Gc.control = |
878 |
+ { mutable minor_heap_size : int; |
879 |
+ (** The size (in words) of the minor heap. Changing |
880 |
+- this parameter will trigger a minor collection. Default: 256k. *) |
881 |
++ this parameter will trigger a minor collection. Default: 256k. *) |
882 |
+ |
883 |
+ mutable major_heap_increment : int; |
884 |
+ (** How much to add to the major heap when increasing it. If this |
885 |
+@@ -112,45 +112,45 @@ type control = Gc.control = |
886 |
+ |
887 |
+ mutable space_overhead : int; |
888 |
+ (** The major GC speed is computed from this parameter. |
889 |
+- This is the memory that will be "wasted" because the GC does not |
890 |
+- immediatly collect unreachable blocks. It is expressed as a |
891 |
+- percentage of the memory used for live data. |
892 |
+- The GC will work more (use more CPU time and collect |
893 |
+- blocks more eagerly) if [space_overhead] is smaller. |
894 |
+- Default: 80. *) |
895 |
++ This is the memory that will be "wasted" because the GC does not |
896 |
++ immediatly collect unreachable blocks. It is expressed as a |
897 |
++ percentage of the memory used for live data. |
898 |
++ The GC will work more (use more CPU time and collect |
899 |
++ blocks more eagerly) if [space_overhead] is smaller. |
900 |
++ Default: 80. *) |
901 |
+ |
902 |
+ mutable verbose : int; |
903 |
+ (** This value controls the GC messages on standard error output. |
904 |
+- It is a sum of some of the following flags, to print messages |
905 |
+- on the corresponding events: |
906 |
+- - [0x001] Start of major GC cycle. |
907 |
+- - [0x002] Minor collection and major GC slice. |
908 |
+- - [0x004] Growing and shrinking of the heap. |
909 |
+- - [0x008] Resizing of stacks and memory manager tables. |
910 |
+- - [0x010] Heap compaction. |
911 |
+- - [0x020] Change of GC parameters. |
912 |
+- - [0x040] Computation of major GC slice size. |
913 |
+- - [0x080] Calling of finalisation functions. |
914 |
+- - [0x100] Bytecode executable and shared library search at start-up. |
915 |
+- - [0x200] Computation of compaction-triggering condition. |
916 |
+- - [0x400] Output GC statistics at program exit. |
917 |
+- Default: 0. *) |
918 |
++ It is a sum of some of the following flags, to print messages |
919 |
++ on the corresponding events: |
920 |
++ - [0x001] Start of major GC cycle. |
921 |
++ - [0x002] Minor collection and major GC slice. |
922 |
++ - [0x004] Growing and shrinking of the heap. |
923 |
++ - [0x008] Resizing of stacks and memory manager tables. |
924 |
++ - [0x010] Heap compaction. |
925 |
++ - [0x020] Change of GC parameters. |
926 |
++ - [0x040] Computation of major GC slice size. |
927 |
++ - [0x080] Calling of finalisation functions. |
928 |
++ - [0x100] Bytecode executable and shared library search at start-up. |
929 |
++ - [0x200] Computation of compaction-triggering condition. |
930 |
++ - [0x400] Output GC statistics at program exit. |
931 |
++ Default: 0. *) |
932 |
+ |
933 |
+ mutable max_overhead : int; |
934 |
+ (** Heap compaction is triggered when the estimated amount |
935 |
+- of "wasted" memory is more than [max_overhead] percent of the |
936 |
+- amount of live data. If [max_overhead] is set to 0, heap |
937 |
+- compaction is triggered at the end of each major GC cycle |
938 |
+- (this setting is intended for testing purposes only). |
939 |
+- If [max_overhead >= 1000000], compaction is never triggered. |
940 |
+- If compaction is permanently disabled, it is strongly suggested |
941 |
+- to set [allocation_policy] to 1. |
942 |
+- Default: 500. *) |
943 |
++ of "wasted" memory is more than [max_overhead] percent of the |
944 |
++ amount of live data. If [max_overhead] is set to 0, heap |
945 |
++ compaction is triggered at the end of each major GC cycle |
946 |
++ (this setting is intended for testing purposes only). |
947 |
++ If [max_overhead >= 1000000], compaction is never triggered. |
948 |
++ If compaction is permanently disabled, it is strongly suggested |
949 |
++ to set [allocation_policy] to 1. |
950 |
++ Default: 500. *) |
951 |
+ |
952 |
+ mutable stack_limit : int; |
953 |
+ (** The maximum size of the stack (in words). This is only |
954 |
+- relevant to the byte-code runtime, as the native code runtime |
955 |
+- uses the operating system's stack. Default: 1024k. *) |
956 |
++ relevant to the byte-code runtime, as the native code runtime |
957 |
++ uses the operating system's stack. Default: 1024k. *) |
958 |
+ |
959 |
+ mutable allocation_policy : int; |
960 |
+ (** The policy used for allocating in the heap. Possible |
961 |
+@@ -173,8 +173,8 @@ type control = Gc.control = |
962 |
+ |
963 |
+ external stat : unit -> stat = "caml_gc_stat" |
964 |
+ (** Return the current values of the memory management counters in a |
965 |
+- [stat] record. This function examines every heap block to get the |
966 |
+- statistics. *) |
967 |
++ [stat] record. This function examines every heap block to get the |
968 |
++ statistics. *) |
969 |
+ |
970 |
+ external quick_stat : unit -> stat = "caml_gc_quick_stat" |
971 |
+ (** Same as [stat] except that [live_words], [live_blocks], [free_words], |
972 |
+@@ -191,7 +191,7 @@ external get : unit -> control = "caml_gc_get" |
973 |
+ |
974 |
+ external set : control -> unit = "caml_gc_set" |
975 |
+ (** [set r] changes the GC parameters according to the [control] record [r]. |
976 |
+- The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }] *) |
977 |
++ The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }] *) |
978 |
+ |
979 |
+ external minor : unit -> unit = "caml_gc_minor" |
980 |
+ (** Trigger a minor collection. *) |
981 |
+@@ -210,21 +210,21 @@ external major : unit -> unit = "caml_gc_major" |
982 |
+ |
983 |
+ external full_major : unit -> unit = "caml_gc_full_major" |
984 |
+ (** Do a minor collection, finish the current major collection cycle, |
985 |
+- and perform a complete new cycle. This will collect all currently |
986 |
+- unreachable blocks. *) |
987 |
++ and perform a complete new cycle. This will collect all currently |
988 |
++ unreachable blocks. *) |
989 |
+ |
990 |
+ external compact : unit -> unit = "caml_gc_compaction" |
991 |
+ (** Perform a full major collection and compact the heap. Note that heap |
992 |
+- compaction is a lengthy operation. *) |
993 |
++ compaction is a lengthy operation. *) |
994 |
+ |
995 |
+ val print_stat : _ BatInnerIO.output -> unit |
996 |
+ (** Print the current values of the memory management counters (in |
997 |
+- human-readable form) into the channel argument. *) |
998 |
++ human-readable form) into the channel argument. *) |
999 |
+ |
1000 |
+ val allocated_bytes : unit -> float |
1001 |
+ (** Return the total number of bytes allocated since the program was |
1002 |
+- started. It is returned as a [float] to avoid overflow problems |
1003 |
+- with [int] on 32-bit machines. *) |
1004 |
++ started. It is returned as a [float] to avoid overflow problems |
1005 |
++ with [int] on 32-bit machines. *) |
1006 |
+ |
1007 |
+ external get_minor_free : unit -> int = "caml_get_minor_free" [@@noalloc] |
1008 |
+ (** Return the current size of the free space inside the minor heap. *) |
1009 |
+@@ -247,63 +247,63 @@ external huge_fallback_count : unit -> int = "caml_gc_huge_fallback_count" |
1010 |
+ |
1011 |
+ val finalise : ('a -> unit) -> 'a -> unit |
1012 |
+ (** [finalise f v] registers [f] as a finalisation function for [v]. |
1013 |
+- [v] must be heap-allocated. [f] will be called with [v] as |
1014 |
+- argument at some point between the first time [v] becomes unreachable |
1015 |
+- (including through weak pointers) and the time [v] is collected by |
1016 |
+- the GC. Several functions can |
1017 |
+- be registered for the same value, or even several instances of the |
1018 |
+- same function. Each instance will be called once (or never, |
1019 |
+- if the program terminates before [v] becomes unreachable). |
1020 |
+- |
1021 |
+- The GC will call the finalisation functions in the order of |
1022 |
+- deallocation. When several values become unreachable at the |
1023 |
+- same time (i.e. during the same GC cycle), the finalisation |
1024 |
+- functions will be called in the reverse order of the corresponding |
1025 |
+- calls to [finalise]. If [finalise] is called in the same order |
1026 |
+- as the values are allocated, that means each value is finalised |
1027 |
+- before the values it depends upon. Of course, this becomes |
1028 |
+- false if additional dependencies are introduced by assignments. |
1029 |
+- |
1030 |
+- In the presence of multiple OCaml threads it should be assumed that |
1031 |
+- any particular finaliser may be executed in any of the threads. |
1032 |
+- |
1033 |
+- Anything reachable from the closure of finalisation functions |
1034 |
+- is considered reachable, so the following code will not work |
1035 |
+- as expected: |
1036 |
+- - [ let v = ... in Gc.finalise (fun _ -> ...v...) v ] |
1037 |
+- |
1038 |
+- Instead you should make sure that [v] is not in the closure of |
1039 |
+- the finalisation function by writing: |
1040 |
+- - [ let f = fun x -> ... ;; let v = ... in Gc.finalise f v ] |
1041 |
+- |
1042 |
+- |
1043 |
+- The [f] function can use all features of OCaml, including |
1044 |
+- assignments that make the value reachable again. It can also |
1045 |
+- loop forever (in this case, the other |
1046 |
+- finalisation functions will not be called during the execution of f, |
1047 |
+- unless it calls [finalise_release]). |
1048 |
+- It can call [finalise] on [v] or other values to register other |
1049 |
+- functions or even itself. It can raise an exception; in this case |
1050 |
+- the exception will interrupt whatever the program was doing when |
1051 |
+- the function was called. |
1052 |
+- |
1053 |
+- |
1054 |
+- [finalise] will raise [Invalid_argument] if [v] is not |
1055 |
+- guaranteed to be heap-allocated. Some examples of values that are not |
1056 |
+- heap-allocated are integers, constant constructors, booleans, |
1057 |
+- the empty array, the empty list, the unit value. The exact list |
1058 |
+- of what is heap-allocated or not is implementation-dependent. |
1059 |
+- Some constant values can be heap-allocated but never deallocated |
1060 |
+- during the lifetime of the program, for example a list of integer |
1061 |
+- constants; this is also implementation-dependent. |
1062 |
+- Note that values of types [float] and ['a lazy] (for any ['a]) are |
1063 |
+- sometimes allocated and sometimes not, so finalising them is unsafe, |
1064 |
+- and [finalise] will also raise [Invalid_argument] for them. |
1065 |
+- |
1066 |
+- |
1067 |
+- The results of calling {!String.make}, {!Bytes.make}, {!Bytes.create}, |
1068 |
+- {!Array.make}, and {!Pervasives.ref} are guaranteed to be |
1069 |
+- heap-allocated and non-constant except when the length argument is [0]. |
1070 |
++ [v] must be heap-allocated. [f] will be called with [v] as |
1071 |
++ argument at some point between the first time [v] becomes unreachable |
1072 |
++ (including through weak pointers) and the time [v] is collected by |
1073 |
++ the GC. Several functions can |
1074 |
++ be registered for the same value, or even several instances of the |
1075 |
++ same function. Each instance will be called once (or never, |
1076 |
++ if the program terminates before [v] becomes unreachable). |
1077 |
++ |
1078 |
++ The GC will call the finalisation functions in the order of |
1079 |
++ deallocation. When several values become unreachable at the |
1080 |
++ same time (i.e. during the same GC cycle), the finalisation |
1081 |
++ functions will be called in the reverse order of the corresponding |
1082 |
++ calls to [finalise]. If [finalise] is called in the same order |
1083 |
++ as the values are allocated, that means each value is finalised |
1084 |
++ before the values it depends upon. Of course, this becomes |
1085 |
++ false if additional dependencies are introduced by assignments. |
1086 |
++ |
1087 |
++ In the presence of multiple OCaml threads it should be assumed that |
1088 |
++ any particular finaliser may be executed in any of the threads. |
1089 |
++ |
1090 |
++ Anything reachable from the closure of finalisation functions |
1091 |
++ is considered reachable, so the following code will not work |
1092 |
++ as expected: |
1093 |
++ - [ let v = ... in Gc.finalise (fun _ -> ...v...) v ] |
1094 |
++ |
1095 |
++ Instead you should make sure that [v] is not in the closure of |
1096 |
++ the finalisation function by writing: |
1097 |
++ - [ let f = fun x -> ... ;; let v = ... in Gc.finalise f v ] |
1098 |
++ |
1099 |
++ |
1100 |
++ The [f] function can use all features of OCaml, including |
1101 |
++ assignments that make the value reachable again. It can also |
1102 |
++ loop forever (in this case, the other |
1103 |
++ finalisation functions will not be called during the execution of f, |
1104 |
++ unless it calls [finalise_release]). |
1105 |
++ It can call [finalise] on [v] or other values to register other |
1106 |
++ functions or even itself. It can raise an exception; in this case |
1107 |
++ the exception will interrupt whatever the program was doing when |
1108 |
++ the function was called. |
1109 |
++ |
1110 |
++ |
1111 |
++ [finalise] will raise [Invalid_argument] if [v] is not |
1112 |
++ guaranteed to be heap-allocated. Some examples of values that are not |
1113 |
++ heap-allocated are integers, constant constructors, booleans, |
1114 |
++ the empty array, the empty list, the unit value. The exact list |
1115 |
++ of what is heap-allocated or not is implementation-dependent. |
1116 |
++ Some constant values can be heap-allocated but never deallocated |
1117 |
++ during the lifetime of the program, for example a list of integer |
1118 |
++ constants; this is also implementation-dependent. |
1119 |
++ Note that values of types [float] and ['a lazy] (for any ['a]) are |
1120 |
++ sometimes allocated and sometimes not, so finalising them is unsafe, |
1121 |
++ and [finalise] will also raise [Invalid_argument] for them. |
1122 |
++ |
1123 |
++ |
1124 |
++ The results of calling {!String.make}, {!Bytes.make}, {!Bytes.create}, |
1125 |
++ {!Array.make}, and {!Pervasives.ref} are guaranteed to be |
1126 |
++ heap-allocated and non-constant except when the length argument is [0]. |
1127 |
+ *) |
1128 |
+ |
1129 |
+ val finalise_release : unit -> unit |
1130 |
+@@ -313,15 +313,15 @@ val finalise_release : unit -> unit |
1131 |
+ |
1132 |
+ type alarm = Gc.alarm |
1133 |
+ (** An alarm is a piece of data that calls a user function at the end of |
1134 |
+- each major GC cycle. The following functions are provided to create |
1135 |
+- and delete alarms. *) |
1136 |
++ each major GC cycle. The following functions are provided to create |
1137 |
++ and delete alarms. *) |
1138 |
+ |
1139 |
+ val create_alarm : (unit -> unit) -> alarm |
1140 |
+ (** [create_alarm f] will arrange for [f] to be called at the end of each |
1141 |
+- major GC cycle, starting with the current cycle or the next one. |
1142 |
+- A value of type [alarm] is returned that you can |
1143 |
+- use to call [delete_alarm]. *) |
1144 |
++ major GC cycle, starting with the current cycle or the next one. |
1145 |
++ A value of type [alarm] is returned that you can |
1146 |
++ use to call [delete_alarm]. *) |
1147 |
+ |
1148 |
+ val delete_alarm : alarm -> unit |
1149 |
+ (** [delete_alarm a] will stop the calls to the function associated |
1150 |
+- to [a]. Calling [delete_alarm a] again has no effect. *) |
1151 |
++ to [a]. Calling [delete_alarm a] again has no effect. *) |
1152 |
|
1153 |
diff --git a/dev-ml/batteries/files/oc43-3.patch b/dev-ml/batteries/files/oc43-3.patch |
1154 |
new file mode 100644 |
1155 |
index 0000000..95fa8fa |
1156 |
--- /dev/null |
1157 |
+++ b/dev-ml/batteries/files/oc43-3.patch |
1158 |
@@ -0,0 +1,21 @@ |
1159 |
+commit 39393f8fc2d7c60dc093e9ea836077598dfbe955 |
1160 |
+Author: KC Sivaramakrishnan <sk826@×××××××××.uk> |
1161 |
+Date: Wed Mar 23 11:23:26 2016 +0000 |
1162 |
+ |
1163 |
+ Fix make_float versioning |
1164 |
+ |
1165 |
+diff --git a/src/batArray.mliv b/src/batArray.mliv |
1166 |
+index 025887f..c6bfd02 100644 |
1167 |
+--- a/src/batArray.mliv |
1168 |
++++ b/src/batArray.mliv |
1169 |
+@@ -82,7 +82,9 @@ external make : int -> 'a -> 'a array = "caml_make_vect" |
1170 |
+ If the value of [x] is a floating-point number, then the maximum |
1171 |
+ size is only [Sys.max_array_length / 2].*) |
1172 |
+ |
1173 |
+-val make_float : int -> float array |
1174 |
++##V>=4.3##val make_float : int -> float array |
1175 |
++##V=4.2##external make_float : int -> float array = "caml_make_float_vect" |
1176 |
++##V<4.2##val make_float : int -> float array |
1177 |
+ (** [Array.make_float n] returns a fresh float array of length [n], |
1178 |
+ with uninitialized data. |
1179 |
+ |