summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2014-04-30 14:22:27 +0000
committerFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2014-04-30 14:22:27 +0000
commita72d304fa42711bbe8fede17c00b455c65c6f1c3 (patch)
treea114f8ee8ee379db2bc2f031a7f623336df6c2c8
parentb791d666d824cf3dff297cf4e25bca1bde3a3109 (diff)
document __LOC__ in pervasives.mli
Also removes __FILE_OF__ and __MODULE_OF__, since they are not more precise than __FILE__ and __MODULE__ git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14715 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--otherlibs/threads/pervasives.ml2
-rw-r--r--stdlib/pervasives.ml2
-rw-r--r--stdlib/pervasives.mli29
3 files changed, 27 insertions, 6 deletions
diff --git a/otherlibs/threads/pervasives.ml b/otherlibs/threads/pervasives.ml
index 5e5524094..376d23032 100644
--- a/otherlibs/threads/pervasives.ml
+++ b/otherlibs/threads/pervasives.ml
@@ -50,9 +50,7 @@ external __MODULE__ : string = "%loc_MODULE"
external __POS__ : string * int * int * int = "%loc_POS"
external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC"
-external __FILE_OF__ : 'a -> string * 'a = "%loc_FILE"
external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE"
-external __MODULE_OF__ : 'a -> string * 'a = "%loc_MODULE"
external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS"
(* Comparisons *)
diff --git a/stdlib/pervasives.ml b/stdlib/pervasives.ml
index 979f691f8..8fc04fb2c 100644
--- a/stdlib/pervasives.ml
+++ b/stdlib/pervasives.ml
@@ -46,9 +46,7 @@ external __MODULE__ : string = "%loc_MODULE"
external __POS__ : string * int * int * int = "%loc_POS"
external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC"
-external __FILE_OF__ : 'a -> string * 'a = "%loc_FILE"
external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE"
-external __MODULE_OF__ : 'a -> string * 'a = "%loc_MODULE"
external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS"
(* Comparisons *)
diff --git a/stdlib/pervasives.mli b/stdlib/pervasives.mli
index 3ec9c8c9a..37c593a82 100644
--- a/stdlib/pervasives.mli
+++ b/stdlib/pervasives.mli
@@ -143,16 +143,41 @@ external ( or ) : bool -> bool -> bool = "%sequor"
(** {6 Debugging} *)
external __LOC__ : string = "%loc_LOC"
+(** [__LOC__] returns the location at which this expression appears in
+ the file currently being parsed by the compiler, with the standard
+ error format of OCaml: "File %S, line %d, characters %d-%d" *)
external __FILE__ : string = "%loc_FILE"
+(** [__FILE__] returns the name of the file currently being
+ parsed by the compiler. *)
external __LINE__ : int = "%loc_LINE"
+(** [__LINE__] returns the line number at which this expression
+ appears in the file currently being parsed by the compiler. *)
external __MODULE__ : string = "%loc_MODULE"
+(** [__MODULE__] returns the module name of the file being
+ parsed by the compiler. *)
external __POS__ : string * int * int * int = "%loc_POS"
+(** [__POS__] returns a tuple [(file,lnum,cnum,enum)], corresponding
+ to the location at which this expression appears in the file
+ currently being parsed by the compiler. [file] is the current
+ filename, [lnum] the line number, [cnum] the character position in
+ the line and [enum] the last character position in the line. *)
external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC"
-external __FILE_OF__ : 'a -> string * 'a = "%loc_FILE"
+(** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the
+ location of [expr] in the file currently being parsed by the
+ compiler, with the standard error format of OCaml: "File %S, line
+ %d, characters %d-%d" *)
external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE"
-external __MODULE_OF__ : 'a -> string * 'a = "%loc_MODULE"
+(** [__LINE__ expr] returns a pair [(line, expr)], where [line] is the
+ line number at which the expression [expr] appears in the file
+ currently being parsed by the compiler. *)
external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS"
+(** [__POS_OF__ expr] returns a pair [(expr,loc)], where [loc] is a
+ tuple [(file,lnum,cnum,enum)] corresponding to the location at
+ which the expression [expr] appears in the file currently being
+ parsed by the compiler. [file] is the current filename, [lnum] the
+ line number, [cnum] the character position in the line and [enum]
+ the last character position in the line. *)
(** {6 Composition operators} *)