added runtime configuration at compile-time; removed redundant files
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 9 Feb 2021 21:34:18 +0000 (15:34 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 9 Feb 2021 21:34:18 +0000 (15:34 -0600)
77 files changed:
bin/onyx
bin/test
core/file.onyx [deleted file]
core/io/file.onyx [new file with mode: 0644]
core/std.onyx [new file with mode: 0644]
core/std/js.onyx [deleted file]
core/std/wasi.onyx [deleted file]
core/stdio.onyx
examples/01_hello_world.onyx
examples/02_variables.onyx
examples/03_basics.onyx
examples/04_fixed_arrays.onyx
examples/05_slices.onyx
examples/06_dynamic_arrays.onyx
examples/07_structs.onyx
examples/08_enums.onyx
examples/09_for_loops.onyx
examples/10_switch_statements.onyx
examples/11_map.onyx
examples/12_varargs.onyx
examples/13_use_keyword.onyx
examples/14_overloaded_procs.onyx
examples/15_polymorphic_procs.onyx
examples/16_pipe_operator.onyx
include/onyxastnodes.h
onyx.exe
progs/odin_example.onyx
progs/particle_sym.onyx
progs/poly_solidify.onyx
progs/simd_test.onyx
progs/vararg_test.onyx
progs/wasi_test.onyx
src/onyx.c
src/onyxastnodes.c
src/onyxbuiltins.c
tests/aoc-2020/day1.onyx
tests/aoc-2020/day10.onyx
tests/aoc-2020/day11.onyx
tests/aoc-2020/day12.onyx
tests/aoc-2020/day13.onyx
tests/aoc-2020/day14.onyx
tests/aoc-2020/day15.onyx
tests/aoc-2020/day16.onyx
tests/aoc-2020/day17.onyx
tests/aoc-2020/day18.onyx
tests/aoc-2020/day19.onyx
tests/aoc-2020/day2.onyx
tests/aoc-2020/day20.onyx
tests/aoc-2020/day21.onyx
tests/aoc-2020/day22.onyx
tests/aoc-2020/day23.onyx
tests/aoc-2020/day24.onyx
tests/aoc-2020/day25.onyx
tests/aoc-2020/day3.onyx
tests/aoc-2020/day4.onyx
tests/aoc-2020/day5.onyx
tests/aoc-2020/day6.onyx
tests/aoc-2020/day7.onyx
tests/aoc-2020/day8.onyx
tests/aoc-2020/day9.onyx
tests/array_struct_robustness.onyx
tests/baked_parameters.onyx
tests/compile_time_procedures.onyx
tests/defer_with_continue.onyx
tests/general1.onyx.notest
tests/hello_world.onyx
tests/i32map.onyx
tests/multiple_returns_robustness.onyx
tests/named_arguments_test.onyx
tests/new_struct_behaviour.onyx
tests/operator_overload.onyx
tests/overload_with_autocast.onyx
tests/poly_structs_with_values.onyx
tests/polymorphic_array_lengths.onyx
tests/string_stream_test.onyx
tests/struct_robustness.onyx
tests/vararg_test.onyx

index 9ef4ddb892a548600ff5eb2733a5bd81e2d2f74c..1406205b02ede2170a5014e449a9498d631aabef 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index 59bef9158a5330ba9ae83dc7411e38a1dc8b471b..98aae8253623b4423a1c266b5ca6bdb49944dc33 100755 (executable)
--- a/bin/test
+++ b/bin/test
@@ -16,7 +16,7 @@ for test_file in $(find tests/ -name '*.onyx'); do
 
     print_check "$name"
 
-    if ! ./bin/onyx --use-post-mvp-features "$test_file" -o "./tests/$name.wasm" >/dev/null; then
+    if ! ./bin/onyx -r js --use-post-mvp-features "$test_file" -o "./tests/$name.wasm" >/dev/null; then
         print "\n❌ Failed to compile $name.onyx.\n"
         failed=1
         continue
diff --git a/core/file.onyx b/core/file.onyx
deleted file mode 100644 (file)
index 7515dc9..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-package core.io
-
-use package core
-use package wasi as wasi
-use package wasi {
-    FileDescriptor,
-    FDFlags, OFlags, Rights,
-    LookupFlags, Errno,
-    IOVec, IOVecArray, Size,
-    FileStat, Whence
-}
-
-OpenMode :: enum {
-    Invalid;
-    Read;
-    Write;
-    Append;
-}
-
-File :: struct {
-    fd     : FileDescriptor;
-
-    mode   : OpenMode = OpenMode.Invalid;
-    rights : Rights   = ~~ 0;
-    flags  : FDFlags  = ~~ 0;
-}
-
-file_open :: (path: str, mode := OpenMode.Read, flags := FDFlags.Sync) -> (File, bool) {
-    // Currently the directory's file descriptor appears to always be 3
-    DIR_FD :: 3;
-
-    // Requesting all of the rights because why not.
-    rights :=
-        Rights.DataSync
-        | Rights.Read
-        | Rights.Seek
-        | Rights.FdStatSetFlags
-        | Rights.Sync
-        | Rights.Tell
-        | Rights.Write
-        | Rights.Advise
-        | Rights.Allocate
-        | Rights.PathCreateDirectory
-        | Rights.PathCreateFile
-        | Rights.PathLinkSource
-        | Rights.PathLinkTarget
-        | Rights.PathOpen
-        | Rights.ReadDir
-        | Rights.PathReadlink
-        | Rights.PathRenameSource
-        | Rights.PathRenameTarget
-        | Rights.PathFilestatGet
-        | Rights.PathFilestateSetSize
-        | Rights.PathFilestateSetTimes
-        | Rights.FilestatGet
-        | Rights.FilestatSetSize
-        | Rights.FilestatSetTimes
-        | Rights.PathSymlink
-        | Rights.PathRemoveDirectory
-        | Rights.PathUnlinkFile
-        | Rights.PollFDReadWrite;
-
-    open_flags := cast(OFlags) 0;
-    fd_flags := flags;
-
-    switch mode {
-        case OpenMode.Write {
-            open_flags |= OFlags.Creat | OFlags.Trunc;
-            rights     |= Rights.Write;
-        }
-
-        case OpenMode.Append {
-            open_flags |= OFlags.Creat;
-            rights     |= Rights.Write;
-            fd_flags   |= FDFlags.Append;
-        }
-
-        case OpenMode.Read {
-            rights |= Rights.Read | Rights.Seek | Rights.Tell;
-        }
-    }
-
-    file := File.{ fd = -1 };
-
-    if err := wasi.path_open(
-        DIR_FD,
-        LookupFlags.SymLinkFollow,
-        path,
-        open_flags,
-        rights,
-        rights,
-        fd_flags,
-        ^file.fd);
-        err != Errno.Success {
-        return file, false;
-    }
-
-    file.mode   = mode;
-    file.rights = rights;
-    file.flags  = fd_flags;
-    return file, true;
-}
-
-file_close :: (file: File) -> bool {
-    if wasi.fd_close(file.fd) != Errno.Success {
-        return false;
-    }
-
-    return true;
-}
-
-file_write :: (file: File, data: str) {
-    vec := IOVec.{ buf = cast(u32) data.data, len = data.count };
-    tmp : Size;
-    wasi.fd_write(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^tmp);
-    wasi.fd_datasync(file.fd);
-}
-
-get_size :: (file: File) -> u64 {
-    fs: FileStat;
-    if wasi.fd_filestat_get(file.fd, ^fs) != Errno.Success do return 0;
-
-    return fs.size;
-}
-
-get_contents_from_file :: (file: File) -> str {
-    size := cast(u32) get_size(file);
-
-    data := cast(^u8) raw_alloc(context.allocator, size);
-
-    prev_loc: i64;
-    wasi.fd_tell(file.fd, ^prev_loc);
-
-    dummy: i64;
-    wasi.fd_seek(file.fd, 0, Whence.Set, ^dummy);
-
-    dummy2: u32;
-    buf := IOVec.{ cast(u32) data, size };
-    wasi.fd_pread(file.fd, IOVecArray.{ cast(u32) ^buf, 1 }, 0, ^dummy2);
-
-    wasi.fd_seek(file.fd, prev_loc, Whence.Set, ^dummy);
-
-    return data[0 .. size];
-}
-
-get_contents :: proc {
-    get_contents_from_file,
-
-    proc (path: str) -> str {
-        tmp_file, success := file_open(path, OpenMode.Read);
-        if !success do return str.{ null, 0 };
-        defer file_close(tmp_file);
-
-        return get_contents(tmp_file);
-    }
-}
-
-FileStream :: struct {
-    use stream : Stream;
-    use file   : File;
-}
-
-open :: (path: str, mode := OpenMode.Read) -> (Error, FileStream) {
-    fs := FileStream.{
-        stream = Stream.{ vtable = null },
-        file   = File.{ fd = -1 },
-    };
-
-    file, success := file_open(path, mode);
-    if !success do return Error.NotFound, fs;
-
-    fs.file = file;
-    fs.vtable = ^file_stream_vtable;
-    return Error.None, fs;
-}
-
-#private
-file_stream_vtable := Stream_Vtable.{
-    seek = (use fs: ^FileStream, to: i32, whence: SeekFrom) -> Error {
-        // Currently, the new offset is just ignored.
-        newoffset : wasi.Filesize;
-        error := wasi.fd_seek(file.fd, ~~ to, ~~ whence, ^newoffset);
-        if error != Errno.Success do return Error.BadFile;
-
-        return Error.None;
-    },
-
-    tell = (use fs: ^FileStream) -> (Error, u32) {
-        location : wasi.Filesize;
-        error := wasi.fd_tell(file.fd, ^location);
-        if error != Errno.Success do return Error.BadFile, 0;
-
-        return Error.None, ~~location;
-    },
-
-    read = (use fs: ^FileStream, buffer: [] u8) -> (Error, u32) {
-        bytes_read : wasi.Size;
-        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
-        error := wasi.fd_read(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_read);
-        if error != Errno.Success do return Error.BadFile, 0;
-
-        return Error.None, bytes_read;
-    },
-
-    read_at = (use fs: ^FileStream, at: u32, buffer: [] u8) -> (Error, u32) {
-        bytes_read : wasi.Size;
-        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
-        error := wasi.fd_pread(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ~~at, ^bytes_read);
-
-        // FIX: Maybe report Error.OutOfBounds if the 'at' was out of bounds?
-        if error != Errno.Success do return Error.BadFile, 0;
-
-        return Error.None, bytes_read;
-    },
-
-    read_byte = (use fs: ^FileStream) -> (Error, u8) {
-        bytes_read : wasi.Size;
-        byte  : u8;
-        vec   := IOVec.{ buf = cast(u32) ^byte, len = 1};
-        error := wasi.fd_read(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_read);
-        if error != Errno.Success do return Error.BadFile, 0;
-
-        return Error.None, byte;
-    },
-
-    unread_byte = (use fs: ^FileStream) -> Error {
-        return Error.NotImplemented;
-    },
-
-    write = (use fs: ^FileStream, buffer: [] u8) -> (Error, u32) {
-        bytes_written : wasi.Size;
-        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
-        error := wasi.fd_write(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_written);
-        if error != Errno.Success do return Error.BadFile, 0;
-
-        return Error.None, bytes_written;
-    },
-
-    write_at = (use fs: ^FileStream, at: u32, buffer: [] u8) -> (Error, u32) {
-        bytes_written : wasi.Size;
-        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
-        error := wasi.fd_pwrite(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ~~at, ^bytes_written);
-
-        // FIX: Maybe report Error.OutOfBounds if the 'at' was out of bounds?
-        if error != Errno.Success do return Error.BadFile, 0;
-
-        return Error.None, bytes_written;
-    },
-
-    write_byte = (use fs: ^FileStream, byte: u8) -> Error {
-        bytes_written : wasi.Size;
-        byte_to_write := byte;
-        vec   := IOVec.{ buf = cast(u32) ^byte_to_write, len = 1 };
-        error := wasi.fd_write(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_written);
-        if error != Errno.Success do return Error.BadFile;
-
-        return Error.None;
-    },
-
-    close = (use fs: ^FileStream) -> Error {
-        file_close(file);
-        return Error.None;
-    },
-
-    flush = (use fs: ^FileStream) -> Error {
-        wasi.fd_datasync(file.fd);
-        return Error.None;
-    },
-
-    size = (use fs: ^FileStream) -> i32 {
-        file_stat: FileStat;
-        if wasi.fd_filestat_get(file.fd, ^file_stat) != Errno.Success do return 0;
-
-        return ~~ file_stat.size;
-    },
-}
diff --git a/core/io/file.onyx b/core/io/file.onyx
new file mode 100644 (file)
index 0000000..3451d8f
--- /dev/null
@@ -0,0 +1,281 @@
+package core.io
+
+use package build_opts as build_opts
+#if build_opts.Runtime != build_opts.Runtime_Wasi {
+    #error "The file system library is currently only available on the WASI runtime, and should only be included if that is the chosen runtime."
+}
+
+use package core
+use package wasi as wasi
+use package wasi {
+    FileDescriptor,
+    FDFlags, OFlags, Rights,
+    LookupFlags, Errno,
+    IOVec, IOVecArray, Size,
+    FileStat, Whence
+}
+
+OpenMode :: enum {
+    Invalid;
+    Read;
+    Write;
+    Append;
+}
+
+File :: struct {
+    fd     : FileDescriptor;
+
+    mode   : OpenMode = OpenMode.Invalid;
+    rights : Rights   = ~~ 0;
+    flags  : FDFlags  = ~~ 0;
+}
+
+file_open :: (path: str, mode := OpenMode.Read, flags := FDFlags.Sync) -> (File, bool) {
+    // Currently the directory's file descriptor appears to always be 3
+    DIR_FD :: 3;
+
+    // Requesting all of the rights because why not.
+    rights :=
+        Rights.DataSync
+        | Rights.Read
+        | Rights.Seek
+        | Rights.FdStatSetFlags
+        | Rights.Sync
+        | Rights.Tell
+        | Rights.Write
+        | Rights.Advise
+        | Rights.Allocate
+        | Rights.PathCreateDirectory
+        | Rights.PathCreateFile
+        | Rights.PathLinkSource
+        | Rights.PathLinkTarget
+        | Rights.PathOpen
+        | Rights.ReadDir
+        | Rights.PathReadlink
+        | Rights.PathRenameSource
+        | Rights.PathRenameTarget
+        | Rights.PathFilestatGet
+        | Rights.PathFilestateSetSize
+        | Rights.PathFilestateSetTimes
+        | Rights.FilestatGet
+        | Rights.FilestatSetSize
+        | Rights.FilestatSetTimes
+        | Rights.PathSymlink
+        | Rights.PathRemoveDirectory
+        | Rights.PathUnlinkFile
+        | Rights.PollFDReadWrite;
+
+    open_flags := cast(OFlags) 0;
+    fd_flags := flags;
+
+    switch mode {
+        case OpenMode.Write {
+            open_flags |= OFlags.Creat | OFlags.Trunc;
+            rights     |= Rights.Write;
+        }
+
+        case OpenMode.Append {
+            open_flags |= OFlags.Creat;
+            rights     |= Rights.Write;
+            fd_flags   |= FDFlags.Append;
+        }
+
+        case OpenMode.Read {
+            rights |= Rights.Read | Rights.Seek | Rights.Tell;
+        }
+    }
+
+    file := File.{ fd = -1 };
+
+    if err := wasi.path_open(
+        DIR_FD,
+        LookupFlags.SymLinkFollow,
+        path,
+        open_flags,
+        rights,
+        rights,
+        fd_flags,
+        ^file.fd);
+        err != Errno.Success {
+        return file, false;
+    }
+
+    file.mode   = mode;
+    file.rights = rights;
+    file.flags  = fd_flags;
+    return file, true;
+}
+
+file_close :: (file: File) -> bool {
+    if wasi.fd_close(file.fd) != Errno.Success {
+        return false;
+    }
+
+    return true;
+}
+
+file_write :: (file: File, data: str) {
+    vec := IOVec.{ buf = cast(u32) data.data, len = data.count };
+    tmp : Size;
+    wasi.fd_write(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^tmp);
+    wasi.fd_datasync(file.fd);
+}
+
+get_size :: (file: File) -> u64 {
+    fs: FileStat;
+    if wasi.fd_filestat_get(file.fd, ^fs) != Errno.Success do return 0;
+
+    return fs.size;
+}
+
+get_contents_from_file :: (file: File) -> str {
+    size := cast(u32) get_size(file);
+
+    data := cast(^u8) raw_alloc(context.allocator, size);
+
+    prev_loc: i64;
+    wasi.fd_tell(file.fd, ^prev_loc);
+
+    dummy: i64;
+    wasi.fd_seek(file.fd, 0, Whence.Set, ^dummy);
+
+    dummy2: u32;
+    buf := IOVec.{ cast(u32) data, size };
+    wasi.fd_pread(file.fd, IOVecArray.{ cast(u32) ^buf, 1 }, 0, ^dummy2);
+
+    wasi.fd_seek(file.fd, prev_loc, Whence.Set, ^dummy);
+
+    return data[0 .. size];
+}
+
+get_contents :: proc {
+    get_contents_from_file,
+
+    proc (path: str) -> str {
+        tmp_file, success := file_open(path, OpenMode.Read);
+        if !success do return str.{ null, 0 };
+        defer file_close(tmp_file);
+
+        return get_contents(tmp_file);
+    }
+}
+
+FileStream :: struct {
+    use stream : Stream;
+    use file   : File;
+}
+
+open :: (path: str, mode := OpenMode.Read) -> (Error, FileStream) {
+    fs := FileStream.{
+        stream = Stream.{ vtable = null },
+        file   = File.{ fd = -1 },
+    };
+
+    file, success := file_open(path, mode);
+    if !success do return Error.NotFound, fs;
+
+    fs.file = file;
+    fs.vtable = ^file_stream_vtable;
+    return Error.None, fs;
+}
+
+#private
+file_stream_vtable := Stream_Vtable.{
+    seek = (use fs: ^FileStream, to: i32, whence: SeekFrom) -> Error {
+        // Currently, the new offset is just ignored.
+        newoffset : wasi.Filesize;
+        error := wasi.fd_seek(file.fd, ~~ to, ~~ whence, ^newoffset);
+        if error != Errno.Success do return Error.BadFile;
+
+        return Error.None;
+    },
+
+    tell = (use fs: ^FileStream) -> (Error, u32) {
+        location : wasi.Filesize;
+        error := wasi.fd_tell(file.fd, ^location);
+        if error != Errno.Success do return Error.BadFile, 0;
+
+        return Error.None, ~~location;
+    },
+
+    read = (use fs: ^FileStream, buffer: [] u8) -> (Error, u32) {
+        bytes_read : wasi.Size;
+        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
+        error := wasi.fd_read(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_read);
+        if error != Errno.Success do return Error.BadFile, 0;
+
+        return Error.None, bytes_read;
+    },
+
+    read_at = (use fs: ^FileStream, at: u32, buffer: [] u8) -> (Error, u32) {
+        bytes_read : wasi.Size;
+        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
+        error := wasi.fd_pread(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ~~at, ^bytes_read);
+
+        // FIX: Maybe report Error.OutOfBounds if the 'at' was out of bounds?
+        if error != Errno.Success do return Error.BadFile, 0;
+
+        return Error.None, bytes_read;
+    },
+
+    read_byte = (use fs: ^FileStream) -> (Error, u8) {
+        bytes_read : wasi.Size;
+        byte  : u8;
+        vec   := IOVec.{ buf = cast(u32) ^byte, len = 1};
+        error := wasi.fd_read(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_read);
+        if error != Errno.Success do return Error.BadFile, 0;
+
+        return Error.None, byte;
+    },
+
+    unread_byte = (use fs: ^FileStream) -> Error {
+        return Error.NotImplemented;
+    },
+
+    write = (use fs: ^FileStream, buffer: [] u8) -> (Error, u32) {
+        bytes_written : wasi.Size;
+        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
+        error := wasi.fd_write(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_written);
+        if error != Errno.Success do return Error.BadFile, 0;
+
+        return Error.None, bytes_written;
+    },
+
+    write_at = (use fs: ^FileStream, at: u32, buffer: [] u8) -> (Error, u32) {
+        bytes_written : wasi.Size;
+        vec   := IOVec.{ buf = cast(u32) buffer.data, len = buffer.count };
+        error := wasi.fd_pwrite(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ~~at, ^bytes_written);
+
+        // FIX: Maybe report Error.OutOfBounds if the 'at' was out of bounds?
+        if error != Errno.Success do return Error.BadFile, 0;
+
+        return Error.None, bytes_written;
+    },
+
+    write_byte = (use fs: ^FileStream, byte: u8) -> Error {
+        bytes_written : wasi.Size;
+        byte_to_write := byte;
+        vec   := IOVec.{ buf = cast(u32) ^byte_to_write, len = 1 };
+        error := wasi.fd_write(file.fd, IOVecArray.{ cast(u32) ^vec, 1 }, ^bytes_written);
+        if error != Errno.Success do return Error.BadFile;
+
+        return Error.None;
+    },
+
+    close = (use fs: ^FileStream) -> Error {
+        file_close(file);
+        return Error.None;
+    },
+
+    flush = (use fs: ^FileStream) -> Error {
+        wasi.fd_datasync(file.fd);
+        return Error.None;
+    },
+
+    size = (use fs: ^FileStream) -> i32 {
+        file_stat: FileStat;
+        if wasi.fd_filestat_get(file.fd, ^file_stat) != Errno.Success do return 0;
+
+        return ~~ file_stat.size;
+    },
+}
diff --git a/core/std.onyx b/core/std.onyx
new file mode 100644 (file)
index 0000000..ec6ad5c
--- /dev/null
@@ -0,0 +1,41 @@
+package core
+
+
+#load "core/build_opts"
+
+#load "core/alloc"
+#load "core/memory"
+
+#load "core/array"
+#load "core/map"
+
+#load "core/conv"
+#load "core/math"
+#load "core/random"
+
+#load "core/string"
+#load "core/string/builder"
+#load "core/string/reader"
+
+#load "core/intrinsics/wasm"
+
+#load "core/io/io"
+#load "core/io/stream"
+#load "core/io/reader"
+#load "core/io/writer"
+#load "core/io/binary"
+
+use package build_opts as build_opts
+#if build_opts.Runtime == build_opts.Runtime_Wasi {
+    #load "core/sys/wasi"
+    #load "core/wasi"
+    #load "core/io/file"
+}
+
+#if build_opts.Runtime == build_opts.Runtime_Js {
+    #load "core/sys/js"
+}
+
+#if build_opts.Runtime != build_opts.Runtime_Custom {
+    #load "core/stdio"
+}
diff --git a/core/std/js.onyx b/core/std/js.onyx
deleted file mode 100644 (file)
index 71ef69e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-package core
-
-
-
-#load "core/alloc"
-#load "core/array"
-#load "core/conv"
-#load "core/intrinsics/wasm"
-#load "core/map"
-#load "core/math"
-#load "core/memory"
-#load "core/random"
-#load "core/stdio"
-#load "core/string"
-#load "core/string/builder"
-#load "core/string/reader"
-
-#load "core/io/io"
-#load "core/io/stream"
-#load "core/io/reader"
-#load "core/io/writer"
-
-#load "core/sys/js"
-
-
diff --git a/core/std/wasi.onyx b/core/std/wasi.onyx
deleted file mode 100644 (file)
index 5b0db8b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package core
-
-
-
-#load "core/alloc"
-#load "core/array"
-#load "core/conv"
-#load "core/file"
-#load "core/intrinsics/wasm"
-#load "core/map"
-#load "core/math"
-#load "core/memory"
-#load "core/random"
-#load "core/stdio"
-#load "core/string"
-#load "core/string/builder"
-#load "core/string/reader"
-#load "core/wasi"
-
-#load "core/io/io"
-#load "core/io/stream"
-#load "core/io/reader"
-#load "core/io/writer"
-#load "core/io/binary"
-
-#load "core/sys/wasi"
-
-
index 39f0c4318bd65d9f336b88b8efca2e422c0ef049..47ac620bd91d904f5827708b30480b007c093b51 100644 (file)
@@ -9,7 +9,13 @@ package core
 
 // It is expected that a file will be included that will be part
 // of the system package
