Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 99 lines (74 sloc) 2.759 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (*
20 GUIDELINES FOR BASE : CF MLI
21 *)
22
23
24 type ('a,'b) either = Left of 'a | Right of 'b
25
26 let copyright = "(*
27 Copyright © 2011 MLstate
28
29 This file is part of OPA.
30
31 OPA is free software: you can redistribute it and/or modify it under the
32 terms of the GNU Affero General Public License, version 3, as published by
33 the Free Software Foundation.
34
35 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
36 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
37 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
38 more details.
39
40 You should have received a copy of the GNU Affero General Public License
41 along with OPA. If not, see <http://www.gnu.org/licenses/>.
42 *)
43 "
44
45 let is_windows = Sys.os_type = "Win32"
46
47 let failwithf fmt = Printf.ksprintf failwith fmt
48 let invalid_argf fmt = Printf.ksprintf invalid_arg fmt
49
50 (* *)
51 let debug_getenv _ dflt = dflt
52 let debug_getenv_toggle _ = false
53
54 let crlf = "\r\n"
55 external identity : 'a -> 'a = "%identity"
56 let intmax (a:int) b = if a > b then a else b
57 let intmin (a:int) b = if a < b then a else b
58 let compare_int (a:int) b = Pervasives.compare a b
59 external format_float: string -> float -> string = "caml_format_float"
60 (* string_of_float should be optimized ! *)
61
62 let int_of_string_opt s =
63 try Some (int_of_string s) with Failure "int_of_string" -> None
64
65 let max3 a b = max (max a b)
66
67 (** arrondi à n *)
68 let round n v =
69 let p = 10. ** (float_of_int n) in
70 let vp = v *. p in
71 let ce = ceil vp
72 and fl = floor vp in
73 (if ce -. vp < vp -. fl then ce else fl) /. p
74
75
76
77 exception NotImplemented of string
78 exception ParseError
79
80
81 (* ======================== *)
82
83 (* alphabetic order *)
84 module Arg = BaseArg
85 module Array = BaseArray
86 module Char = BaseChar
87 module Filename = BaseFilename
88 module Format = BaseFormat
89 module Hashtbl = BaseHashtbl
90 module Int64 = BaseInt64
91 module Lazy = BaseLazy
92 module List = BaseList
93 module Map = BaseMap
94 module Marshal = BaseMarshal
95 module Obj = BaseObj
96 module Random = BaseRandom
97 module Set = BaseSet
98 module String = BaseString
debb5ea [cleanup] Base: remove error
Raja authored
99 module Utf8 = BaseUtf8
Something went wrong with that request. Please try again.