summaryrefslogtreecommitdiff
path: root/tnslc/tnslc.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-29 20:25:04 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-29 20:25:04 -0400
commita282af0b8fd4102778d6d8781c29f1c0202e13ee (patch)
tree645cb1db4d206eef65ce071f064a911473a0a50a /tnslc/tnslc.tnsl
parent606ab9da9e4231564c91e4613bfbbb8883f7eb9d (diff)
int and string conversion algo
Diffstat (limited to 'tnslc/tnslc.tnsl')
-rw-r--r--tnslc/tnslc.tnsl32
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
;/