-use package system as system
+
+use package build_opts as build_opts
+#if build_opts.Runtime != build_opts.Runtime_Custom {
+    use package system as system
+} else {
+    #error "'stdio' can only be included in the 'wasi' or 'js' runtime."
+}
 
 #private_file print_stream : io.DynamicStringStream;
 #private_file print_writer : io.Writer;
index accfe9dda878c3f4a0eee706d7d8f3e766f7d53b..44691db8466d7d9e3c05e8c624a71957add7e2ea 100644 (file)
@@ -15,7 +15,7 @@ package main
 // added to the queue of files to load. When all files in the queue have been parsed,
 // the compiler can continue with the compilation process. You can also include the
 // same file as many times as you want. The redudant copies will be discarded.
-#load "core/std/wasi"
+#load "core/std"
 
 // All of the functionality we need is in the 'core' package. Unlike other package systems,
 // there is no way to reference symbols in a package without specifically 'using' it. This
index e0a83a755ca9377a83386a4946a83541b2e0e28e..98d2606a330988ff1cf29d1f09bfdc7be6a30b86 100644 (file)
@@ -1,7 +1,7 @@
 // This time, we are not adding, 'package main' to the top of the file, since
 // every file is automatically part of the main package unless specified otherwise.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index fa45ac56f22342e4838d2d7f2ad0d8a04ae71421..c3ca6b57603cb8bb17b761bafbd359be925dd382 100644 (file)
