diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-03-29 20:25:04 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-03-29 20:25:04 -0400 |
commit | a282af0b8fd4102778d6d8781c29f1c0202e13ee (patch) | |
tree | 645cb1db4d206eef65ce071f064a911473a0a50a /tnslc/tnslc.tnsl | |
parent | 606ab9da9e4231564c91e4613bfbbb8883f7eb9d (diff) |
int and string conversion algo
Diffstat (limited to 'tnslc/tnslc.tnsl')
-rw-r--r-- | tnslc/tnslc.tnsl | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl index 23d3531..852d22e 100644 --- a/tnslc/tnslc.tnsl +++ b/tnslc/tnslc.tnsl @@ -17,7 +17,7 @@ usage: ~uint8 char_str = "%c\0" ~uint8 newline = "\n\0" -~uint8 rel_pth = "../../tnslc.tnsl\0" +~uint8 scratch = "1234\0" /; main (int argc, ~~uint8 argv) [int] asm "mov r10, rdi" @@ -27,30 +27,14 @@ usage: _printf(USAGE) return 1 ;/ - - utils.File fin - fin.init(argv{1}) - fin.open() - - /; if (fin.at_end == true) - _printf(FOPEN_ERR) - fin.end() - return 2 - ;/ - - /; loop (fin.at_end == false) - _print_num(char_str, fin.read()) - ;/ - - utils.File rel = fin.relative(rel_pth) - ~uint8 str = rel.path.to_cstr('/') - _printf(str) + + int i = utils.cstr_to_int(scratch) + _print_num(utils.NUM_STR, 0 - i) + i = 0 - i + ~uint8 s = utils.int_to_str(i) + _printf(s) _printf(newline) - _delete(str) - rel.end() - - fin.close() - fin.end() + _delete(s) return 0 ;/ |