Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ocamlformat to 0.27.0 #250

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
47 changes: 26 additions & 21 deletions src/baselib/dune
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
(library
(name ocsigen_lib_base)
(public_name ocsigenserver.baselib.base)
(flags (:standard -no-keep-locs))
(modules ocsigen_lib_base)
(libraries lwt))
(name ocsigen_lib_base)
(public_name ocsigenserver.baselib.base)
(flags
(:standard -no-keep-locs))
(modules ocsigen_lib_base)
(libraries lwt))

(library
(name baselib)
(public_name ocsigenserver.baselib)
(wrapped false)
(flags (:standard -no-keep-locs))
(modules
dynlink_wrapper
ocsigen_cache
ocsigen_config_static
ocsigen_lib
ocsigen_loader
ocsigen_stream)
(libraries
str findlib lwt_log lwt.unix cryptokit re ocsigen_lib_base
(select dynlink_wrapper.ml from
(dynlink -> dynlink_wrapper.natdynlink.ml)
(_ -> dynlink_wrapper.nonatdynlink.ml))))
(name baselib)
(public_name ocsigenserver.baselib)
(wrapped false)
(flags
(:standard -no-keep-locs))
(modules dynlink_wrapper ocsigen_cache ocsigen_config_static ocsigen_lib
ocsigen_loader ocsigen_stream)
(libraries
str
findlib
lwt_log
lwt.unix
cryptokit
re
ocsigen_lib_base
(select
dynlink_wrapper.ml
from
(dynlink -> dynlink_wrapper.natdynlink.ml)
(_ -> dynlink_wrapper.nonatdynlink.ml))))
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
4 changes: 2 additions & 2 deletions src/baselib/polytables/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(library
(name polytables)
(public_name ocsigenserver.polytables))
(name polytables)
(public_name ocsigenserver.polytables))
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
14 changes: 8 additions & 6 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
(executable
(name ocsigenserver)
(public_name ocsigenserver.opt)
(link_flags (:standard -linkall))
(libraries dynlink ocsigenserver)
(modes exe byte))
(name ocsigenserver)
(public_name ocsigenserver.opt)
(link_flags
(:standard -linkall))
(libraries dynlink ocsigenserver)
(modes exe byte))

(install
(files (ocsigenserver.bc as ocsigenserver))
(files
(ocsigenserver.bc as ocsigenserver))
(section bin)
(package ocsigenserver))
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
Loading
Loading