@@ -1,6 +1,6 @@
 // Now, lets go over the basic types and control flow mechanisms in Onyx.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 91bcace7c0d802d63356c15ed77428d157f966b0..6f005bf10c83271a3ec80f011497b34b1514c6c3 100644 (file)
@@ -15,7 +15,7 @@
 // This file will give examples of all of these things, as well as some of the gotchas
 // you need to be aware of.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index ac9ef0203b3acff31979bc223eab7b2534a5d0cc..bc2649cda6652490757b7c71884407517a167532 100644 (file)
@@ -5,7 +5,7 @@
 // is a powerful construct to have. In fact, strings in Onyx, i.e.
 // the 'str' type, is actually just a slice of u8.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 16b953867d15e90058fe31aa5441b19db98f323b..d41c7609e55240f64d78487ae3c73b022afa0824 100644 (file)
@@ -7,7 +7,7 @@
 // Dynamic arrays in Onyx are easy to use on purpose, because I
 // know how useful they are in almost every program I write.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 9e9d59a640d1e420e001bc338b81ad256cc64a41..03d56bd1e99e0de2321e85096c9e3e70edf300a8 100644 (file)
@@ -5,7 +5,7 @@
 // 'structs' in Onyx are very similar to structs in C and C++, with a couple
 // of additional capabilities to make using them even easier.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index fcee0f50fcaf025a595f56d089a504f33df93610..7d0044b82d88e32e15fb9caf0653f12705440506 100644 (file)
