diff --git a/help/cellstructure.md b/help/cellstructure.md index 56c868fc..301bcc5d 100644 --- a/help/cellstructure.md +++ b/help/cellstructure.md @@ -35,9 +35,9 @@ all source for every single part of a cell program are located in the cell shop. the cell shop looks like this: .cell - shop.toml <---- shop configuration packages - gitea.pockle.world/john/cell <--- this is the core cell + core <--- this is the core cell + gitea.pockle.world/john/cell <---- core contents. this is linked to core gitea.pockle.world/john/prosperon cell.toml <--- the manifest of the package mod1.cm diff --git a/shop.cm b/shop.cm index f2ed59a9..94525bc5 100644 --- a/shop.cm +++ b/shop.cm @@ -231,13 +231,10 @@ function get_global_build_dir() { // Get the core directory (in the global shop) Shop.get_core_dir = function() { - return global_shop_path + '/core' + return get_packages_dir() + '/' + core_package } -function get_core_package() -{ - return "gitea.pockle.world/john/cell" -} +var core_package = 'core' // Get the links file path (in the global shop) function get_links_path() { @@ -800,7 +797,7 @@ var open_dls = {} var script_form = function(path, script, pkg) { var pkg_arg = pkg ? `'${pkg}'` : 'null' var relative_use_fn = `def use = function(path) { return globalThis.use(path, ${pkg_arg});}` - var fn = `(function setup_module($_){ ${relative_use_fn}; ${script}})` + var fn = `(function setup_module($_, args){ ${relative_use_fn}; ${script}})` return fn } @@ -823,23 +820,21 @@ Shop.get_flags = get_flags function resolve_mod_fn(path, pkg) { if (!fd.is_file(path)) throw new Error(`path ${path} is not a file`) - var content = fd.slurp(path) - var obj = pull_from_cache(content) + var content = text(fd.slurp(path)) + var script = script_form(path, content, pkg); + + var obj = pull_from_cache(utf8.encode(script)) if (obj) { var fn = js.compile_unblob(obj) return js.eval_compile(fn) } - - var form = script_form - - var script = form(path, text(content), pkg); // Compile name is just for debug/stack traces var compile_name = pkg ? pkg + ':' + path : 'local:' + path var fn = js.compile(compile_name, script) - put_into_cache(content, js.compile_blob(fn)) + put_into_cache(utf8.encode(script), js.compile_blob(fn)) return js.eval_compile(fn) } @@ -1763,8 +1758,7 @@ Shop.build_package = function(package) var link_flags = '-fPIC -shared' // Link against core package dylib (unless we ARE the core) - var core_pkg = get_core_package() - if (package != core_pkg) { + if (package != core_package) { var lib_dir = get_shared_lib_path() if (platform == 'macOS') { link_flags += ' -L' + lib_dir + ' -Wl,-rpath,@loader_path' @@ -1773,7 +1767,7 @@ Shop.build_package = function(package) } else if (platform == 'Windows') { link_flags += ' -L' + lib_dir } - link_flags += ' -l' + get_core_package() + link_flags += ' -l' + core_package } var ldflags = get_flags(config, platform, 'LDFLAGS') @@ -2016,6 +2010,7 @@ Shop.list_shop_packages = function() { var lock = Shop.load_lock() var list = [] for (var k in lock) { + log.console(k) if (lock[k]) list.push(lock[k]) } return list diff --git a/source/cell.c b/source/cell.c index 8c4cb79f..70077339 100644 --- a/source/cell.c +++ b/source/cell.c @@ -13,7 +13,7 @@ #define ENGINE "internal/engine.cm" #define CELL_SHOP_DIR ".cell" -#define CELL_CORE_DIR "core" +#define CELL_CORE_DIR "packages/core" #include #include diff --git a/update.ce b/update.ce index d67d44d8..7eb83b68 100644 --- a/update.ce +++ b/update.ce @@ -31,7 +31,7 @@ for (var i = 0; i < args.length; i++) { var packages = shop.list_shop_packages() -log.console("Checking for updates (" + packages.length + " packages)...") +log.console("Checking for updates (" + text(packages.length) + " packages)...") // 1. Update all packages for (var info of packages) {