Skip to content

Commit

Permalink
Update ocamlformat to 0.27.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
  • Loading branch information
smorimoto committed Dec 24, 2024
1 parent 14c5f9e commit 78fb608
Show file tree
Hide file tree
Showing 52 changed files with 367 additions and 233 deletions.
65 changes: 33 additions & 32 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
version=0.26.2
break-cases = fit
break-collection-expressions = fit-or-vertical
break-fun-decl = wrap
break-fun-sig = wrap
break-infix = wrap
break-infix-before-func = false
break-sequences = false
break-separators = before
break-string-literals = never
break-struct = force
cases-matching-exp-indent = compact
doc-comments = after-when-possible
dock-collection-brackets = false
indicate-multiline-delimiters = no
infix-precedence = indent
let-and = compact
let-binding-spacing = compact
module-item-spacing = compact
parens-tuple = multi-line-only
parens-tuple-patterns = multi-line-only
sequence-style = terminator
sequence-blank-line = compact
single-case = compact
type-decl = compact
if-then-else = keyword-first
field-space = loose
space-around-arrays = false
space-around-records = false
space-around-lists = false
space-around-variants = false
ocp-indent-compat = true
version=0.27.0
break-cases=fit
break-collection-expressions=fit-or-vertical
break-fun-decl=wrap
break-fun-sig=wrap
break-infix-before-func=false
break-infix=wrap
break-separators=before
break-sequences=false
break-string-literals=never
break-struct=force
cases-matching-exp-indent=compact
doc-comments=after-when-possible
dock-collection-brackets=false
field-space=loose
if-then-else=keyword-first
indicate-multiline-delimiters=no
infix-precedence=indent
let-and=compact
let-binding-spacing=compact
module-item-spacing=compact
ocp-indent-compat=true
parens-tuple-patterns=multi-line-only
parens-tuple=multi-line-only
parse-docstrings=false
sequence-blank-line=compact
sequence-style=terminator
single-case=compact
space-around-arrays=false
space-around-lists=false
space-around-records=false
space-around-variants=false
type-decl=compact
2 changes: 1 addition & 1 deletion src/baselib/dynlink_wrapper.natdynlink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

open Dynlink

Expand Down
2 changes: 1 addition & 1 deletion src/baselib/dynlink_wrapper.nonatdynlink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

exception Error of string

Expand Down
8 changes: 4 additions & 4 deletions src/baselib/ocsigen_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)
(**
Cache.
Expand Down Expand Up @@ -124,9 +124,9 @@ end = struct
; mutable maxsize : int
; mutable finaliser_before : 'a node -> unit
; mutable finaliser_after : 'a node -> unit
; (* *) time_bound : time_bound option }
; time_bound : time_bound option }

and time_bound = {(* *) timer : float; mutable collector : unit Lwt.t option}
and time_bound = {timer : float; mutable collector : unit Lwt.t option}

