util
This commit is contained in:
@@ -5,6 +5,7 @@ var _slice = Array.prototype.slice
|
||||
var _push = Array.prototype.push
|
||||
var _sort = Array.prototype.sort
|
||||
var _keys = Object.keys
|
||||
var _from = Array.from
|
||||
|
||||
function array(arg, arg2, arg3, arg4) {
|
||||
// array(number) - create array of size with nulls
|
||||
@@ -91,6 +92,9 @@ function array(arg, arg2, arg3, arg4) {
|
||||
|
||||
// array(object) - keys
|
||||
if (typeof arg == 'object' && arg != null && !_isArray(arg)) {
|
||||
if (arg instanceof Set) {
|
||||
return _from(arg)
|
||||
}
|
||||
return _keys(arg)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ delete globalThis.cell
|
||||
var ACTORDATA = _cell.hidden.actorsym
|
||||
var SYSYM = '__SYSTEM__'
|
||||
|
||||
var __cell = globalThis._cell
|
||||
|
||||
var hidden = _cell.hidden
|
||||
|
||||
var os = hidden.os;
|
||||
@@ -29,10 +27,19 @@ function use_embed(name) {
|
||||
return load_internal(`js_${name}_use`)
|
||||
}
|
||||
|
||||
globalThis.meme = function(obj) {
|
||||
return {
|
||||
globalThis.meme = function(obj, ...mixins) {
|
||||
var result = {
|
||||
__proto__: obj
|
||||
}
|
||||
|
||||
array.for(mixins, mix => {
|
||||
if (isa(mix, object)) {
|
||||
for (var key in mix) {
|
||||
result[key] = mix[key]
|
||||
}
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
globalThis.logical = function(val1)
|
||||
@@ -66,6 +73,11 @@ use_cache['core/os'] = os
|
||||
|
||||
var _Symbol = Symbol
|
||||
|
||||
globalThis.key = function()
|
||||
{
|
||||
return _Symbol()
|
||||
}
|
||||
|
||||
// Load a core module from the file system
|
||||
function use_core(path) {
|
||||
var cache_key = 'core/' + path
|
||||
@@ -392,7 +404,7 @@ os.use_cache = use_cache
|
||||
os.global_shop_path = shop_path
|
||||
os.$_ = $_
|
||||
|
||||
var shop = use_core('shop')
|
||||
var shop = use_core('internal/shop')
|
||||
|
||||
var json = use_core('json')
|
||||
var time = use_core('time')
|
||||
@@ -949,10 +961,6 @@ function enet_check()
|
||||
|
||||
// enet_check();
|
||||
|
||||
var init_end = time.number()
|
||||
|
||||
var load_program_start = time.number()
|
||||
|
||||
// Finally, run the program
|
||||
actor_mod.setname(_cell.args.program)
|
||||
|
||||
@@ -1005,8 +1013,8 @@ delete globalThis.WeakSet
|
||||
delete globalThis.WeakRef
|
||||
delete globalThis.BigInt
|
||||
delete globalThis.Symbol
|
||||
delete globalThis.Map
|
||||
delete globalThis.Set
|
||||
//delete globalThis.Map
|
||||
//delete globalThis.Set
|
||||
delete globalThis.Promise
|
||||
delete globalThis.ArrayBuffer
|
||||
delete globalThis.DataView
|
||||
|
||||
@@ -326,7 +326,7 @@ static JSValue js_os_dylib_open(JSContext *js, JSValue self, int argc, JSValue *
|
||||
#ifdef _WIN32
|
||||
handle = LoadLibraryA(path);
|
||||
#else
|
||||
handle = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
||||
handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
|
||||
#endif
|
||||
|
||||
JS_FreeCString(js, path);
|
||||
|
||||
1163
internal/shop.cm
Normal file
1163
internal/shop.cm
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user