Code Monkey home page Code Monkey logo

ocaml-extlib's Introduction

OCaml Extended standard Library - ExtLib.

Build Status Build status

 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version,,
 * with the special exception on linking described in file LICENSE.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

What is ExtLib ?

ExtLib is a set of additional useful functions and modules for OCaml. Current goal is to maintain compatibility, new software is encouraged to not use extlib since stdlib is now seeing many additions and improvements which make many parts of extlib obsolete. For tail-recursion safety consider using other libraries e.g. containers.

Project page : https://github.com/ygrek/ocaml-extlib

Online API documentation : https://ygrek.org/p/extlib/doc/

Dependencies

  • cppo - enables conditional compilation to ensure compatibility with various OCaml versions
  • ocamlfind >= 1.5.1 - provides bytes package

Installation

Unzip or untar in any directory and run

make minimal=1 build install

This will build and install bytecode and native libraries. On bytecode-only architecture run

make minimal=1 all install

minimal=1 will exclude from build several modules (namely Base64 Unzip UChar UTF8) potentially conflicting with other well established OCaml libraries. If your code is expecting to find these modules in extlib - omit this parameter during build to produce the full library.

Usage

Generate and read the documentation.

Release

  • Check for changes in stdlib (e.g. with ocaml test/std.ml)
  • Update sw_test_all target for new OCaml release
  • make sw_test_all
  • Review git log and update CHANGES
  • Update version in Makefile
  • Commit
  • make release
  • upload tarball and make release on github
  • opam publish

Contributors

License

See LICENSE

ocaml-extlib's People

Contributors

andyli avatar avsm avatar barracuda156 avatar damiendoligez avatar dra27 avatar fccm avatar firobe avatar gasche avatar khady avatar kit-ty-kate avatar leonidas-from-xiv avatar mmottl avatar nadako avatar ncannasse avatar nurpax avatar skaller avatar tatchi avatar ygrek avatar yoriyuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ocaml-extlib's Issues

Patch for installer under Windows

Originally reported on Google Code with ID 9

I use the MinGW Win32 port of OCaml mainly and have always had to patch 
extlib to build correctly – the OS detection logic in install.ml works 
only for the MSVC port. Until now, I had simply swapped the relevant 
extensions – meaning that it worked for the MinGW port but not the MSVC 
port!

The attached patch allows ExtLib to install correctly for both true 
Windows ports. I have also included support for Win64 at installation and 
trivially corrected the version number in META.txt.

* IMPORTANT *
The change I have made is to use ocamlc -config to determine the correct 
extensions for library and object files rather than guessing them based on 
OS (I've raised PR #4653 to request that utils/config.cmi is included in 
lib which would allow this to be queried directly in the future if the 
change is accepted, but for now ocamlc -config will have to do).

This change unfortunately means that you have to run ocaml unix.cma 
install.ml – unfortunately Unix.open_process_in is not a primitive and as 
process management varies from platform I can't see a way of easily 
avoiding it. I'm not sure if there are any major platforms remaining which 
don't support dynamic loading of bytecode so don't know how much of a 
problem this poses...

I've tested this patch using OCaml 3.11.0 on Windows Vista Ultimate 64-bit 
using both the MinGW 32-bit port and the MSVC 64-bit port both with 
Findlib 1.2.3.

Reported by david.allsopp on 2008-12-08 16:20:24


- _Attachment: [extlib-1.5.1.patch](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-9/comment-0/extlib-1.5.1.patch)_

UTF8.substring function

Originally reported on Google Code with ID 4

Here's a patch for a function for computing a substring of a UTF8 string. 
It could be done with the current version, but I think it belongs in UTF8,
where it can also take advantage of nth_aux.

Reported by berke.durak on 2008-02-13 16:48:12


- _Attachment: [extlib-utf8-substring.patch](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-4/comment-0/extlib-utf8-substring.patch)_

List.make not tail-recursive

Originally reported on Google Code with ID 12

