real relative imports

This commit is contained in:
2026-07-15 18:26:28 +02:00
parent 9bbd382e10
commit af08d1888a
47 changed files with 101 additions and 124 deletions

View File

@@ -1,4 +1,4 @@
include "std/mem.zr"
include "mem.zr"
struct Array
data: ptr

View File

@@ -1,5 +1,5 @@
include "std/str.zr"
include "std/os.zr"
include "str.zr"
include "os.zr"
func panic[msg: str] : void
io.printf("PANIC: %s\n", msg)
@@ -7,6 +7,10 @@ func panic[msg: str] : void
_builtin_syscall(SYS_kill, os.getpid(), SIGABRT)
os.exit(1)
func assert[cond: bool, msg: str] : void
if !cond
panic(msg)
func io.printf[..] : void
s := _var_arg(0) as ptr
i := 1
@@ -133,7 +137,7 @@ func io.read_binary_file[path: str] : Blob, bool
return buf, true
func io.write_file[path: str, content: str] : bool
func io.write_text_file[path: str, content: str] : bool
return io.write_binary_file(path, content as ptr, content->len())
func io.write_binary_file[path: str, content: ptr, size: i64] : bool

View File

@@ -1,4 +1,4 @@
include "std/containers.zr"
include "containers.zr"
const json.OBJECT = 0
const json.ARRAY = 1
@@ -76,6 +76,9 @@ func json.Value.free[v: json.Value] : void
(v as ptr)->free()
func json.val[x: any] : any
return (x as json.Value)->value
func json.parse[s: str] : json.Value
i := 0
return json._parse_value(s, ^i)

View File

@@ -1,5 +1,5 @@
include "std/linux_syscalls.zr"
include "std/num.zr"
include "linux_syscalls.zr"
include "num.zr"
const MEM_BLOCK_SIZE = 32

View File

@@ -1,4 +1,4 @@
include "std/os.zr"
include "os.zr"
const AF_INET = 2
const SOCK_STREAM = 1

View File

@@ -1,4 +1,4 @@
include "std/io.zr"
include "io.zr"
func i64.abs[n: i64] : i64
if n == -9223372036854775808

View File

@@ -1,7 +1,7 @@
include "std/posix.zr"
include "std/linux_syscalls.zr"
include "std/str.zr"
include "std/containers.zr"
include "posix.zr"
include "linux_syscalls.zr"
include "str.zr"
include "containers.zr"
func os.exit[code: i64] : void
_builtin_syscall(SYS_exit, code)

View File

@@ -1,5 +1,5 @@
include "std/num.zr"
include "std/mem.zr"
include "num.zr"
include "mem.zr"
func u8.is_whitespace[x: u8] : bool
return x == ' ' || x == '\n' || x == '\t' || x == '\r'