diff options
| author | gingerBill <bill@gingerbill.org> | 2024-01-28 21:05:53 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-01-28 21:05:53 +0000 |
| commit | 09fa1c29cd014b4560b3c79c72db68af20ef8187 (patch) | |
| tree | 45095630fb03a50df20e0249f98879cf27d94397 | |
| parent | ddcaa0de5395bfb1a2b004e6a6cb5e2ba1e2eed1 (diff) | |
Move `core:runtime` to `base:runtime`; keep alias around
| -rw-r--r-- | base/runtime/core.odin (renamed from core/runtime/core.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/core_builtin.odin (renamed from core/runtime/core_builtin.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/core_builtin_matrix.odin (renamed from core/runtime/core_builtin_matrix.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/core_builtin_soa.odin (renamed from core/runtime/core_builtin_soa.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_allocators_arena.odin (renamed from core/runtime/default_allocators_arena.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_allocators_general.odin (renamed from core/runtime/default_allocators_general.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_allocators_js.odin (renamed from core/runtime/default_allocators_js.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_allocators_nil.odin (renamed from core/runtime/default_allocators_nil.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_allocators_wasi.odin (renamed from core/runtime/default_allocators_wasi.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_allocators_windows.odin (renamed from core/runtime/default_allocators_windows.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/default_temporary_allocator.odin (renamed from core/runtime/default_temporary_allocator.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/docs.odin (renamed from core/runtime/docs.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/dynamic_array_internal.odin (renamed from core/runtime/dynamic_array_internal.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/dynamic_map_internal.odin (renamed from core/runtime/dynamic_map_internal.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/entry_unix.odin (renamed from core/runtime/entry_unix.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/entry_unix_no_crt_amd64.asm (renamed from core/runtime/entry_unix_no_crt_amd64.asm) | 0 | ||||
| -rw-r--r-- | base/runtime/entry_unix_no_crt_darwin_arm64.asm (renamed from core/runtime/entry_unix_no_crt_darwin_arm64.asm) | 0 | ||||
| -rw-r--r-- | base/runtime/entry_unix_no_crt_i386.asm (renamed from core/runtime/entry_unix_no_crt_i386.asm) | 0 | ||||
| -rw-r--r-- | base/runtime/entry_wasm.odin (renamed from core/runtime/entry_wasm.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/entry_windows.odin (renamed from core/runtime/entry_windows.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/error_checks.odin (renamed from core/runtime/error_checks.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/internal.odin (renamed from core/runtime/internal.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific.odin (renamed from core/runtime/os_specific.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific_any.odin (renamed from core/runtime/os_specific_any.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific_darwin.odin (renamed from core/runtime/os_specific_darwin.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific_freestanding.odin (renamed from core/runtime/os_specific_freestanding.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific_js.odin (renamed from core/runtime/os_specific_js.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific_wasi.odin (renamed from core/runtime/os_specific_wasi.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/os_specific_windows.odin (renamed from core/runtime/os_specific_windows.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/print.odin (renamed from core/runtime/print.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/procs.odin (renamed from core/runtime/procs.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/procs_darwin.odin (renamed from core/runtime/procs_darwin.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/procs_js.odin (renamed from core/runtime/procs_js.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/procs_wasm.odin (renamed from core/runtime/procs_wasm.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/procs_windows_amd64.asm (renamed from core/runtime/procs_windows_amd64.asm) | 0 | ||||
| -rw-r--r-- | base/runtime/procs_windows_amd64.odin (renamed from core/runtime/procs_windows_amd64.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/procs_windows_i386.odin (renamed from core/runtime/procs_windows_i386.odin) | 0 | ||||
| -rw-r--r-- | base/runtime/udivmod128.odin (renamed from core/runtime/udivmod128.odin) | 0 | ||||
| -rw-r--r-- | src/build_settings.cpp | 22 | ||||
| -rw-r--r-- | src/checker.cpp | 28 | ||||
| -rw-r--r-- | src/main.cpp | 1 | ||||
| -rw-r--r-- | src/parser.cpp | 10 |
42 files changed, 54 insertions, 7 deletions
diff --git a/core/runtime/core.odin b/base/runtime/core.odin index 740482493..740482493 100644 --- a/core/runtime/core.odin +++ b/base/runtime/core.odin diff --git a/core/runtime/core_builtin.odin b/base/runtime/core_builtin.odin index 3f4ebbc74..3f4ebbc74 100644 --- a/core/runtime/core_builtin.odin +++ b/base/runtime/core_builtin.odin diff --git a/core/runtime/core_builtin_matrix.odin b/base/runtime/core_builtin_matrix.odin index 7d60d625c..7d60d625c 100644 --- a/core/runtime/core_builtin_matrix.odin +++ b/base/runtime/core_builtin_matrix.odin diff --git a/core/runtime/core_builtin_soa.odin b/base/runtime/core_builtin_soa.odin index 6313a28f5..6313a28f5 100644 --- a/core/runtime/core_builtin_soa.odin +++ b/base/runtime/core_builtin_soa.odin diff --git a/core/runtime/default_allocators_arena.odin b/base/runtime/default_allocators_arena.odin index 1fe3c6cfc..1fe3c6cfc 100644 --- a/core/runtime/default_allocators_arena.odin +++ b/base/runtime/default_allocators_arena.odin diff --git a/core/runtime/default_allocators_general.odin b/base/runtime/default_allocators_general.odin index 994a672b0..994a672b0 100644 --- a/core/runtime/default_allocators_general.odin +++ b/base/runtime/default_allocators_general.odin diff --git a/core/runtime/default_allocators_js.odin b/base/runtime/default_allocators_js.odin index 715073f08..715073f08 100644 --- a/core/runtime/default_allocators_js.odin +++ b/base/runtime/default_allocators_js.odin diff --git a/core/runtime/default_allocators_nil.odin b/base/runtime/default_allocators_nil.odin index c882f5196..c882f5196 100644 --- a/core/runtime/default_allocators_nil.odin +++ b/base/runtime/default_allocators_nil.odin diff --git a/core/runtime/default_allocators_wasi.odin b/base/runtime/default_allocators_wasi.odin index a7e6842a6..a7e6842a6 100644 --- a/core/runtime/default_allocators_wasi.odin +++ b/base/runtime/default_allocators_wasi.odin diff --git a/core/runtime/default_allocators_windows.odin b/base/runtime/default_allocators_windows.odin index 1b0f78428..1b0f78428 100644 --- a/core/runtime/default_allocators_windows.odin +++ b/base/runtime/default_allocators_windows.odin diff --git a/core/runtime/default_temporary_allocator.odin b/base/runtime/default_temporary_allocator.odin index c90f0388d..c90f0388d 100644 --- a/core/runtime/default_temporary_allocator.odin +++ b/base/runtime/default_temporary_allocator.odin diff --git a/core/runtime/docs.odin b/base/runtime/docs.odin index a520584c5..a520584c5 100644 --- a/core/runtime/docs.odin +++ b/base/runtime/docs.odin diff --git a/core/runtime/dynamic_array_internal.odin b/base/runtime/dynamic_array_internal.odin index 267ee0785..267ee0785 100644 --- a/core/runtime/dynamic_array_internal.odin +++ b/base/runtime/dynamic_array_internal.odin diff --git a/core/runtime/dynamic_map_internal.odin b/base/runtime/dynamic_map_internal.odin index 491a7974d..491a7974d 100644 --- a/core/runtime/dynamic_map_internal.odin +++ b/base/runtime/dynamic_map_internal.odin diff --git a/core/runtime/entry_unix.odin b/base/runtime/entry_unix.odin index f494a509e..f494a509e 100644 --- a/core/runtime/entry_unix.odin +++ b/base/runtime/entry_unix.odin diff --git a/core/runtime/entry_unix_no_crt_amd64.asm b/base/runtime/entry_unix_no_crt_amd64.asm index f0bdce8d7..f0bdce8d7 100644 --- a/core/runtime/entry_unix_no_crt_amd64.asm +++ b/base/runtime/entry_unix_no_crt_amd64.asm diff --git a/core/runtime/entry_unix_no_crt_darwin_arm64.asm b/base/runtime/entry_unix_no_crt_darwin_arm64.asm index 0f71fbdf8..0f71fbdf8 100644 --- a/core/runtime/entry_unix_no_crt_darwin_arm64.asm +++ b/base/runtime/entry_unix_no_crt_darwin_arm64.asm diff --git a/core/runtime/entry_unix_no_crt_i386.asm b/base/runtime/entry_unix_no_crt_i386.asm index a61d56a16..a61d56a16 100644 --- a/core/runtime/entry_unix_no_crt_i386.asm +++ b/base/runtime/entry_unix_no_crt_i386.asm diff --git a/core/runtime/entry_wasm.odin b/base/runtime/entry_wasm.odin index e7f3f156f..e7f3f156f 100644 --- a/core/runtime/entry_wasm.odin +++ b/base/runtime/entry_wasm.odin diff --git a/core/runtime/entry_windows.odin b/base/runtime/entry_windows.odin index b6fbe1dcc..b6fbe1dcc 100644 --- a/core/runtime/entry_windows.odin +++ b/base/runtime/entry_windows.odin diff --git a/core/runtime/error_checks.odin b/base/runtime/error_checks.odin index ea6333c29..ea6333c29 100644 --- a/core/runtime/error_checks.odin +++ b/base/runtime/error_checks.odin diff --git a/core/runtime/internal.odin b/base/runtime/internal.odin index a03c2a701..a03c2a701 100644 --- a/core/runtime/internal.odin +++ b/base/runtime/internal.odin diff --git a/core/runtime/os_specific.odin b/base/runtime/os_specific.odin index 022d315d4..022d315d4 100644 --- a/core/runtime/os_specific.odin +++ b/base/runtime/os_specific.odin diff --git a/core/runtime/os_specific_any.odin b/base/runtime/os_specific_any.odin index 6a96655c4..6a96655c4 100644 --- a/core/runtime/os_specific_any.odin +++ b/base/runtime/os_specific_any.odin diff --git a/core/runtime/os_specific_darwin.odin b/base/runtime/os_specific_darwin.odin index 5de9a7d57..5de9a7d57 100644 --- a/core/runtime/os_specific_darwin.odin +++ b/base/runtime/os_specific_darwin.odin diff --git a/core/runtime/os_specific_freestanding.odin b/base/runtime/os_specific_freestanding.odin index a6d04cefb..a6d04cefb 100644 --- a/core/runtime/os_specific_freestanding.odin +++ b/base/runtime/os_specific_freestanding.odin diff --git a/core/runtime/os_specific_js.odin b/base/runtime/os_specific_js.odin index 246141d87..246141d87 100644 --- a/core/runtime/os_specific_js.odin +++ b/base/runtime/os_specific_js.odin diff --git a/core/runtime/os_specific_wasi.odin b/base/runtime/os_specific_wasi.odin index 3f69504ee..3f69504ee 100644 --- a/core/runtime/os_specific_wasi.odin +++ b/base/runtime/os_specific_wasi.odin diff --git a/core/runtime/os_specific_windows.odin b/base/runtime/os_specific_windows.odin index 4a5907466..4a5907466 100644 --- a/core/runtime/os_specific_windows.odin +++ b/base/runtime/os_specific_windows.odin diff --git a/core/runtime/print.odin b/base/runtime/print.odin index 87c8757d5..87c8757d5 100644 --- a/core/runtime/print.odin +++ b/base/runtime/print.odin diff --git a/core/runtime/procs.odin b/base/runtime/procs.odin index 454574c35..454574c35 100644 --- a/core/runtime/procs.odin +++ b/base/runtime/procs.odin diff --git a/core/runtime/procs_darwin.odin b/base/runtime/procs_darwin.odin index 9c53b5b16..9c53b5b16 100644 --- a/core/runtime/procs_darwin.odin +++ b/base/runtime/procs_darwin.odin diff --git a/core/runtime/procs_js.odin b/base/runtime/procs_js.odin index d3e12410c..d3e12410c 100644 --- a/core/runtime/procs_js.odin +++ b/base/runtime/procs_js.odin diff --git a/core/runtime/procs_wasm.odin b/base/runtime/procs_wasm.odin index 26dcfef77..26dcfef77 100644 --- a/core/runtime/procs_wasm.odin +++ b/base/runtime/procs_wasm.odin diff --git a/core/runtime/procs_windows_amd64.asm b/base/runtime/procs_windows_amd64.asm index f588b3453..f588b3453 100644 --- a/core/runtime/procs_windows_amd64.asm +++ b/base/runtime/procs_windows_amd64.asm diff --git a/core/runtime/procs_windows_amd64.odin b/base/runtime/procs_windows_amd64.odin index ea495f5fa..ea495f5fa 100644 --- a/core/runtime/procs_windows_amd64.odin +++ b/base/runtime/procs_windows_amd64.odin diff --git a/core/runtime/procs_windows_i386.odin b/base/runtime/procs_windows_i386.odin index 10422cf07..10422cf07 100644 --- a/core/runtime/procs_windows_i386.odin +++ b/base/runtime/procs_windows_i386.odin diff --git a/core/runtime/udivmod128.odin b/base/runtime/udivmod128.odin index 87ef73c2c..87ef73c2c 100644 --- a/core/runtime/udivmod128.odin +++ b/base/runtime/udivmod128.odin diff --git a/src/build_settings.cpp b/src/build_settings.cpp index af518bcb4..8c9e13178 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -1161,7 +1161,27 @@ gb_internal String get_fullpath_relative(gbAllocator a, String base_dir, String } -gb_internal String get_fullpath_core(gbAllocator a, String path) { +gb_internal String get_fullpath_base_collection(gbAllocator a, String path) { + String module_dir = odin_root_dir(); + + String base = str_lit("base/"); + + isize str_len = module_dir.len + base.len + path.len; + u8 *str = gb_alloc_array(heap_allocator(), u8, str_len+1); + defer (gb_free(heap_allocator(), str)); + + isize i = 0; + gb_memmove(str+i, module_dir.text, module_dir.len); i += module_dir.len; + gb_memmove(str+i, base.text, base.len); i += base.len; + gb_memmove(str+i, path.text, path.len); i += path.len; + str[i] = 0; + + String res = make_string(str, i); + res = string_trim_whitespace(res); + return path_to_fullpath(a, res); +} + +gb_internal String get_fullpath_core_collection(gbAllocator a, String path) { String module_dir = odin_root_dir(); String core = str_lit("core/"); diff --git a/src/checker.cpp b/src/checker.cpp index 498fce7d2..563bb2781 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -770,15 +770,17 @@ gb_internal void add_type_info_dependency(CheckerInfo *info, DeclInfo *d, Type * rw_mutex_unlock(&d->type_info_deps_mutex); } -gb_internal AstPackage *get_core_package(CheckerInfo *info, String name) { + +gb_internal AstPackage *get_runtime_package(CheckerInfo *info) { + String name = str_lit("runtime"); gbAllocator a = heap_allocator(); - String path = get_fullpath_core(a, name); + String path = get_fullpath_base_collection(a, name); defer (gb_free(a, path.text)); auto found = string_map_get(&info->packages, path); if (found == nullptr) { gb_printf_err("Name: %.*s\n", LIT(name)); gb_printf_err("Fullpath: %.*s\n", LIT(path)); - + for (auto const &entry : info->packages) { gb_printf_err("%.*s\n", LIT(entry.key)); } @@ -787,6 +789,26 @@ gb_internal AstPackage *get_core_package(CheckerInfo *info, String name) { return *found; } +gb_internal AstPackage *get_core_package(CheckerInfo *info, String name) { + if (name == "runtime") { + return get_runtime_package(info); + } + + gbAllocator a = heap_allocator(); + String path = get_fullpath_core_collection(a, name); + defer (gb_free(a, path.text)); + auto found = string_map_get(&info->packages, path); + if (found == nullptr) { + gb_printf_err("Name: %.*s\n", LIT(name)); + gb_printf_err("Fullpath: %.*s\n", LIT(path)); + + for (auto const &entry : info->packages) { + gb_printf_err("%.*s\n", LIT(entry.key)); + } + GB_ASSERT_MSG(found != nullptr, "Missing core package %.*s", LIT(name)); + } + return *found; +} gb_internal void add_package_dependency(CheckerContext *c, char const *package_name, char const *name) { String n = make_string_c(name); diff --git a/src/main.cpp b/src/main.cpp index 19271d667..5cff99160 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2376,6 +2376,7 @@ int main(int arg_count, char const **arg_ptr) { TIME_SECTION("init default library collections"); array_init(&library_collections, heap_allocator()); // NOTE(bill): 'core' cannot be (re)defined by the user + add_library_collection(str_lit("base"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("base"))); add_library_collection(str_lit("core"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("core"))); add_library_collection(str_lit("vendor"), get_fullpath_relative(heap_allocator(), odin_root_dir(), str_lit("vendor"))); diff --git a/src/parser.cpp b/src/parser.cpp index b16a88de5..9ed3e32f9 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -5460,6 +5460,11 @@ gb_internal bool determine_path_from_string(BlockingMutex *file_mutex, Ast *node if (collection_name.len > 0) { + // NOTE(bill): `base:runtime` == `core:runtime` + if (collection_name == "core" && string_starts_with(file_str, str_lit("runtime"))) { + collection_name = str_lit("base"); + } + if (collection_name == "system") { if (node->kind != Ast_ForeignImportDecl) { syntax_error(node, "The library collection 'system' is restrict for 'foreign_library'"); @@ -5489,7 +5494,6 @@ gb_internal bool determine_path_from_string(BlockingMutex *file_mutex, Ast *node #endif } - if (is_package_name_reserved(file_str)) { *path = file_str; if (collection_name == "core") { @@ -6133,7 +6137,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) { { // Add these packages serially and then process them parallel TokenPos init_pos = {}; { - String s = get_fullpath_core(permanent_allocator(), str_lit("runtime")); + String s = get_fullpath_base_collection(permanent_allocator(), str_lit("runtime")); try_add_import_path(p, s, s, init_pos, Package_Runtime); } @@ -6141,7 +6145,7 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) { p->init_fullpath = init_fullpath; if (build_context.command_kind == Command_test) { - String s = get_fullpath_core(permanent_allocator(), str_lit("testing")); + String s = get_fullpath_core_collection(permanent_allocator(), str_lit("testing")); try_add_import_path(p, s, s, init_pos, Package_Normal); } |