# List.make 10000000 1;;  
Stack overflow during evaluation (looping recursion?).
# let make i x =
  let rec loop acc x = function
  | 0 -> acc
  | i -> loop (x::acc) x (i-1)  
  in loop [] x i;;
val make : int -> 'a -> 'a list = <fun>
# make 10000000 1;;
- : int list =
[1; 1; 1; 1; 1; 1; 1; 1; 1; ...]

Reported by apsheronets on 2009-09-07 13:42:11

String.nsplit memory usage

Originally reported on Google Code with ID 17

What steps will reproduce the problem?
 # let st = Gc.quick_stat ();;
val st : Gc.stat =
  {Gc.minor_words = 1034985.; Gc.promoted_words = 216549.;
   Gc.major_words = 726404.; Gc.minor_collections = 33;
   Gc.major_collections = 6; Gc.heap_words = 552960; Gc.heap_chunks = 4;
   Gc.live_words = 0; Gc.live_blocks = 0; Gc.free_words = 0;
   Gc.free_blocks = 0; Gc.largest_free = 0; Gc.fragments = 0;
   Gc.compactions = 1; Gc.top_heap_words = 679936}
# String.nsplit (String.make 10000 ' ') " ";;
- : string list =
[ ... ]
# let st2 = Gc.quick_stat ();;
val st2 : Gc.stat =
  {Gc.minor_words = 1897029.; Gc.promoted_words = 553575.;
   Gc.major_words = 7064466.; Gc.minor_collections = 236;
   Gc.major_collections = 17; Gc.heap_words = 6774784; Gc.heap_chunks = 53;
   Gc.live_words = 0; Gc.live_blocks = 0; Gc.free_words = 0;
   Gc.free_blocks = 0; Gc.largest_free = 0; Gc.fragments = 0;
   Gc.compactions = 1; Gc.top_heap_words = 6774784}
# print_endline & gc_diff st st2;;
allocated     52.4MB, heap     47.5MB, collection 0 11 203
- : unit = ()
# Gc.compact ();;
- : unit = ()
# let st3 = Gc.quick_stat ();;
val st3 : Gc.stat =
  {Gc.minor_words = 1950890.; Gc.promoted_words = 559622.;
   Gc.major_words = 7073711.; Gc.minor_collections = 238;
   Gc.major_collections = 19; Gc.heap_words = 634880; Gc.heap_chunks = 5;
   Gc.live_words = 0; Gc.live_blocks = 0; Gc.free_words = 0;
   Gc.free_blocks = 0; Gc.largest_free = 0; Gc.fragments = 0;
   Gc.compactions = 2; Gc.top_heap_words = 6774784}
# print_endline & gc_diff st2 st3;;
allocated      445KB, heap    -46.8MB, collection 1 2 2
- : unit = ()

What is the expected output? What do you see instead?
We can see 52 MB allocated during nsplit of 10K string. Memory consumption of nsplit
is currently quadratic to the length of string, in the patalogical case (n**2)/2 (50MB
~ 10K/2*10K)

What version of the product are you using? On what operating system?
1.5.1

Please provide any additional information below.
Better solution (linear memory usage) can be easily implemented with find_from from
issue #15

Reported by ygrekheretix on 2010-08-31 15:10:18

Conflict with Camomile

Originally reported on Google Code with ID 23

What steps will reproduce the problem?
1. Install camomile 0.8.X
2. Install extlib
3. Install any software that has transitive depends on extlib and camomile (e.g. pgocaml
+ sqlexpr).

What is the expected output? What do you see instead?

The files /usr/lib/ocaml/camomile/camomile.cma
and /usr/lib/ocaml/extlib/extLib.cma
disagree over interface UChar

What version of the product are you using? On what operating system?

1.5.2/Debian unstable

Please provide any additional information below.

For more info see 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670474

Reported by gildor478 on 2012-04-30 19:23:19

failed to be built on 32-bit enviroment

