diff --git a/lib/sys/linux.q b/lib/sys/sys_linux.q similarity index 100% rename from lib/sys/linux.q rename to lib/sys/sys_linux.q diff --git a/lib/sys/sys_mac.q b/lib/sys/sys_mac.q new file mode 100644 index 0000000..9ef9e1f --- /dev/null +++ b/lib/sys/sys_mac.q @@ -0,0 +1,27 @@ +read(fd Int, address Pointer, length Int) -> Int { + return syscall(0x2000003, fd, address, length) +} + +write(fd Int, address Pointer, length Int) -> Int { + return syscall(0x2000004, fd, address, length) +} + +open(file Pointer, flags Int, mode Int) -> Int { + return syscall(0x2000005, file, flags, mode) +} + +close(fd Int) -> Int { + return syscall(0x2000006, fd) +} + +mmap(address Int, length Int, protection Int, flags Int) -> Pointer { + return syscall(0x20000C5, address, length, protection, flags) +} + +munmap(address Pointer, length Int) -> Int { + return syscall(0x2000049, address, length) +} + +exit(status Int) { + syscall(0x2000001, status) +} \ No newline at end of file diff --git a/src/scanner/queueDirectory.go b/src/scanner/queueDirectory.go index 167905b..f1abe54 100644 --- a/src/scanner/queueDirectory.go +++ b/src/scanner/queueDirectory.go @@ -4,6 +4,7 @@ import ( "path/filepath" "strings" + "git.akyoto.dev/cli/q/src/config" "git.akyoto.dev/cli/q/src/fs" ) @@ -20,6 +21,14 @@ func (s *Scanner) queueDirectory(directory string, pkg string) { return } + if strings.HasSuffix(name, "_linux.q") && config.TargetOS != "linux" { + return + } + + if strings.HasSuffix(name, "_mac.q") && config.TargetOS != "mac" { + return + } + fullPath := filepath.Join(directory, name) s.queueFile(fullPath, pkg) })