Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 133 lines (97 sloc) 3.791 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 MLstate common utils.
21 @author everybody\@mlstate
22 *)
23
24 (** {6 Guidelines} *)
25
26 (**
27 Top level :
28
29 Base contains at top-level all functions that we feel missing in Ocaml Stdlib Pervasives.
30
31 Keep in mide that people does 'open Base', so be kind with your collegues
32 Do not put in base thinks like :
33
34 {[let print_endline _ = Sys.command "rm -rf $HOME"]}
35
36 Modules :
37
38 We use Base to redefine some module when they have an implementation
39 in Ocaml stdlib, to avoid module name conflicts.
40
41 Be carrefull, note that the ocaml manual does not say what happen in case of :
42 {[
43 open Base
44 (* use module List e.g. *)
45 ]}
46 So, use [include] in your module, but
47 DO NOT CHANGE THE IMPLEMENTATION OF AN EXISTING OCAML STDLIB FUNCTION
48
49 You should DOCUMENT and ORGANIZE your code : base.mli
50
51 If your module is not implemented in Ocaml stdlib, then
52 DO NOT PUT IN BASE A MODULE IN THIS CASE.
53 You should put it in a new file, with its own mli.
54
55 This last point is not yet respected in base, this is until we clean this up.
56 Any time soon, Base will no longuer be a Bad Big Blob.
57
58 Updating, adding code :
59
60 If the module has a unit test in reftester, please update it, and add complete
61 tests for your new modules and functions.
62
63 Thanks !
64 *)
65
66 (** *)
67
68 (** {6 Pervasives type definitions} *)
69 type ('a,'b) either = Left of 'a | Right of 'b
70
71 (** {6 Meta values} *)
72 (** *)
73
74 val copyright : string
75
76 val is_windows : bool
77
78 (** {6 Miscellaneous} *)
79
80 external identity : 'a -> 'a = "%identity"
81 val intmax : int -> int -> int
82 val intmin : int -> int -> int
83 val compare_int : int -> int -> int
84 external format_float : string -> float -> string = "caml_format_float"
85 val int_of_string_opt : string -> int option
86 val max3 : 'a -> 'a -> 'a -> 'a
87
88 (** round a float with precision [10^(-i)] *)
89 val round : int -> float -> float
90
91 (** windows stuff : \\r\\n *)
92 val crlf : string
93
94 (** same as [failwith (Printf.sprintf ...)] *)
95 val failwithf : ('params,unit,string,'exn) format4 -> 'params
96 (** same as [invalid_arg (Printf.sprintf ...)] *)
97 val invalid_argf : ('params,unit,string,'exn) format4 -> 'params
98
99
100 (** {6 Debug Get Env} *)
101
102 (**
103 Deprecated, and not working function (dummy implementation).
104 Please use pp-debug.
105 @see "DebugVariables" for a documentation of pp-debug.
106 *)
107 (** *)
108 val debug_getenv: string -> string -> string
109 val debug_getenv_toggle: string -> bool
110
111 exception NotImplemented of string
112
113 (** /!\ Unused *)
114 exception ParseError
115
116 (* alphabetic order *)
117 module Arg : module type of BaseArg
118 module Array : module type of BaseArray
119 module Char : module type of BaseChar
120 module Filename : module type of BaseFilename
121 module Format : module type of BaseFormat
122 module Hashtbl : module type of BaseHashtbl
123 module Int64 : module type of BaseInt64
124 module Lazy : module type of BaseLazy
125 module List : module type of BaseList
126 module Map : module type of BaseMap
127 module Marshal : module type of BaseMarshal
128 module Obj : module type of BaseObj
129 module Random : module type of BaseRandom
130 module Set : module type of BaseSet
131 module String : module type of BaseString
132 module Utf8 : module type of BaseUtf8
Something went wrong with that request. Please try again.