Skip to content

clean up interfaces in caml_format, rename Js_fn into Fn #264

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

Merged
merged 1 commit into from
Apr 18, 2016
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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion jscomp/lib/lib.mllib
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ js
bench
# dom
js_date
js_fn
fn
xmlHTTPRequest
13 changes: 4 additions & 9 deletions jscomp/runtime/.depend
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
caml_array.cmi :
caml_bigarray.cmi :
caml_builtin_exceptions.cmi :
caml_exceptions.cmi :
caml_float.cmi :
caml_format.cmi :
caml_int64.cmi :
Expand All @@ -22,8 +21,6 @@ caml_builtin_exceptions.cmo : caml_builtin_exceptions.cmi
caml_builtin_exceptions.cmx : caml_builtin_exceptions.cmi
caml_curry.cmo : js.cmo caml_oo.cmi
caml_curry.cmx : js.cmx caml_oo.cmx
caml_exceptions.cmo : caml_exceptions.cmi
caml_exceptions.cmx : caml_exceptions.cmi
caml_float.cmo : typed_array.cmo js.cmo caml_float.cmi
caml_float.cmx : typed_array.cmx js.cmx caml_float.cmi
caml_format.cmo : js.cmo caml_utils.cmi caml_format.cmi
Expand All @@ -50,12 +47,12 @@ caml_sys.cmo : js.cmo caml_sys.cmi
caml_sys.cmx : js.cmx caml_sys.cmi
caml_utils.cmo : caml_utils.cmi
caml_utils.cmx : caml_utils.cmi
fn.cmo :
fn.cmx :
js.cmo :
js.cmx :
js_error.cmo :
js_error.cmx :
js_fn.cmo :
js_fn.cmx :
typed_array.cmo :
typed_array.cmx :
caml_array.cmo : js.cmo caml_array.cmi
Expand All @@ -66,8 +63,6 @@ caml_builtin_exceptions.cmo : caml_builtin_exceptions.cmi
caml_builtin_exceptions.cmj : caml_builtin_exceptions.cmi
caml_curry.cmo : js.cmo caml_oo.cmi
caml_curry.cmj : js.cmj caml_oo.cmj
caml_exceptions.cmo : caml_exceptions.cmi
caml_exceptions.cmj : caml_exceptions.cmi
caml_float.cmo : typed_array.cmo js.cmo caml_float.cmi
caml_float.cmj : typed_array.cmj js.cmj caml_float.cmi
caml_format.cmo : js.cmo caml_utils.cmi caml_format.cmi
Expand All @@ -94,11 +89,11 @@ caml_sys.cmo : js.cmo caml_sys.cmi
caml_sys.cmj : js.cmj caml_sys.cmi
caml_utils.cmo : caml_utils.cmi
caml_utils.cmj : caml_utils.cmi
fn.cmo :
fn.cmj :
js.cmo :
js.cmj :
js_error.cmo :
js_error.cmj :
js_fn.cmo :
js_fn.cmj :
typed_array.cmo :
typed_array.cmj :
40 changes: 0 additions & 40 deletions jscomp/runtime/caml_exceptions.ml

This file was deleted.

34 changes: 0 additions & 34 deletions jscomp/runtime/caml_exceptions.mli

This file was deleted.

34 changes: 7 additions & 27 deletions jscomp/runtime/caml_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var Caml_int64 = require("./caml_int64");
var Caml_builtin_exceptions = require("./caml_builtin_exceptions");
var Caml_primitive = require("./caml_primitive");
var Caml_utils = require("./caml_utils");
var Caml_curry = require("./caml_curry");
var Caml_string = require("./caml_string");

function caml_failwith(s) {
Expand All @@ -14,13 +15,6 @@ function caml_failwith(s) {
];
}

function caml_invalid_argument(s) {
throw [
Caml_builtin_exceptions.invalid_argument,
s
];
}

