duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 4bc10cd9d23b35431c82b09dd7c6b23dee1030ba
parent c360019cfde9a3a33a4272105d26ad686dea8ea8
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Fri, 24 Jun 2022 21:35:47 -0400

Add the "." word

Diffstat:
Mfs/lib/core.fs | 2++
Mfs/tests/lib/core.fs | 3+++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/lib/core.fs b/fs/lib/core.fs @@ -85,6 +85,8 @@ create _ ," 0123456789abcdef" : .x1 dup 4 rshift .xh .xh ; : .x2 dup 8 rshift .x1 .x1 ; : .x dup 16 rshift .x2 .x2 ; +: _ 10 /mod ( r q ) ?dup if _ then '0' + emit ; +: . ?dup not if '0' emit else dup 0< if '-' emit 0 -^ _ else _ then then ; \ Autoloading \ entries in the floaded list have both a length byte and diff --git a/fs/tests/lib/core.fs b/fs/tests/lib/core.fs @@ -4,6 +4,9 @@ testbegin \ Number formatting 42 capture .x1 S" 2a" #s= $1234 capture .x S" 00001234" #s= +42 capture . S" 42" #s= +-1984 capture . S" -1984" #s= +0 capture . S" 0" #s= \ does words : incer doer , does> @ 1+ ;