(* Checks (by BY):
Expand Down Expand Up @@ -435,7 +435,7 @@ functor
; mutable table : (A.value * A.key Dlist.node) H.t
; finder : A.key -> A.value Lwt.t
; clear : unit -> unit
(* This function clears the cache. It is put inside the
(* This function clears the cache. It is put inside the
cache structure so that it is garbage-collected only when the cache
is no longer referenced, as the functions themselves are put inside
a weak hash table *)
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/ocsigen_cache.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(**
Cache.
Expand Down
8 changes: 4 additions & 4 deletions src/baselib/ocsigen_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

include Ocsigen_lib_base
module String = String_base
Expand Down Expand Up @@ -69,8 +69,9 @@ module Filename = struct
then String.sub filename (pos + 1) (String.length filename - pos - 1)
else (* Dot before a directory separator *)
raise Not_found
with Not_found -> (* No dot in filename *)
raise Not_found
with Not_found ->
(* No dot in filename *)
raise Not_found
end

(*****************************************************************************)
Expand Down Expand Up @@ -399,7 +400,6 @@ module Url = struct
https, host, port, path, query
in
(* Note that the fragment (string after #) is not sent by browsers *)

(*20110707 ' ' is encoded to '+' in queries, but not in paths.
Warning: if we write the URL manually, we must encode ' ' to '+' manually
(not done by the browser).
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/ocsigen_lib.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(** This module contains some auxiliaries for the Ocsigenserver. In contrast to
{!Ocsigen_lib_base}, the function may also refer to libraries other than the
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/ocsigen_lib_base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

exception Ocsigen_Internal_Error of string
exception Input_is_too_large
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/ocsigen_lib_base.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(** This module just contains only extensions of the standard library and very
basic Ocsigen values and exceptions. Cf. {!Ocsigen_lib} for functionality
Expand Down
23 changes: 12 additions & 11 deletions src/baselib/ocsigen_loader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

open Ocsigen_lib

Expand All @@ -33,18 +33,19 @@ let translate =
if Ocsigen_config_static.is_native
then
fun filename ->
if Filename.check_suffix filename ".cmo"
|| Filename.check_suffix filename ".cma"
then Filename.chop_extension filename ^ ".cmxs"
else filename
if
Filename.check_suffix filename ".cmo"
|| Filename.check_suffix filename ".cma"
then Filename.chop_extension filename ^ ".cmxs"
else filename
else
fun filename ->
if Filename.check_suffix filename ".cmxs"
then
let filename = Filename.chop_extension filename in
let cma = filename ^ ".cma" in
if Sys.file_exists cma then cma else filename ^ ".cmo"
else filename
if Filename.check_suffix filename ".cmxs"
then
let filename = Filename.chop_extension filename in
let cma = filename ^ ".cma" in
if Sys.file_exists cma then cma else filename ^ ".cmo"
else filename

(************************************************************************)
(* Loading files *)
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/ocsigen_loader.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(** Module [Ocsigen_loader]: Dynamic loading for Ocsigen. *)

Expand Down
4 changes: 2 additions & 2 deletions src/baselib/ocsigen_stream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

open Ocsigen_lib

Expand Down Expand Up @@ -154,7 +154,7 @@ let rec stream_want s len =
Lwt.catch
(fun () -> enlarge_stream s >>= fun r -> Lwt.return (`OK r))
(function
| Stream_too_small -> Lwt.return `Too_small | e -> Lwt.fail e)
| Stream_too_small -> Lwt.return `Too_small | e -> Lwt.fail e)
>>= function
| `OK r -> stream_want r len
| `Too_small -> Lwt.return s)
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/ocsigen_stream.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

exception Interrupted of exn
exception Cancelled
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/polytables/polytables.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)
(**
@author Vincent Balat
@author Jérôme Vouillon
Expand Down
2 changes: 1 addition & 1 deletion src/baselib/polytables/polytables.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)
(**
Polymorphic tables (using Map)
@author Vincent Balat
Expand Down
20 changes: 11 additions & 9 deletions src/extensions/accesscontrol.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(* Filtering requests via the configuration file *)

Expand Down Expand Up @@ -368,10 +368,11 @@ let parse_config parse_fun = function
| Ocsigen_extensions.Req_found (_, r) ->
Lwt.return (Ocsigen_extensions.Ext_found (fun () -> Lwt.return r))
| Ocsigen_extensions.Req_not_found (err, _ri) ->
if let err =
string_of_int Cohttp.Code.(code_of_status (err :> status_code))
in
Netstring_pcre.string_match re err 0 <> None
if
let err =
string_of_int Cohttp.Code.(code_of_status (err :> status_code))
in
Netstring_pcre.string_match re err 0 <> None
then Lwt.return (Ocsigen_extensions.Ext_sub_result ext)
else Lwt.return (Ocsigen_extensions.Ext_next err))
| Element (("ifnotfound" as s), _, _) ->
Expand Down Expand Up @@ -433,10 +434,11 @@ let ifnotfound ?code instrs vh ci p =
(Ocsigen_extensions.Ext_sub_result
(Ocsigen_extensions.compose (List.map (fun i -> i vh ci p) instrs)))
| Some re ->
if let err =
string_of_int Cohttp.Code.(code_of_status (err :> status_code))
in
Netstring_pcre.string_match re err 0 <> None
if
let err =
string_of_int Cohttp.Code.(code_of_status (err :> status_code))
in
Netstring_pcre.string_match re err 0 <> None
then
Lwt.return
(Ocsigen_extensions.Ext_sub_result
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/accesscontrol.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(** Accesscontrol: Conditional access to some sites *)

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/authbasic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

open Lwt.Infix

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/authbasic.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(** Authbasic: Basic HTTP authentication *)

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/cors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(** Handle Cross-Origin Resource Sharing (CORS) headers *)

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/deflatemod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(* Compress output sent by the server *)

Expand Down
13 changes: 10 additions & 3 deletions src/extensions/extendconfiguration.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

let name = "extendconfiguration"
let bad_config s = raise (Ocsigen_extensions.Error_in_config_file s)
Expand Down Expand Up @@ -275,8 +275,15 @@ let defaultindex v _ _ _ =
gen @@ fun config ->
{config with Ocsigen_extensions.default_directory_index = v}

let contenttype ?default ?(files = []) ?(extensions = []) ?(regexps = []) () _ _
_
let contenttype
?default
?(files = [])
?(extensions = [])
?(regexps = [])
()
_
_
_
=
gen @@ fun config ->
let mime_assoc = config.Ocsigen_extensions.mime_assoc in
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/outputfilter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
*)

(* This module enables rewritting the server output *)

Expand Down
Loading

0 comments on commit 78fb608

Please sign in to comment.