package iter

  1. Overview
  2. Docs

Install

Dune Dependency

Authors

Maintainers

Sources

1.2.1.tar.gz
md5=76f805c96d10f2649dd5c65b28052a82
sha512=f4c71a62fb2350e2cac78acf07abeb67c206f487101aa189b545e91a154d936cbe59092b6557ea516108b2faeabd034640d61450e99a2e930bd7559a6eee2675

doc/src/iter.bigarray/IterBigarray.ml.html

Source file IterBigarray.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

(* This file is free software, part of iter. See file "license" for more details. *)

(** {1 Interface and Helpers for bigarrays} *)

open! IterBigarrayShims_

let of_bigarray b yield =
  let len = Bigarray.Array1.dim b in
  for i=0 to len-1 do
    yield b.{i}
  done

let mmap filename =
  fun yield ->
    let fd = Unix.openfile filename [Unix.O_RDONLY] 0 in
    let len = Unix.lseek fd 0 Unix.SEEK_END in
    let _ = Unix.lseek fd 0 Unix.SEEK_SET in
    let b = bigarray_map_file fd Bigarray.char Bigarray.c_layout false len in
    try
      of_bigarray b yield;
      Unix.close fd
    with e ->
      Unix.close fd;
      raise e
[@@ocaml.warning "-3"]
OCaml

Innovation. Community. Security.