Compare commits

..

3 commits

Author SHA1 Message Date
a3a09d3b54 finish 042 2025-05-21 15:39:10 -06:00
a03172f667 remove relative imports because that causes way more issues 2025-05-21 15:38:57 -06:00
629ce4ab2c start 042 2025-05-21 15:22:33 -06:00
16 changed files with 70 additions and 43 deletions

10
README
View file

@ -2,10 +2,18 @@
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
# 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/[module]";
What
----

2
TODO
View file

@ -47,8 +47,8 @@
038 [encoding] add html support, via code - blocked by 008
039 [encoding] add rivit support, via code (https://judahcaruso.com/rivit.htm) - blocked by 038
040 [encoding] add markdown (commonmark?) support, via code - blocked by 038
042 [x] use absolute imports internally (ie. #import "jc/math"), update symlink/install process in README
*** DONE ***
010 [x] make base jai files standalone (ie. [array], [memory], etc... big maybe)
042 [x] use absolute imports internally (ie. #import "jc/math"), update symlink/install process in README

View file

@ -2,6 +2,9 @@
compiler :: #import "Compiler";
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 "./encoding/module.jai"(true);
#import,file "./hash/module.jai"(true);
@ -9,8 +12,8 @@
#import,file "./meta/module.jai"(true);
rmath :: #import,file "./math/module.jai"(.radians, true);
// dmath :: #import,file "./math/module.jai"(.degrees, true);
// tmath :: #import,file "./math/module.jai"(.turns, true);
dmath :: #import,file "./math/module.jai"(.degrees, true);
tmath :: #import,file "./math/module.jai"(.turns, true);
}

View file

@ -5,5 +5,5 @@
#scope_module;
#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;
mem :: #import,file "../memory/module.jai";
basic :: #import "Basic"; // @future
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);
}
mem :: #import "jc/memory";
basic :: #import "Basic"; // @future
// ----------------------------------------------------------
// TESTS
// ----------------------------------------------------------
#if RUN_TESTS #run {
test :: #import,file "../test/module.jai";
test :: #import "jc/test";
test.run("basic operations", (t) => {
a: Static_Array(10, int);

View file

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

View file

@ -603,7 +603,8 @@ at_end :: inline (p: *Parser) -> bool {
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;
#if RUN_TESTS {
test :: #import,file "../test/module.jai";
test :: #import "jc/test";
}

View file

@ -6,6 +6,7 @@
#load "vec.jai";
#load "mat.jai";
#scope_module;
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 {
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 };
}
#scope_file
meta :: #import,file "../meta/module.jai";
#scope_file;
meta :: #import "jc/meta";
math :: #import "Math"; // @future

View file

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

View file

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

View file

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

View file

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

View file

@ -154,8 +154,11 @@ user_options :: #run -> Simple_Build_Options {
file_delete(temp_path);
}
#import "Basic";
#import "File";
#import "File_Utilities";
#import "String";
#import "Compiler";
#scope_file;
#import "Basic"; // @future
#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");
}
#import "jx";
basic :: #import "Basic";
system :: #import "System";
file :: #import "File";
futils :: #import "File_Utilities";
strings :: #import "String";
basic :: #import "Basic"; // @future
system :: #import "System"; // @future
file :: #import "File"; // @future
futils :: #import "File_Utilities"; // @future
strings :: #import "String"; // @future