diff --git a/src/core/CCAtomic.ml b/src/core/CCAtomic.ml index 3cbe1206..dbdc8061 100644 --- a/src/core/CCAtomic.ml +++ b/src/core/CCAtomic.ml @@ -1,10 +1,10 @@ -[%IFGE 4.12] +[@@@ifge 4.12] include Atomic -[%ELSE] +[@@@else_] open CCShims_.Stdlib (* for == *) @@ -32,4 +32,4 @@ let[@inline] incr r = r.x <- 1 + r.x let[@inline] decr r = r.x <- r.x - 1 -[%ENDIF] +[@@@endif] diff --git a/src/core/CCFun.ml b/src/core/CCFun.ml index 7bfab01e..9424c667 100644 --- a/src/core/CCFun.ml +++ b/src/core/CCFun.ml @@ -10,11 +10,11 @@ let opaque_identity x = x include Sys include CCShims_.Stdlib -[%IFGE 4.8] +[@@@ifge 4.8] include Fun -[%ELSE] +[@@@else_] external id : 'a -> 'a = "%identity" let[@inline] flip f x y = f y x @@ -29,7 +29,7 @@ let[@inline] protect ~finally f = finally(); raise e -[%ENDIF] +[@@@endif] let compose f g x = g (f x) diff --git a/src/core/CCFun.mli b/src/core/CCFun.mli index 8bda13b7..4ba8fb2f 100644 --- a/src/core/CCFun.mli +++ b/src/core/CCFun.mli @@ -3,11 +3,12 @@ (** Basic operations on Functions *) -[%IFGE 4.8] +[@@@ifge 4.8] include module type of Fun (** @inline *) -[%ELSE] +[@@@else_] + (** This is an API imitating the new standard Fun module *) external id : 'a -> 'a = "%identity" val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c @@ -17,7 +18,8 @@ val negate : ('a -> bool) -> 'a -> bool val protect : finally:(unit -> unit) -> (unit -> 'a) -> 'a (* this doesn't have the exact same semantics as the stdlib's finally. It will not attempt to catch exceptions raised from [finally] at all. *) -[%ENDIF] + +[@@@endif] val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c (** [compose f g x] is [g (f x)]. Composition. *) diff --git a/src/core/cpp/cpp.ml b/src/core/cpp/cpp.ml index 0066c17d..914aa02b 100644 --- a/src/core/cpp/cpp.ml +++ b/src/core/cpp/cpp.ml @@ -42,16 +42,16 @@ let preproc_lines ~file ~major ~minor (ic:in_channel) : unit = | exception End_of_file -> Eof | line -> incr pos; - if prefix line ~pre:"[%IFLE" then - Scanf.sscanf line "[%%IFLE %d.%d]" (fun x y -> If(Le,x,y)) - else if prefix line ~pre:"[%IFGE" then - Scanf.sscanf line "[%%IFGE %d.%d]" (fun x y -> If(Ge,x,y)) - else if prefix line ~pre:"[%ELIFLE" then - Scanf.sscanf line "[%%ELIFLE %d.%d]" (fun x y -> Elseif(Le,x,y)) - else if prefix line ~pre:"[%ELIFGE" then - Scanf.sscanf line "[%%ELIFGE %d.%d]" (fun x y -> Elseif(Ge,x,y)) - else if line="[%ELSE]" then Else - else if line="[%ENDIF]" then Endif + if prefix line ~pre:"[@@@ifle" then + Scanf.sscanf line "[@@@ifle %d.%d]" (fun x y -> If(Le,x,y)) + else if prefix line ~pre:"[@@@ifge" then + Scanf.sscanf line "[@@@ifge %d.%d]" (fun x y -> If(Ge,x,y)) + else if prefix line ~pre:"[@@@elifle" then + Scanf.sscanf line "[@@@elifle %d.%d]" (fun x y -> Elseif(Le,x,y)) + else if prefix line ~pre:"[@@@elifge" then + Scanf.sscanf line "[@@@elifge %d.%d]" (fun x y -> Elseif(Ge,x,y)) + else if line="[@@@else_]" then Else + else if line="[@@@endif]" then Endif else Raw line in