Skip to content
This repository
tag: v1199
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 99 lines (74 sloc) 2.759 kb
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA 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 Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)

(*
GUIDELINES FOR BASE : CF MLI
*)


type ('a,'b) either = Left of 'a | Right of 'b

let copyright = "(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA 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 Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
"

let is_windows = Sys.os_type = "Win32"

let failwithf fmt = Printf.ksprintf failwith fmt
let invalid_argf fmt = Printf.ksprintf invalid_arg fmt

(* *)
let debug_getenv _ dflt = dflt
let debug_getenv_toggle _ = false

let crlf = "\r\n"
external identity : 'a -> 'a = "%identity"
let intmax (a:int) b = if a > b then a else b
let intmin (a:int) b = if a < b then a else b
let compare_int (a:int) b = Pervasives.compare a b
external format_float: string -> float -> string = "caml_format_float"
(* string_of_float should be optimized ! *)

let int_of_string_opt s =
  try Some (int_of_string s) with Failure "int_of_string" -> None

let max3 a b = max (max a b)

(** arrondi à n *)
let round n v =
  let p = 10. ** (float_of_int n) in
  let vp = v *. p in
  let ce = ceil vp
  and fl = floor vp in
  (if ce -. vp < vp -. fl then ce else fl) /. p



exception NotImplemented of string
exception ParseError


(* ======================== *)

(* alphabetic order *)
module Arg = BaseArg
module Array = BaseArray
module Char = BaseChar
module Filename = BaseFilename
module Format = BaseFormat
module Hashtbl = BaseHashtbl
module Int64 = BaseInt64
module Lazy = BaseLazy
module List = BaseList
module Map = BaseMap
module Marshal = BaseMarshal
module Obj = BaseObj
module Random = BaseRandom
module Set = BaseSet
module String = BaseString
module Utf8 = BaseUtf8
Something went wrong with that request. Please try again.