From d2488689fece53ac60f59ef79a22a684346fdaf7 Mon Sep 17 00:00:00 2001 From: Able Date: Tue, 17 Sep 2024 09:52:27 -0500 Subject: [PATCH] fixs --- Cargo.lock | 36 ++--------- sysdata/libraries/stn/src/acs.hb | 2 +- sysdata/libraries/stn/src/file_io.hb | 9 +-- sysdata/libraries/stn/src/string.hb | 61 +++++++++---------- sysdata/programs/filesystem_fat32/src/main.hb | 6 +- 5 files changed, 40 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43920a6..38975d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,9 +148,9 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cc" -version = "1.1.19" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" +checksum = "45bcde016d64c21da4be18b655631e5ab6d3107607e71a73a9f53eb48aae23fb" dependencies = [ "shlex", ] @@ -390,33 +390,17 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -<<<<<<< HEAD -<<<<<<< HEAD source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" -======= -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" ->>>>>>> 1f4fce0 (please bugs begone) -======= -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" ->>>>>>> 41b339d (omfg it's fixed 🙏) [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" +source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" [[package]] name = "hblang" version = "0.1.0" -<<<<<<< HEAD -<<<<<<< HEAD source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" -======= -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" ->>>>>>> 1f4fce0 (please bugs begone) -======= -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" ->>>>>>> 41b339d (omfg it's fixed 🙏) dependencies = [ "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -424,15 +408,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -<<<<<<< HEAD -<<<<<<< HEAD source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" -======= -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" ->>>>>>> 1f4fce0 (please bugs begone) -======= -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" ->>>>>>> 41b339d (omfg it's fixed 🙏) dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", ] @@ -440,7 +416,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28" +source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" dependencies = [ "hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes.git)", ] @@ -1307,9 +1283,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" dependencies = [ "indexmap", "serde", diff --git a/sysdata/libraries/stn/src/acs.hb b/sysdata/libraries/stn/src/acs.hb index 4a58c2b..2f4ac8e 100644 --- a/sysdata/libraries/stn/src/acs.hb +++ b/sysdata/libraries/stn/src/acs.hb @@ -7,4 +7,4 @@ DeviceID := struct { id: int, } -DiskID := DeviceID +DiskID := DeviceID \ No newline at end of file diff --git a/sysdata/libraries/stn/src/file_io.hb b/sysdata/libraries/stn/src/file_io.hb index 70ec741..68ad9a1 100644 --- a/sysdata/libraries/stn/src/file_io.hb +++ b/sysdata/libraries/stn/src/file_io.hb @@ -1,14 +1,9 @@ acs := @use("rel:acs.hb") - // Paths without a node-disk component are to be treated as local files. // file_path := "DID:/test\0"; -Path := struct { - // DiskID holds the host id - disk_id: acs.DiskID - length: u8, - data: ^u8 -} +Path := struct {// DiskID holds the host id +disk_id: acs.DiskID, length: u8, data: ^u8} FileID := struct { host_id: int, diff --git a/sysdata/libraries/stn/src/string.hb b/sysdata/libraries/stn/src/string.hb index cc20d81..042de02 100644 --- a/sysdata/libraries/stn/src/string.hb +++ b/sysdata/libraries/stn/src/string.hb @@ -3,6 +3,8 @@ length := fn(ptr: ^u8): int { loop if *(ptr + len) == 0 break else len += 1 return len } + +// WTFFF is wrong with display_int display_int := fn(num: int, p: ^u8): ^u8 { ptr := p negative := num < 0 @@ -10,42 +12,37 @@ display_int := fn(num: int, p: ^u8): ^u8 { num = -num } if num == 0 { - *p = 48; - *(p + 1) = 0 - return p + *ptr = 48 + ptr += 1 + } else { + loop if num == 0 break else { + *ptr = num % 10 + 48 + ptr += 1 + num /= 10 + } } - - neg := false - if num < 0 { - neg = true - num = -num - } - - loop if num == 0 break else { - *(p + i) = num % 10 + 48 - num /= 10 - i += 1 - } - - if neg { - *(p + i) = 45 - i += 1 - } - - reverse(p, i) - + if negative { + *ptr = 45 + ptr += 1 + }; + *ptr = 0 + @inline(reverse, p) return p } -reverse := fn(p: ^u8, len: int): void { - start := 0 - end := len - 1 - loop if start >= end break else { - temp := *(p + start); - *(p + start) = *(p + end); - *(p + end) = temp - start += 1 - end -= 1 +reverse := fn(s: ^u8): void { + //reverse a string, don't remove digits + len := 0 + loop if *(s + len) == 0 break else len += 1 + i := 0 + j := len - 1 + temp := 0 + loop if i >= j break else { + temp = *(s + i); + *(s + i) = *(s + j); + *(s + j) = temp + i += 1 + j -= 1 } return } \ No newline at end of file diff --git a/sysdata/programs/filesystem_fat32/src/main.hb b/sysdata/programs/filesystem_fat32/src/main.hb index 5778b4f..d662dd0 100644 --- a/sysdata/programs/filesystem_fat32/src/main.hb +++ b/sysdata/programs/filesystem_fat32/src/main.hb @@ -45,13 +45,11 @@ main := fn(): int { msg_type := 0 - loop { - // Open file + // Open file if msg_type == 0 { // Paths without a node-disk component are to be treated as local files. - file_path := "node-disk:/test\0"; - + file_path := "node-disk:/test\0" } else { // error }