function parse_digit(c) {
if (c >= 65) {
if (c >= 97) {
Expand Down Expand Up @@ -800,20 +794,8 @@ function caml_format_float(fmt, x) {
return finish_formatting(f, s);
}

var caml_float_of_string = (

/**
* external float_of_string : string -> float = "caml_float_of_string"
* pervasives.ml
* Semantics is slightly different from javascript :
* console.assert(caml_float_of_string('infinity')===Infinity)
* console.assert(caml_float_of_string('Infinity')===Infinity
*
* parseFloat('Infinity') === Infinity
* parseFloat('infinity') === Nan
* */
function (s) {
//s = caml_bytes_of_string (s);
var float_of_string = (
function (s, caml_failwith) {
var res = +s;
if ((s.length > 0) && (res === res))
return res;
Expand All @@ -839,7 +821,9 @@ function (s) {

);

var repeat = Caml_utils.repeat;
function caml_float_of_string(s) {
return Caml_curry.app2(float_of_string, s, caml_failwith);
}

var caml_nativeint_format = caml_format_int;

Expand All @@ -849,10 +833,6 @@ var caml_int32_of_string = caml_int_of_string;

var caml_nativeint_of_string = caml_int_of_string;

exports.parse_digit = parse_digit;
exports.caml_invalid_argument = caml_invalid_argument;
exports.repeat = repeat;
exports.caml_failwith = caml_failwith;
exports.caml_format_float = caml_format_float;
exports.caml_format_int = caml_format_int;
exports.caml_nativeint_format = caml_nativeint_format;
Expand All @@ -863,4 +843,4 @@ exports.caml_int_of_string = caml_int_of_string;
exports.caml_int32_of_string = caml_int32_of_string;
exports.caml_int64_of_string = caml_int64_of_string;
exports.caml_nativeint_of_string = caml_nativeint_of_string;
/* caml_float_of_string Not a pure module */
/* float_of_string Not a pure module */
32 changes: 17 additions & 15 deletions jscomp/runtime/caml_format.ml
Original file line number Diff line number Diff line change
Expand Up @@ -558,20 +558,22 @@ let caml_format_float fmt x =
end;
finish_formatting f !s

let caml_float_of_string : string -> float = [%bs.raw {|

/**
* external float_of_string : string -> float = "caml_float_of_string"
* pervasives.ml
* Semantics is slightly different from javascript :
* console.assert(caml_float_of_string('infinity')===Infinity)
* console.assert(caml_float_of_string('Infinity')===Infinity
*
* parseFloat('Infinity') === Infinity
* parseFloat('infinity') === Nan
* */
function (s) {
//s = caml_bytes_of_string (s);

(**
external float_of_string : string -> float = "caml_float_of_string"
pervasives.ml
Semantics is slightly different from javascript :
console.assert(caml_float_of_string('infinity')===Infinity)
console.assert(caml_float_of_string('Infinity')===Infinity

parseFloat('Infinity') === Infinity
parseFloat('infinity') === Nan

FIXME: arity of float_of_string is not inferred correctly
*)

let float_of_string : string -> (string -> 'a) -> float = [%bs.raw {|
function (s, caml_failwith) {
var res = +s;
if ((s.length > 0) && (res === res))
return res;
Expand All @@ -598,7 +600,7 @@ function (s) {
|}
]


let caml_float_of_string s = float_of_string s caml_failwith

let caml_nativeint_format = caml_format_int
let caml_int32_format = caml_format_int
Expand Down
7 changes: 0 additions & 7 deletions jscomp/runtime/caml_format.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@

(* Author: Hongbo Zhang *)

val parse_digit : char -> int

val caml_invalid_argument : string -> 'a

val repeat : int -> string -> string

val caml_failwith : string -> 'a

type fmt

val caml_format_float : string -> float -> string

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions jscomp/runtime/fn.ml
1 change: 0 additions & 1 deletion jscomp/runtime/js_fn.ml

This file was deleted.

Loading