@@ -1,7 +1,7 @@
 // Enumerations (or enums for short) in Onyx work very similar to how they do
 // in C and C++.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index a8911705978e903ed2d2e14174b4cc770a40a4a9..28560ac64a72a92c9f455643f62a620645c73823 100644 (file)
@@ -4,7 +4,7 @@
 // in Onyx are extremely simple to use by design and should make programming very
 // enjoyable. But I digress, let's look at some examples.
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 3336f44d23bf201be35335f0db4ac368050ed991..0f8bc03eb4c5cd70c6301f16be0b8809eada1ac1 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 064edf5ab8876568e7848a30f0ad742b6468c1bb..86154af615ad577ffe7c9e9319e13dd2941c2546 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index a2e4dea14d5f5daff25e0155dff1e6070cdb2f39..ddf56f41c5dd009bcefd9aa428a6f83486b5c8e7 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index a2e4dea14d5f5daff25e0155dff1e6070cdb2f39..ddf56f41c5dd009bcefd9aa428a6f83486b5c8e7 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index a2e4dea14d5f5daff25e0155dff1e6070cdb2f39..ddf56f41c5dd009bcefd9aa428a6f83486b5c8e7 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index a2e4dea14d5f5daff25e0155dff1e6070cdb2f39..ddf56f41c5dd009bcefd9aa428a6f83486b5c8e7 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 5662fda6360ceb72719473546fccf8ebbaa86e94..107da554e33697306e90f35f254a3f56b4889428 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core { println }
 
