Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POTTIER Francois
menhir
Commits
b89f947e
Commit
b89f947e
authored
Mar 03, 2016
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid [String.capitalize] in [myocamlbuild.ml].
parent
9d91d799
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
2 deletions
+55
-2
src/myocamlbuild.ml
src/myocamlbuild.ml
+55
-2
No files found.
src/myocamlbuild.ml
View file @
b89f947e
open
Ocamlbuild_plugin
open
Command
(* ---------------------------------------------------------------------------- *)
(* This compatibility layer allows us to support both OCaml 4.02 and 4.03, with
deprecation errors activated. We define our own copies of certain 4.03
functions. *)
module
Compatibility
=
struct
module
Char
=
struct
let
lowercase_ascii
c
=
if
(
c
>=
'
A'
&&
c
<=
'
Z'
)
then
Char
.
chr
(
Char
.
code
c
+
32
)
else
c
let
uppercase_ascii
c
=
if
(
c
>=
'
a'
&&
c
<=
'
z'
)
then
Char
.
chr
(
Char
.
code
c
-
32
)
else
c
end
module
Bytes
=
struct
include
Bytes
let
apply1
f
s
=
if
Bytes
.
length
s
=
0
then
s
else
begin
let
r
=
Bytes
.
copy
s
in
Bytes
.
unsafe_set
r
0
(
f
(
Bytes
.
unsafe_get
s
0
));
r
end
let
capitalize_ascii
s
=
apply1
Char
.
uppercase_ascii
s
let
uncapitalize_ascii
s
=
apply1
Char
.
lowercase_ascii
s
end
module
String
=
struct
let
capitalize_ascii
s
=
Bytes
.
unsafe_to_string
(
Bytes
.
capitalize_ascii
(
Bytes
.
unsafe_of_string
s
))
let
uncapitalize_ascii
s
=
Bytes
.
unsafe_to_string
(
Bytes
.
uncapitalize_ascii
(
Bytes
.
unsafe_of_string
s
))
end
end
(* ---------------------------------------------------------------------------- *)
(* The following rules can be copied into other projects. *)
(* ---------------------------------------------------------------------------- *)
...
...
@@ -42,7 +95,7 @@ let noncomment s =
let
cmx
(
m
:
string
)
:
string
=
let
candidate
=
m
^
".cmx"
in
if
Sys
.
file_exists
(
m
^
".ml"
)
then
candidate
else
String
.
uncapitalize
candidate
if
Sys
.
file_exists
(
m
^
".ml"
)
then
candidate
else
Compatibility
.
String
.
uncapitalize_ascii
candidate
(* ---------------------------------------------------------------------------- *)
...
...
@@ -56,7 +109,7 @@ let cmx (m : string) : string =
let
for_pack
(
basename
:
string
)
=
let
filename
=
basename
^
".mlpack"
in
let
modules
=
List
.
filter
noncomment
(
lines
filename
)
in
let
library
=
String
.
capitalize
basename
in
let
library
=
Compatibility
.
String
.
capitalize_ascii
basename
in
let
tags
=
[
Printf
.
sprintf
"for-pack(%s)"
library
]
in
List
.
iter
(
fun
m
->
tag_file
(
cmx
m
)
tags
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment