remove relative imports because that causes way more issues

This commit is contained in:
Judah Caruso 2025-05-21 15:38:57 -06:00
parent 629ce4ab2c
commit a03172f667
15 changed files with 69 additions and 42 deletions

10
README
View file

@ -2,10 +2,18 @@
jc.jai jc.jai
------ ------
cd [jai install directory]/modules # Direct installation
cd [jai install dir]/modules
git clone https://git.brut.systems/judah/jc.jai.git jc git clone https://git.brut.systems/judah/jc.jai.git jc
# Indirect installation
git clone https://git.brut.systems/judah/jc.jai.git
ln -s "/path/to/jc.jai" [jai install dir]/modules/jc # POSIX install
mklink /D "C:\path\to\jc.jai" [jai install dir]\jc # Windows install
#import "jc"; #import "jc";
#import "jc/[module]";
What What
---- ----

View file

@ -2,6 +2,9 @@
compiler :: #import "Compiler"; compiler :: #import "Compiler";
compiler.set_build_options_dc(.{ do_output = false }); compiler.set_build_options_dc(.{ do_output = false });
// @note(judah): we use relative imports here because that'll
// print cleaner file locations.
#import,file "./array/module.jai"(true); #import,file "./array/module.jai"(true);
#import,file "./encoding/module.jai"(true); #import,file "./encoding/module.jai"(true);
#import,file "./hash/module.jai"(true); #import,file "./hash/module.jai"(true);
@ -9,8 +12,8 @@
#import,file "./meta/module.jai"(true); #import,file "./meta/module.jai"(true);
rmath :: #import,file "./math/module.jai"(.radians, true); rmath :: #import,file "./math/module.jai"(.radians, true);
// dmath :: #import,file "./math/module.jai"(.degrees, true); dmath :: #import,file "./math/module.jai"(.degrees, true);
// tmath :: #import,file "./math/module.jai"(.turns, true); tmath :: #import,file "./math/module.jai"(.turns, true);
} }

View file

@ -5,5 +5,5 @@
#scope_module; #scope_module;
#if RUN_TESTS { #if RUN_TESTS {
test :: #import,file "../test/module.jai"; test :: #import "jc/test";
} }

View file

@ -77,15 +77,20 @@ make_dynamic :: (a: *Static_Array) -> [..]a.T {
#scope_file; #scope_file;
mem :: #import,file "../memory/module.jai";
basic :: #import "Basic"; // @future
ensure_array_has_room :: (array: *Static_Array, count: int, loc := #caller_location) #expand { ensure_array_has_room :: (array: *Static_Array, count: int, loc := #caller_location) #expand {
basic.assert(array.count + count <= array.capacity, "attempt to add too many elements! want: %, Max: %", array.count + count, array.capacity, loc = loc); basic.assert(array.count + count <= array.capacity, "attempt to add too many elements! want: %, Max: %", array.count + count, array.capacity, loc = loc);
} }
mem :: #import "jc/memory";
basic :: #import "Basic"; // @future
// ----------------------------------------------------------
// TESTS
// ----------------------------------------------------------
#if RUN_TESTS #run { #if RUN_TESTS #run {
test :: #import,file "../test/module.jai"; test :: #import "jc/test";
test.run("basic operations", (t) => { test.run("basic operations", (t) => {
a: Static_Array(10, int); a: Static_Array(10, int);

View file

@ -156,10 +156,14 @@ encoded_length :: (count: int, with_padding := false) -> int {
#scope_file; #scope_file;
basic :: #import "Basic"; basic :: #import "Basic"; // @future
strings :: #import "String"; strings :: #import "String"; // @future
// ----------------------------------------------------------
// TESTS
// ----------------------------------------------------------
#if RUN_TESTS #run { #if RUN_TESTS #run {
test.run("encodes", (t) => { test.run("encodes", (t) => {
str :: "Hello, World"; str :: "Hello, World";

View file

@ -603,7 +603,8 @@ at_end :: inline (p: *Parser) -> bool {
return p.offset >= p.data.count.(u64); return p.offset >= p.data.count.(u64);
} }
basic :: #import "Basic";
strings :: #import "String"; basic :: #import "Basic"; // @future
strings :: #import "String"; // @future

View file

@ -7,5 +7,5 @@
#scope_module; #scope_module;
#if RUN_TESTS { #if RUN_TESTS {
test :: #import,file "../test/module.jai"; test :: #import "jc/test";
} }

View file

@ -6,6 +6,7 @@
#load "vec.jai"; #load "vec.jai";
#load "mat.jai"; #load "mat.jai";
#scope_module; #scope_module;
bounds_check_index :: ($$idx: int, $count: int, loc := #caller_location) #expand { bounds_check_index :: ($$idx: int, $count: int, loc := #caller_location) #expand {
@ -18,8 +19,8 @@ bounds_check_index :: ($$idx: int, $count: int, loc := #caller_location) #expand
} }
basic :: #import "Basic"; basic :: #import "Basic"; // @future
#if RUN_TESTS { #if RUN_TESTS {
test :: #import,file "../test/module.jai"; test :: #import "jc/test";
} }

View file

@ -349,7 +349,8 @@ quat :: (x: float = 0, y: float = 0, z: float = 0, w: float = 0) -> Quat #expand
return .{ x = x, y = y, z = z, w = w }; return .{ x = x, y = y, z = z, w = w };
} }
#scope_file
meta :: #import,file "../meta/module.jai"; #scope_file;
meta :: #import "jc/meta";
math :: #import "Math"; // @future math :: #import "Math"; // @future

View file

@ -164,19 +164,20 @@ arena_alloc :: (a: *Arena, count: int, alignment := Default_Align, loc := #calle
} }
#scope_file; #scope_file;
// @note(judah): this will cause a cyclic import cycle if we import meta's module.jai meta :: #import "jc/meta";
// @todo(judah): switch to abslote imports everywhere (ie. "jc/meta")
meta :: #import,file "../meta/type_info.jai";
basic :: #import "Basic"; // @future basic :: #import "Basic"; // @future
compiler :: #import "Compiler"; // @future compiler :: #import "Compiler"; // @future
// ----------------------------------------------------------
// TESTS
// ----------------------------------------------------------
#if RUN_TESTS #run { #if RUN_TESTS #run {
test :: #import,file "../test/module.jai"; test :: #import "jc/test";
test.run("make:dynamic arrays", (t) => { test.run("make:dynamic arrays", (t) => {
a1 := make([..]int); a1 := make([..]int);

View file

@ -36,10 +36,15 @@ snake_to_pascal :: (name: string) -> string {
#scope_module; #scope_module;
mem :: #import,file "../memory/module.jai"; mem :: #import "jc/memory";
// ----------------------------------------------------------
// TESTS
// ----------------------------------------------------------
#if RUN_TESTS { #if RUN_TESTS {
test :: #import,file "../test/module.jai"; test :: #import "jc/test";
#run test.run("snake_to_pascal", t => { #run test.run("snake_to_pascal", t => {
test.expect(t, snake_to_pascal("some_name") == "SomeName"); test.expect(t, snake_to_pascal("some_name") == "SomeName");

View file

@ -81,8 +81,6 @@ G: *struct {
print("in: teardown\n"); print("in: teardown\n");
} }
#import "jx";
#poke_name reload frame; #poke_name reload frame;
#poke_name reload init; #poke_name reload init;
#poke_name reload setup; #poke_name reload setup;
@ -92,6 +90,6 @@ G: *struct {
// Use the default build options // Use the default build options
build_options :: () => reload.Simple_Build_Options.{}; build_options :: () => reload.Simple_Build_Options.{};
reload :: #import "jx/reload"; reload :: #import "jc/reload";
#import "Basic"; #import "Basic";

View file

@ -24,7 +24,6 @@ G: *struct {
} }
#import "jx";
#import "Basic"; #import "Basic";
DISABLE_HOT_RELOADING :: false; DISABLE_HOT_RELOADING :: false;
@ -50,7 +49,7 @@ DISABLE_HOT_RELOADING :: false;
} }
} }
else { else {
reload :: #import "jx/reload"; reload :: #import "jc/reload";
#poke_name reload frame; #poke_name reload frame;
#poke_name reload init; #poke_name reload init;
#poke_name reload setup; #poke_name reload setup;

View file

@ -154,8 +154,11 @@ user_options :: #run -> Simple_Build_Options {
file_delete(temp_path); file_delete(temp_path);
} }
#import "Basic";
#import "File"; #scope_file;
#import "File_Utilities";
#import "String"; #import "Basic"; // @future
#import "Compiler"; #import "File"; // @future
#import "File_Utilities"; // @future
#import "String"; // @future
#import "Compiler"; // @future

View file

@ -230,10 +230,8 @@ else {
#assert(false, "only windows, mac, and linux are supported for now"); #assert(false, "only windows, mac, and linux are supported for now");
} }
#import "jx"; basic :: #import "Basic"; // @future
system :: #import "System"; // @future
basic :: #import "Basic"; file :: #import "File"; // @future
system :: #import "System"; futils :: #import "File_Utilities"; // @future
file :: #import "File"; strings :: #import "String"; // @future
futils :: #import "File_Utilities";
strings :: #import "String";