Skip to content

Commit e7d7fe3

Browse files
committed
Cleanup: convert caml_format to .res.
1 parent 88c6ba6 commit e7d7fe3

File tree

8 files changed

+60
-749
lines changed

8 files changed

+60
-749
lines changed

jscomp/runtime/caml_format.ml

Lines changed: 0 additions & 683 deletions
This file was deleted.

jscomp/runtime/caml_format.mli

Lines changed: 0 additions & 46 deletions
This file was deleted.

jscomp/runtime/caml_format.res

19 KB
Binary file not shown.

jscomp/runtime/caml_format.resi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@@ocaml.text(
2+
/* Copyright (C) 2015-2016 Bloomberg Finance L.P.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* In addition to the permissions granted to you by the LGPL, you may combine
10+
* or link a "work that uses the Library" with a publicly distributed version
11+
* of this file to produce a combined library or application, then distribute
12+
* that combined work under the terms of your choosing, with no requirement
13+
* to comply with the obligations normally placed on you by section 4 of the
14+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
15+
* should you choose to use a later version).
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU Lesser General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU Lesser General Public License
23+
* along with this program; if not, write to the Free Software
24+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25+
26+
" "
27+
)
28+
29+
let format_float: (string, float) => string
30+
31+
let hexstring_of_float: (float, int, char) => string
32+
33+
let format_int: (string, int) => string
34+
35+
let float_of_string: string => float
36+
let int64_format: (string, int64) => string
37+
let int_of_string: string => int
38+
39+
let int64_of_string: string => int64

jscomp/runtime/caml_string_extern.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ external of_small_int_array: (@as(json`null`) _, array<int>) => string = "String
5050
external length: string => int = "%string_length"
5151
external unsafe_get: (string, int) => char = "%string_unsafe_get"
5252
external unsafe_set: (bytes, int, char) => unit = "%bytes_unsafe_set"
53+
external get: (string, int) => char = "%string_unsafe_get"
5354

5455
@send external repeat: (string, int) => string = "repeat"

jscomp/runtime/release.ninja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ o runtime/caml_exceptions.cmj : cc_cmi runtime/caml_exceptions.res | runtime/cam
2525
o runtime/caml_exceptions.cmi : cc runtime/caml_exceptions.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
2626
o runtime/caml_float.cmj : cc_cmi runtime/caml_float.res | runtime/caml_float.cmi runtime/caml_float_extern.cmj
2727
o runtime/caml_float.cmi : cc runtime/caml_float.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
28-
o runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj
29-
o runtime/caml_format.cmi : cc runtime/caml_format.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
28+
o runtime/caml_format.cmj : cc_cmi runtime/caml_format.res | runtime/caml.cmj runtime/caml_float.cmj runtime/caml_float_extern.cmj runtime/caml_format.cmi runtime/caml_int64.cmj runtime/caml_int64_extern.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj
29+
o runtime/caml_format.cmi : cc runtime/caml_format.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
3030
o runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.res | runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj runtime/js.cmj
3131
o runtime/caml_hash.cmi : cc runtime/caml_hash.resi | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
3232
o runtime/caml_hash_primitive.cmj : cc_cmi runtime/caml_hash_primitive.res | runtime/caml_hash_primitive.cmi runtime/caml_string_extern.cmj

lib/es6/caml_format.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ function parse_digit(c) {
1919
} else if (c > 57 || c < 48) {
2020
return -1;
2121
} else {
22-
return c - /* '0' */48 | 0;
22+
return c - 48 | 0;
2323
}
2424
}
2525