index 7ca8f47aed78297c0c0d9082a4d301c321e47d42..40150f2c2c661e13b2652057c7e54d73c6e4bf60 100644 (file)
@@ -1007,6 +1007,17 @@ enum CompileAction {
     ONYX_COMPILE_ACTION_PRINT_HELP,
 };
 
+
+// ROBUSTNESS: The Runtime definitions here must match those in build_opts.onyx!!
+typedef enum Runtime Runtime;
+enum Runtime {
+    Runtime_Unknown = 0,
+    Runtime_Wasi    = 1,
+    Runtime_Js      = 2,
+    Runtime_Custom  = 3,
+};
+
+
 typedef struct CompileOptions CompileOptions;
 struct CompileOptions {
     bh_allocator allocator;
@@ -1019,6 +1030,8 @@ struct CompileOptions {
     
     b32 use_post_mvp_features : 1;
 
+    Runtime runtime;
+
     bh_arr(const char *) included_folders;
     bh_arr(const char *) files;
     const char* target_file;
index faabecef8fb3749912449cea678f51a749f5f564..1e601f2084d2f632d4340f8b13c6149bc1d978f8 100644 (file)
Binary files a/onyx.exe and b/onyx.exe differ
index 42cfc5618df31b340065a8f4791627ae2f1b3d85..309f06c40bc1fd161ba5bcce171c6bc19f9b8c40 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 #load "progs/foo_test"
 
 use package core
index 53768b2eeffdf7838cdf7478ce38adfdbf1fbed3..b52eec1738eeab22a518f984844dca0172c1ff01 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/wasi"
+#load "core/std"
 #load "core/intrinsics/simd"
 
 use package core
index 021834b4fedb218b05405adeb5c3bd0f2f2906b2..29c6219cfd936c111aa87d8c8c86800831767b2a 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/wasi"
+#load "core/std"
 
 use package core
 
index 7ec1563f135e39aa4d12a5e74e38c9e567242739..c3ea8149c56c574d70166487579543fd0196d39c 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/wasi"
+#load "core/std"
 #load "core/intrinsics/simd"
 
 use package core
index 0aeefed2f806811514bb533c82a85f902e108adb..14759e3830edc05cf8c235ad5c158c5aa232c4b7 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/wasi"
+#load "core/std"
 
 use package core;
 
index 70f6380f39de3aebcb25532ce103a0a25cb0d336..40f48b0ff7749208a5e0c585a6f9d3f1ebea8167 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/wasi"
+#load "core/std"
 
 // NOTE: Didn't realize this would work so easily
 use package core { string_builder_append as sba }
index 549b0f22812a9d9d3770cb9545953076be724bb9..8b26168f2689489249abab1b08d461a7474f080f 100644 (file)
@@ -38,6 +38,7 @@ static const char* docstring = "Onyx compiler version " VERSION "\n"
     "Flags:\n"
     "\t<input files>           List of initial files\n"
     "\t-o <target_file>        Specify the target file (default: out.wasm)\n"
+    "\t-r <runtime>            Specifies a runtime. Can be: wasi, js, custom.\n"
     "\t--verbose               Verbose output\n";
 
 static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *argv[]) {
@@ -50,6 +51,8 @@ static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *arg
         .print_function_mappings = 0,
         .use_post_mvp_features   = 0,
 
+        .runtime = Runtime_Wasi,
+
         .files = NULL,
         .target_file = "out.wasm",
     };
@@ -95,6 +98,16 @@ static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *arg
             else if (!strcmp(argv[i], "-I")) {
                 bh_arr_push(options.included_folders, argv[++i]);
             }
+            else if (!strcmp(argv[i], "-r")) {
+                i += 1;
+                if      (!strcmp(argv[i], "wasi"))   options.runtime = Runtime_Wasi;
+                else if (!strcmp(argv[i], "js"))     options.runtime = Runtime_Js;
+                else if (!strcmp(argv[i], "custom")) options.runtime = Runtime_Custom;
+                else {
+                    bh_printf("WARNING: '%s' is not a valid runtime. Defaulting to 'wasi'.\n", argv[i]);
+                    options.runtime = Runtime_Wasi;
+                }
+            }
 #if defined(_BH_LINUX)
             // NOTE: Fun output is only enabled for Linux because Windows command line
             // is not ANSI compatible and for a silly feature, I don't want to learn
index 0e630b3e7d737e64cd19642326b8124725853a69..6f25c6be28dd198e09142c28c84698c913d99a1a 100644 (file)
@@ -237,7 +237,7 @@ AstNumLit* ast_reduce_binop(bh_allocator a, AstBinaryOp* node) {
 #define REDUCE_UNOP_INT(op) \
     if (type_is_small_integer(unop->type) || type_is_bool(unop->type)) { \
         res->value.i = op ((AstNumLit *) unop->expr)->value.i; \
-    } else if (type_is_integer(unop->type)) { \
+    } else if (type_is_integer(unop->type) || res->type->Basic.kind == Basic_Kind_Int_Unsized) { \
         res->value.l = op ((AstNumLit *) unop->expr)->value.l; \
     }
 
index ca4ddb019020c4475a075f28f6b6b9e9570d6d81..a0936dc6763cc1339b2215e585e076323d16b146 100644 (file)
@@ -383,6 +383,6 @@ void initialize_builtins(bh_allocator a) {
 void introduce_build_options(bh_allocator a) {
     Package* p = package_lookup_or_create("build_opts", context.global_scope, a);
 
-    AstNumLit* runtime_type = make_int_literal(a, 1);
+    AstNumLit* runtime_type = make_int_literal(a, context.options->runtime);
     symbol_builtin_introduce(p->scope, "Runtime", (AstNode *) runtime_type);
 }
\ No newline at end of file
index b8a0b1a0889008af3017c33d7f9b36b8db18545c..161401cd71c5c69aac129b9fd6228ac72446fdc2 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 4477bf84bd41b22ba7f6f7af49310aceee4c9b07..20aec8723bfd48504815bfd70434bc78f8e157f3 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index e038e0f79d9d53bff10057ebe15c61625e66f8aa..b8a8b3273de911ed574d0f5a1a6a2be91dd28cd0 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 0b7c70d3d6aeddf2577a1fa7d174508ee2a16a4b..bd632b9865e2653c50ae3183ee5527856cf4deea 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index adbf691b218f6170885e63bc9e96e3f0a1edbf30..5ebc628736026d5e2fe70aecc36b8dafda5ed359 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 380dc1cce008570f57c2625619ef05315f9141db..55e77d3c8fe790628eff876ad14a5e2e98c0d0ea 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 804e1e9f3e69cfdc94d134108a473b514188ac8d..cfb0956444aad62f749fdae4136b6809fd32f37f 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 578847f9be8d43d4c745b04cd2c5b21cfb3cabf1..3e385ded4e88696da40e56f9007a1b253ccd3580 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 4cc8f30452d8292125fdd7d376af3ba91ba3e8fb..b658059184fe4fabc96818073eadb48e81243f44 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 93ec4a274ac84f6cbfba10c6612b5feb1c6a5593..e48da308e84073c831ce4b92d383f9d5b43d039c 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 2dd97c4e8a22cb58574feb49d49edf14e8a609cd..6183a30bd98a3e0eabb2ed9b7604ac9389296bf9 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 2685e06512929b720a2e80ed17e930e2a8831250..7f4044e8d02fa42c44593870ee214d0f0bfa499a 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index a7fe3278eb995389b045dcb9b6f0adc34e739f55..c91593e5366cc6e2808371c367bbef585074a738 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index dfe862c86f692d38888a795eb2f8005a4f9d09e5..82f01c172278e41efd1f01a1fc3a0aab634df5fd 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 393b0b8a63dbfd897476ae959c3d0069b278e42c..29912ed53bceaf2c885da5030814cad696398147 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 4d28fcbfd3ec50c9fdd0210cead37b79c851c604..55c634deacba905cc6772d0c33c61a5c4139f516 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 7d9cb5cd903c49382b380677f7c93a993b8f0f21..2fca89f652fc5bb6e58fc9243f89451d11bfd539 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 2f20fc22c75fc4bcb43beadf09ea3b8348b54829..eda4d68899fc75e3c1c540923184945d16d3c9da 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 95eb223d594ec7f55310394660eb7a26e141f25a..3e378ea265937e858d93b9ec7618019386a0b465 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 51387b42105fd935e7a929514cca1c3a1e80fd62..7f68201aa7045c96fdf0e7af928f70e9136c97b2 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index c2ac235835bfcea287591140ab0e8e664e5d6066..9fb1e42fd68c0f9cccf3de1a0c7c57c78891cb65 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index adf23213c5d517424775c3b20f29c29ef45c4124..b2d6d976e4d1dd6daf66b99588e3a702f7cbb025 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 3282b97688d965c1937f10255be9e6bbc4d2f3d9..3839db3f3bfa78ceee28e451da590ddc2a639b20 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 6a0a3f935f5da5ad9a422204ba18e0671741dc01..8acf6f04436cbe9815580949f050e3b521dc57b6 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 92f387a9ceabeb07d067cabb0ab5a7fba62fe723..c627820883bb0bc27395e7b3ed57e821e2607b62 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 use package core.string.reader as reader
index 17dfeb464656f7d4789ed7dfff6ed1175e04144c..e001f9d523e515aa75d72fd7fc09bb8b4e8e2021 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 7e707c5c7fd3a7781d4c06d962d2c04e11ec7a14..01feb48d486c7870a73f63d617197b9019115560 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index a850326129c9b94363d8c9f2624ac7210a78119e..eca8241628fd93ef4c121534f6d15fc946f9ef9f 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 45190817859cc6f3752cc560824da00d605b8cb1..7e390ce71f3d23f3bd17aff5479fc8cfe6f93bb3 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 8e25d1f81b9c0bb97581b7682e7c1633ba51822b..38695cb54f65bdfadbfc3e90b3fd905b5165ea73 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 3a309801963d2e5571a917f0d6bbbeec456bf2a1..aa793d3b69d6a07cde8416711ffc47b2b29a9e18 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index d43a198fea0bd798a9aa6d39ca50bb92f52d589b..c83cb05fe73806acf89534a1cae7bc374c6c1ffd 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index cbda0b4e0a1b220a2075a1967d610c6346373ed3..277908196ed32038810b8e09711963b8de175220 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 643393d6d50e61c9e2a1dc39ce1c0ae4dc7482d4..a43ae642a75a326fe86e9240f5b6b4a728ce78ee 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 9bb6887d13582681e5f72bd9fde7c39ab8b6f175..4f114fb150d48e4a5d403aaac9a519ade27842ca 100644 (file)
@@ -1,6 +1,6 @@
 // This is a needlessly complicated test of some of the newer features with structs.
 
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index bcc7ed0d528bcad40e1dd1443504dfe7cd65786b..f3aa5a90c6e17056cfc6e64923198b665ad38522 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 9048be22a4fe46ffe41fbffa7b0916126d3fa988..e790ac62a70d820dfa2172a4f09ee114df5bd62d 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 40394fa98330d0e4fe777e1c69cfc6519e8e679e..d49957f9410b0ed73c878018da5128f11d3e21c4 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 787693c70f0f2dbc4bbd2a4d36403e9370d4e298..822b2faf919c2c880ef03d56262287781ed85ef7 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 0da25100a8c14a1f41fa129ba7ba26d7e816434b..55a10a63931b290306c58cb6e14d356ce6bd65c4 100644 (file)
@@ -1,4 +1,4 @@
-#load "core/std/js"
+#load "core/std"
 
 use package core
 
index 70df0f08fca92519fed3b0d0338b53d867cb43ad..896d038cb190c2f01f28099abf59272e964a317d 100644 (file)
@@ -1,3 +1,5 @@
+#load "core/std"
+
 use package core
 
 main :: proc (args: [] cstr) {
@@ -191,5 +193,3 @@ main :: proc (args: [] cstr) {
         printf("PolyUnion(%i)\n", pu.r_data);
     }
 }
-
-#load "core/std/js"
\ No newline at end of file
index 988f355ed009874f19747b075efe1a94d06e1ee1..9bc287e86145c7e4528eedc27e5fdbdea9cb87ce 100644 (file)
@@ -1,6 +1,6 @@
 package main
 
-#load "core/std/js"
+#load "core/std"
 
 use package core;