#=== ERROR while compiling extlib.1.7.4 =======================================#
# opam-version         1.3.0~dev (5311286bd09e8eb9b44864abb48d60a3d5b29a5f)
# os                   win32
# command              make minimal=1 build
# path                 C:/cygwin64/home/appveyor/.opam/4.02.3+mingw32c/build/extlib.1.7.4
# exit-code            2
# env-file             C:/cygwin64/home/appveyor/.opam/4.02.3+mingw32c/build/extlib.1.7.4\extlib-308-a63268.env
# stdout-file          C:/cygwin64/home/appveyor/.opam/4.02.3+mingw32c/build/extlib.1.7.4\extlib-308-a63268.out
# stderr-file          C:/cygwin64/home/appveyor/.opam/4.02.3+mingw32c/build/extlib.1.7.4\extlib-308-a63268.err
### stdout ###
# [...]
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c extBytes.mli extBytes.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c enum.mli enum.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c bitSet.mli bitSet.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c dynArray.mli dynArray.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c extArray.mli extArray.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c extHashtbl.mli extHashtbl.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c extList.mli extList.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c extString.mli extString.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c extBuffer.mli extBuffer.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c global.mli global.ml
# ocamlfind ocamlc -pp "cppo -D OCAML4  -D OCAML4_02      -D WITH_BYTES" -g -bin-annot -package bytes -c IO.mli IO.ml
# make[1]: Leaving directory '/home/appveyor/.opam/4.02.3+mingw32c/build/extlib.1.7.4/src'
### stderr ###
# fatal: Not a git repository: '.git'
# File "IO.ml", line 577, characters 10-21:
# Error: Integer literal exceeds the range of representable integers of type int
# make[1]: *** [Makefile:50: IO.cmo] Error 2
# make: *** [Makefile:14: build] Error 2

Am I one of the Contributors?

Look, I don't want to be an a-hole, but I do think I do derserve a mention in the README as a "Contributor" since I wrote the whole of the option parsing code. Show a little love? ;)

Add ability to run ExtLib test suite against a ocamlfind released extlib

Originally reported on Google Code with ID 1

In order to test that the released (or locally tested) GODI (or debian
etc.) package is working and properly addresses bugs fixed in that release, 
it would be good to be able to run extlib's tests against the ocamlfind
installed package.

The current ExtLib tests can only be run against the freshly built trunk
version of ExtLib.

Reported by jjhellst on 2007-12-30 14:56:14

ExtString.find_from

Originally reported on Google Code with ID 15

Index: extlib/extString.ml
===================================================================
--- extlib/extString.ml (revision 382)
+++ extlib/extString.ml (working copy)
@@ -65,6 +65,25 @@
        with
            Exit -> !found

+let find_from str pos sub =
+  let sublen = length sub in
+  if sublen = 0 then
+    0
+  else
+    let found = ref pos in
+    let len = length str in
+    try
+      for i = pos to len - sublen do
+        let j = ref 0 in
+        while unsafe_get str (i + !j) = unsafe_get sub !j do
+          incr j;
+          if !j = sublen then begin found := i; raise Exit; end;
+        done;
+      done;
+      raise Invalid_string
+    with
+      Exit -> !found
+
 let exists str sub =
    try
        ignore(find str sub);
Index: extlib/extString.mli
===================================================================
--- extlib/extString.mli    (revision 382)
+++ extlib/extString.mli    (working copy)
@@ -36,6 +36,12 @@
        within the string [s] or raises [Invalid_string] if [x]
        is not a substring of [s]. *)