26-
function int_of_string_base(param) {
27-
switch (param) {
26+
function int_of_string_base(x) {
27+
switch (x) {
2828
case "Oct" :
2929
return 8;
3030
case "Hex" :
@@ -274,8 +274,8 @@ function int64_of_string(s) {
274274
return or_res;
275275
}
276276

277-
function int_of_base(param) {
278-
switch (param) {
277+
function int_of_base(x) {
278+
switch (x) {
279279
case "Oct" :
280280
return 8;
281281
case "Hex" :
@@ -413,10 +413,10 @@ function parse_format(fmt) {
413413
f.prec = 0;
414414
let j = i + 1 | 0;
415415
while((function () {
416-
let w = fmt.codePointAt(j) - /* '0' */48 | 0;
416+
let w = fmt.codePointAt(j) - 48 | 0;
417417
return w >= 0 && w <= 9;
418418
})()) {
419-
f.prec = (Math.imul(f.prec, 10) + fmt.codePointAt(j) | 0) - /* '0' */48 | 0;
419+
f.prec = (Math.imul(f.prec, 10) + fmt.codePointAt(j) | 0) - 48 | 0;
420420
j = j + 1 | 0;
421421
};
422422
_i = j;
@@ -452,10 +452,10 @@ function parse_format(fmt) {
452452
f.width = 0;
453453
let j$1 = i;
454454
while((function () {
455-
let w = fmt.codePointAt(j$1) - /* '0' */48 | 0;
455+
let w = fmt.codePointAt(j$1) - 48 | 0;
456456
return w >= 0 && w <= 9;
457457
})()) {
458-
f.width = (Math.imul(f.width, 10) + fmt.codePointAt(j$1) | 0) - /* '0' */48 | 0;
458+
f.width = (Math.imul(f.width, 10) + fmt.codePointAt(j$1) | 0) - 48 | 0;
459459
j$1 = j$1 + 1 | 0;
460460
};
461461
_i = j$1;

lib/js/caml_format.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ function parse_digit(c) {
1919
} else if (c > 57 || c < 48) {
2020
return -1;
2121
} else {
22-
return c - /* '0' */48 | 0;
22+
return c - 48 | 0;
2323
}
2424
}
2525

26-
function int_of_string_base(param) {
27-
switch (param) {
26+
function int_of_string_base(x) {
27+
switch (x) {
2828
case "Oct" :
2929
return 8;
3030
case "Hex" :
@@ -274,8 +274,8 @@ function int64_of_string(s) {
274274
return or_res;
275275
}
276276

277-
function int_of_base(param) {
278-
switch (param) {
277+
function int_of_base(x) {
278+
switch (x) {
279279
case "Oct" :
280280
return 8;
281281
case "Hex" :
@@ -413,10 +413,10 @@ function parse_format(fmt) {
413413
f.prec = 0;
414414
let j = i + 1 | 0;
415415
while((function () {
416-
let w = fmt.codePointAt(j) - /* '0' */48 | 0;
416+
let w = fmt.codePointAt(j) - 48 | 0;
417417
return w >= 0 && w <= 9;
418418
})()) {
419-
f.prec = (Math.imul(f.prec, 10) + fmt.codePointAt(j) | 0) - /* '0' */48 | 0;
419+
f.prec = (Math.imul(f.prec, 10) + fmt.codePointAt(j) | 0) - 48 | 0;
420420
j = j + 1 | 0;
421421
};
422422
_i = j;
@@ -452,10 +452,10 @@ function parse_format(fmt) {
452452
f.width = 0;
453453
let j$1 = i;
454454
while((function () {
455-
let w = fmt.codePointAt(j$1) - /* '0' */48 | 0;
455+
let w = fmt.codePointAt(j$1) - 48 | 0;
456456
return w >= 0 && w <= 9;
457457
})()) {
458-
f.width = (Math.imul(f.width, 10) + fmt.codePointAt(j$1) | 0) - /* '0' */48 | 0;
458+
f.width = (Math.imul(f.width, 10) + fmt.codePointAt(j$1) | 0) - 48 | 0;
459459
j$1 = j$1 + 1 | 0;
460460
};
461461
_i = j$1;

0 commit comments

Comments
 (0)