bs-platform
Version:
bucklescript compiler, ocaml standard libary by bucklescript and its required runtime support
101 lines (87 loc) • 2.27 kB
JavaScript
;
var Caml_builtin_exceptions = require("./caml_builtin_exceptions.js");
function caml_sys_getenv(s) {
if (typeof process === "undefined" || process.env === undefined) {
throw Caml_builtin_exceptions.not_found;
}
var x = process.env[s];
if (x !== undefined) {
return x;
}
throw Caml_builtin_exceptions.not_found;
}
var os_type = (function(_){
if(typeof process !== 'undefined' && process.platform === 'win32'){
return "Win32"
}
else {
return "Unix"
}
});
function caml_sys_time(param) {
if (typeof process === "undefined" || process.uptime === undefined) {
return -1;
} else {
return process.uptime();
}
}
function caml_sys_random_seed(param) {
return [((Date.now() | 0) ^ 4294967295) * Math.random() | 0];
}
function caml_sys_system_command(_cmd) {
return 127;
}
var caml_sys_getcwd = (function(param){
if (typeof process === "undefined" || process.cwd === undefined){
return "/"
}
return process.cwd()
});
function caml_sys_get_argv(param) {
if (typeof process === "undefined") {
return /* tuple */[
"",
[""]
];
}
var argv = process.argv;
if (argv == null) {
return /* tuple */[
"",
[""]
];
} else {
return /* tuple */[
argv[0],
argv
];
}
}
function caml_sys_exit(exit_code) {
if (typeof process !== "undefined") {
return process.exit(exit_code);
}
}
function caml_sys_is_directory(_s) {
throw [
Caml_builtin_exceptions.failure,
"caml_sys_is_directory not implemented"
];
}
function caml_sys_file_exists(_s) {
throw [
Caml_builtin_exceptions.failure,
"caml_sys_file_exists not implemented"
];
}
exports.caml_sys_getenv = caml_sys_getenv;
exports.caml_sys_time = caml_sys_time;
exports.os_type = os_type;
exports.caml_sys_random_seed = caml_sys_random_seed;
exports.caml_sys_system_command = caml_sys_system_command;
exports.caml_sys_getcwd = caml_sys_getcwd;
exports.caml_sys_get_argv = caml_sys_get_argv;
exports.caml_sys_exit = caml_sys_exit;
exports.caml_sys_is_directory = caml_sys_is_directory;
exports.caml_sys_file_exists = caml_sys_file_exists;
/* No side effect */