+  val find_from : string -> int -> string -> int
+   (** [find s i x] returns the starting index of the string [x]
+       within the string [s] after position i or raises [Invalid_string]
+       if [x] is not a substring of [s]. [find s x] is is equivalent to
+       [find_from s 0 x]. *)
+
    val split : string -> string -> string * string
    (** [split s sep] splits the string [s] between the first
        occurrence of [sep].

Reported by apsheronets on 2010-05-08 15:49:30

Hashtbl.map

Originally reported on Google Code with ID 26

1. let h = Hashtbl.create 1
2. Hashtbl.add h 1 1
3. let h1 = ExtHashtbl.Hashtbl.map (fun v -> v + 1) h
4. Hashtbl.find h1 1
Exception: Not_found.

ocaml 4. map function create old hashtbl, but buckets copied from new.

Reported by serp256 on 2013-08-05 05:57:49

Standalone optparse or base64 packages?

I depend on extlib for its OptParse module. I don't actually use the rest, I sort of ended up in this situation by initially using the copy of Optparse in Batteries, but then replacing Batteries with smaller, more focussed dependencies. OptParse was the only thing I couldn't find a good replacement for in opam.

My trouble is, extlib clashes with newish versions of cohttp (and probably other packages) which depend on the base64 package, because both that and extlib define a Base64 module (see my comments in mirage/ocaml-base64#25)

One fix would be to pull out optparse as a separate package. To be honest it seems worthy of its own opam module, but that's presumably a fair bit more maintenance work for you.

It could also possibly be a separate findlib package and still live under the extlib opam package (i.e. extlib.optparse), I think that'd fix the name clash.

A third option is to pull out the problematic optparse.base64 as a sub-package as well / instead, and then nobody would get the clash unless they explicitly use this sub-package. But that would be a breaking change (for build systems, but not ocaml source code).

Documentation

Description: Compile and upload the documentation for this package.
Reasoning: previously the documentation was on google code website, after moving to github there is no more official manual.

opam release compatible with 4.07.0

It would be great to have a new release of this library for 4.07.0. I see there's already a commit in the repo about that, I'm opening this issue to track this if that's ok.

Error in DynArray exponential resizer

Originally reported on Google Code with ID 2

What steps will reproduce the problem?
1.
The first of the following functions causes a "Fatal error: exception
Out_of_memory", while the second works fine.
The problem seems to be related to the exponential resizer as mentioned
here:
http://caml.inria.fr/pub/ml-archives/caml-list/2007/03/76ec07c952430ed1c60fea094f1820ae.en.html


  let test_dynarray1 () =
    let a = DynArray.create () in
    for i = 1 to 2817131 do
      DynArray.add a i
    done

  let test_dynarray2 () =
    let a = DynArray.make 2817131 in
    for i = 1 to 2817131 do
      DynArray.add a i
    done


What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?

ExtLib 1.4, Linux


Please provide any additional information below.


Reported by dario.rehman on 2008-01-02 19:43:14

Enum.fold has wrong documentation

Originally reported on Google Code with ID 3

in extlib 1.5:

val fold : ('a -> 'b -> 'b) -> 'b -> 'a t -> 'b
(** [fold f v e] returns v if e is empty,
  otherwise [f (... (f (f v a1) a2) ...) aN] where a1..N are
  the elements of [e]. 
*)

(f v a1) mismatches types. Should be (f a1 v).

Reported by Thomas.Lefort on 2008-02-01 16:05:59

OptParse.OptParser.error should return 'a not unit

Originally reported on Google Code with ID 18

The error function is guaranteed to always terminate the process rather than returning.
Therefore, it should be declared as returning 'a (that is, *anything*) rather than
unit. This means it can be called in e.g. conditional branches where values would otherwise
be required. I see that the last line of the error function is call to Pervasives.exit
(in the manual exit's return type is declared as 'a I believe for this exact reason)
so this is a change to interface only that doesn't require any changes to the implementation.

Reported by headch on 2010-09-02 02:37:48

Request for installation and use instructions

Originally reported on Google Code with ID 27

It would be great if anyone could provide some instructions/tutorial on how to compile,
load and use this library. After much trouble I managed to build the library, but have
no idea how to use it with my standard ocaml installation. Some questions I also had
were:
- Where should it be installed? As in, what is the default location, and how would
it work if I installed it to a custom directory?
- How to load the library in the Ocaml toplevel or in my programs?

Thank you very much.

Reported by ssiiddkk on 2014-04-06 19:49:59

Array.exists is slower than List.exists

Originally reported on Google Code with ID 21

Allocates too much (ocamlopt problem?), the implementation below is noticeably faster
:

let array_exists p xs =
  try
  for i = 0 to Array.length xs - 1 do
    if p xs.(i) then raise Exit
  done; false
  with Exit -> true

Reported by ygrekheretix on 2011-08-05 15:00:06

add IO.scanf

Originally reported on Google Code with ID 8

Seems like extlib should include IO.scanf for symmetry with IO.printf:

--- IO.mli.orig 2008-07-13 14:36:59.000000000 -0700
+++ IO.mli  2008-07-13 14:02:02.000000000 -0700
@@ -135,6 +135,9 @@

 (** {6 Utilities} *)

+val scanf : input -> ('a, 'b, 'c, 'd) Scanf.scanner
+(** The scanf function works for any input. *)
+
 val printf : 'a output -> ('b, unit, string, unit) format4 -> 'b
 (** The printf function works for any output. *)

--- IO.ml.orig  2008-07-13 14:36:59.000000000 -0700
+++ IO.ml   2008-07-13 14:06:12.000000000 -0700
@@ -145,6 +145,10 @@
    if p + l > sl || p < 0 || l < 0 then invalid_arg "IO.output";
    o.out_output s p l

+let scanf i fmt =
+   let ib = Scanf.Scanning.from_function (fun () -> read i) in
+   Scanf.kscanf ib (fun _ exn -> raise exn) fmt
+
 let printf o fmt =
    Printf.kprintf (fun s -> nwrite o s) fmt


Reported by warrenharris1 on 2008-07-13 21:38:27

forget to install extLib.cmi file

Originally reported on Google Code with ID 24

What steps will reproduce the problem?
1. add to install command in Makefile
2.
3.

What is the expected output? What do you see instead?


Please use labels and text to provide additional information.

install:
    ocamlfind install extlib META extLib.cma extLib.cmi $(MLI) $(CMI) -optional extLib.cmxa
$(CMX) extLib.cmxs extLib.a extLib.lib

Reported by lykhovyd on 2012-11-02 14:14:42

IO.from_in_channel doesn't catch End_of_file

Originally reported on Google Code with ID 11

What steps will reproduce the problem?
1. Compile and run
let x = object
    method input s pos len = raise End_of_file
    method close_in () = ()
end

let () = 
  let input = IO.from_in_channel x in
  let _ = IO.read_all input in
  ()

What is the expected output? What do you see instead?

Expect read_all to return empty string.
Instead exception is raised:
Fatal error: exception End_of_file

What version of the product are you using? On what operating system?
1.5.1, WinXP, ocaml-3.11.0

Please provide any additional information below.

The code in question

let from_in_channel ch =
    let cbuf = String.create 1 in
    let read() =
        try
            if ch#input cbuf 0 1 = 0 then raise Sys_blocked_io;
            String.unsafe_get cbuf 0
        with
            End_of_file -> raise No_more_input
    in
    let input s p l =
        ch#input s p l
    in
    create_in
        ~read
        ~input
        ~close:ch#close_in

Looks like input should catch End_of_file and convert it to No_more_input

    try
        ch#input s p l
    with
      End_of_file -> raise No_more_input

The same goes for other methods. I could prepare a patch if you like.

Reported by ygrekheretix on 2009-07-16 11:58:53

ExtList.(@) is not imported by 'open ExtLib'

Originally reported on Google Code with ID 13

In this program:

open ExtLib
let () =
  let l1 = [1 ; 2 ; 3] in
  let l2 = [3 ; 4 ; 5] in
  let l3 = l1 @ l2 in
  let l4 = List.append l1 l2 in
  ()

The list `l3' is produced by calling the original (@) function in
Pervasives, and `l4' is produced by using ExtList.append (I tested this by
putting a printf in extList.ml). This is despite the fact that extList.ml
redefines the (@) function.

The problem is the way extLib.ml imports ExtList, it doesn't have a chance
to define any toplevel functions. Proposed diff attached.

Reported by david.crawshaw on 2009-09-10 22:50:14


- _Attachment: [import-at-append.patch](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-13/comment-0/import-at-append.patch)_

String.starts_with and ends_with use String.sub

Originally reported on Google Code with ID 20

This means extra allocation and throw-away data copy. Presumably direct byte-by-byte
comparison should be faster.

Reported by ygrekheretix on 2011-08-05 13:08:32

String.nsplit stack overflow

Originally reported on Google Code with ID 14

What steps will reproduce the problem?

        Objective Caml version 3.11.0

# #load "extLib.cma";;
# open ExtLib;;
# String.nsplit "qwerty" "";;
Stack overflow during evaluation (looping recursion?).
#

What is the expected output? What do you see instead?
Ideally [String.find s sub] should raise Invalid_string when sub is empty 
string. But currently it returns 0. So for backwards compatibility the 
check should be performed in String.split or String.nsplit.


Reported by ygrekheretix on 2010-01-18 15:58:35

Bump up META.txt's version to 1.6.0

Originally reported on Google Code with ID 7

Before releasing the next version, ensure that META.txt gets updated.  Also
update wiki pages to ensure that it gets updated as part of a release.

Reported by jjhellst on 2008-04-23 17:34:28

Apply Philippe Strauss's patch for writing out 32-bit floats

Originally reported on Google Code with ID 6

See comments for more info.  IMO the patch shouldn't applied exactly as
suggested.

From Philippe:

8<
I wanted to read some data written "raw" in float32 format by a python
program, and noticed than extlib didn't have (at least at v 1.5) functions
to write or read float32, double precision float are supported.

Here's a small patch, feel free to use it.
8<

Patch attached.

Reported by jjhellst on 2008-04-23 17:26:29


- _Attachment: [extlib-1.5-io-float32.diff](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-6/comment-0/extlib-1.5-io-float32.diff)_

src/Makefile race conditions

Parallel build fails because of dependencies between the modules being built

~/code/ocaml-extlib/src/ocaml-extlib-1.7.0/src
❯ make -j4 all
cppo -D OCAML4  -D OCAML4_02  -D WITH_BYTES extBytes.mlpp -o extBytes.ml
ocamlfind ocamlc -g -package bytes -c enum.mli enum.ml
ocamlfind ocamlc -g -package bytes -c bitSet.mli bitSet.ml
ocamlfind ocamlc -g -package bytes -c dynArray.mli dynArray.ml
ocamlfind ocamlc -g -package bytes -c extArray.mli extArray.ml
File "bitSet.mli", line 74, characters 16-26:
Error: Unbound module Enum
File "dynArray.mli", line 115, characters 19-28:
Error: Unbound module Enum
File "extArray.mli", line 103, characters 25-34:
Error: Unbound module Enum
Makefile:40: recipe for target 'bitSet.cmo' failed
make: *** [bitSet.cmo] Error 2
make: *** Waiting for unfinished jobs....
Makefile:40: recipe for target 'dynArray.cmo' failed
make: *** [dynArray.cmo] Error 2
Makefile:40: recipe for target 'extArray.cmo' failed
make: *** [extArray.cmo] Error 2

This was being passed automatically for me because of a systemwide setting in Arch Linux I have.

If you can't easily make parallel make work, maybe add the .NOTPARALLEL pseudo-target.

For now I will suggest the !makeflags option be added to the PKGBUILD file for the AUR package to avoid the problem until it can be resolved here.

UTF8.{eof,output_uchar} + tests

Originally reported on Google Code with ID 5

Just added :

  output_uchar : out_channel -> uchar -> unit

which is useful with printf "%a", and "eof" which gives the index
"following" the last valid index.  This is quite useful when converting
code that was working on strings and comparing the index to String.length.

Reported by berke.durak on 2008-02-14 16:24:33


- _Attachment: [extlib-utf8-eof-output-uchar.patch](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-5/comment-0/extlib-utf8-eof-output-uchar.patch)_

Add IO.output_strings

Originally reported on Google Code with ID 22

It seems that some development of extlib took place elsewhere. More precisely, there
is another extlib in "cvs :pserver:[email protected]:/cvsroot/ ocaml/extlib-dev".
The only significant difference between yours and theirs is the addition of IO.output_strings
(see patch attached) which is (afaik) needed for haxe (http://haxe.org).

We have been informed about that "other repository" in a Debian bugreport (See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596622).
It would be nice to integrate this feature.

Kind Regards,

-- 
Mehdi

Reported by mehdid on 2012-01-05 11:51:30


- _Attachment: [0001-added-output_strings.patch](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-22/comment-0/0001-added-output_strings.patch)_

Error in documentation of DynArray.iteri

Originally reported on Google Code with ID 16

What is the expected output? What do you see instead?

In the documentation, the expected documentation of DynArray.iteri would be:

val iteri : (int -> 'a -> unit) -> 'a t -> unit

iteri f darr calls the function f on every element of darr. It is equivalent to for
i = 0 to length darr - 1 do f i (get darr i) done;

Instead, the following text is present:

val iteri : (int -> 'a -> unit) -> 'a t -> unit

iter f darr calls the function f on every element of darr. It is equivalent to for
i = 0 to length darr - 1 do f i (get darr i) done;

Note to moderators/administrators: I don't know where to send this kind of issue so
I put it right here. Feel free to move/destroy/change.

Reported by johan.mazel on 2010-07-02 10:02:04

Expose Enum.from2

Originally reported on Google Code with ID 19

Would like to use Enum.from2 but not in enum.mli !

Thanks


Reported by remidewitte on 2011-01-11 14:35:53

1.7.0 fails to build on Debian Sid

Hi,

I carry out the following steps in a clean Debian Sid chroot:

$ wget https://github.com/ygrek/ocaml-extlib/archive/1.7.0.tar.gz
$ tar xf 1.7.0.tar.gz
$ cd ocaml-extlib-1.7.0/
$ apt-get install --no-install-recommends ocaml-nox cppo ocaml-findlib build-essential
$ make minimal=1 build

And I get from the last command:

make: git: Command not found
make -C src build
make[1]: Entering directory '/tmp/ocaml-extlib-1.7.0/src'
cppo -D OCAML4   -D WITH_BYTES extBytes.mlpp -o extBytes.ml
ocamlfind ocamlc -g -package bytes -i extBytes.ml > extBytes.mli
File "extBytes.mlpp", line 2, characters 15-20:
Error: Unbound module Bytes
Makefile:48: recipe for target 'extBytes.mli' failed
make[1]: *** [extBytes.mli] Error 2
make[1]: Leaving directory '/tmp/ocaml-extlib-1.7.0/src'
Makefile:13: recipe for target 'build' failed
make: *** [build] Error 2

This is with ocaml-nox 4.01.0-5, cppo 0.9.3-3 and ocaml-findlib 1.5.5-0+2.

Some more debug output:

$ ocamlfind list | grep bytes
bytes               (version: [OCaml strictly before 4.02])
$ ocamlfind ocamlc -g -package bytes -i extBytes.ml -verbose
Effective set of compiler predicates: pkg_bytes,autolink,byte
+ ocamlc -g -i -verbose -I /usr/lib/ocaml/bytes extBytes.ml
File "extBytes.mlpp", line 2, characters 15-20:
Error: Unbound module Bytes
ocamlc returned with exit code 2

What else can I try?

Thanks!

cheers, josch

Unable to build with OCaml 5 trunk compiler

I am unable to build this package with a relatively recent trunk, namely 8bfa64651b. I get the error:

File "extArray.ml", line 1:
Error: The implementation extArray.ml
       does not match the interface extArray.cmi:  ...
       The value `make_float' is required but not provided
       File "extArray.mli", line 121, characters 2-37: Expected declaration
       The value `create' is required but not provided
       File "extArray.mli", line 153, characters 2-60: Expected declaration
       In module Array:
       The value `create_matrix' is required but not provided
       File "extArray.mli", line 156, characters 2-56: Expected declaration
make[1]: *** [Makefile:50 : extArray.cmo] Erreur 2

Steps to reproduce

To install the same compiler revision as me—although I don't understand why it should matter:

opam switch create testocaml5 --empty
eval $(opam env --switch=testocaml5)
opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git
opam pin add ocaml-variants.5.1.0+8bfa64651b git+https://github.com/ocaml/ocaml#8bfa64651b

Then:

opam install extlib

Looking briefly at the source, I am confused as to how this could have ever worked, since indeed for OCaml ≥ 4.03 the function make_float has no implementation. I see that @kit-ty-kate added extlib to the opam alpha repository without mention of this problem, so maybe she will tell me what I'm missing here?

Memory corruption caused by %obj_set_field in dynArray.ml

Originally reported on Google Code with ID 10

What steps will reproduce the problem?
Example program:
-----------------------------------------------------------------------------
(* compile with:
  ocamlfind ocamlc -package extlib -I +extlib -linkpkg -o dynarr_example \
  dynarr_example.ml *)

let dynarr_example prefix =
  let d = ref (DynArray.create ()) and n = 4100 in
  for i = 0 to n do
    Printf.printf "%d %d\n" i (DynArray.length !d); flush stdout;
    DynArray.insert !d 0 (Array.create (42) "")
  done;;

let _ = dynarr_example ();;
-----------------------------------------------------------------------------

What is the expected output? -- A series of numbers up to 3999.
What do you see instead? -- The series is interrupted by a segmentation fault.
-----------------------------------------------------------------------------
/pj/ocaml/dynarr_example% ocamlc -v
The Objective Caml compiler, version 3.11.0
Standard library directory: /home/bruno/godi/lib/ocaml/std-lib/
~/pj/ocaml/dynarr_example% ./dynarr_example
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
[...]
3382 3382
3383 3383
3384 3384
3385 3385
3386 3386
3387 3387
3388 3388
3389 3389
zsh: 15042 segmentation fault  ./dynarr_example
~/pj/ocaml/dynarr_example%
-----------------------------------------------------------------------------





What version of the product are you using? On what operating system?
extlib 1.5.1 on Linux (The same problem shows up on Mingw).


Please provide any additional information below.

It must read d.len - 2 instead of d.len - 1 in the indicated line of
dynArray.ml, because the
size of the array d has alrady been increased at this point.
For this reason, "iset d.arr (i+1)" later goes out of bounds.
-----------------------------------------------------------------------------
let insert d idx v =
        if idx < 0 || idx > d.len then invalid_arg idx "insert" "index";
        if d.len = ilen d.arr then changelen d (d.len + 1) else d.len <-
d.len +
1;
        if idx < d.len - 1 then begin
                for i = d.len - 1 downto idx do <=============== d.len - 2
                        iset d.arr (i+1) (iget d.arr i)
                done;
        end;
        iset d.arr idx v
-----------------------------------------------------------------------------

For your convenience, I attached a patch for this change.


Reported by brunodanielch on 2009-06-08 21:49:38


- _Attachment: [patch.txt](https://storage.googleapis.com/google-code-attachments/ocaml-extlib/issue-10/comment-0/patch.txt)_

google code deprecates downloads

Originally reported on Google Code with ID 25

http://google-opensource.blogspot.com/2013/05/a-change-to-google-code-download-service.html

Probably should move the project elsewhere, ocamlforge?

Reported by ygrekheretix on 2013-05-23 07:10:56

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.