From c08a44ae0f39f637dbdc11938776300027bd59b1 Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 30 Nov 2023 20:22:49 -0800 Subject: [PATCH] (format-c) Use file name --- cli/format-c/format-c.tal | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/cli/format-c/format-c.tal b/cli/format-c/format-c.tal index 0ae79af..7dbb097 100644 --- a/cli/format-c/format-c.tal +++ b/cli/format-c/format-c.tal @@ -22,7 +22,9 @@ @ ( src* -- ) ;src .File/name DEO2 #0001 .File/length DEO2 - ;dict/header + ;dict/a + ;src + ;dict/b [ LIT2r 0000 ] &stream ( -- ) ;&buf feof ?&end @@ -37,7 +39,15 @@ #0918 DEO } !&stream &end POP2r #0a18 DEO - ;dict/footer ! + ;dict/c ! + +@ ( src* -- ) + scap/ [ LIT "/ ] srew + &w ( -- ) + LDAk [ LIT ". ] EQU ?&end + LDAk #18 DEO + INC2 LDAk ?&w + &end POP2 JMP2r ( @|stdlib ) @@ -48,6 +58,13 @@ #00 JMP2r } POP2 #01 JMP2r +@srew ( str* char -- ) + ,&t STR + &w ( -- ) + LDAk [ LIT &t $1 ] EQU ?&end + #0001 SUB2 LDAk ?&w + &end INC2 JMP2r + @scap ( str* -- end* ) &w ( -- ) INC2 & LDAk ?&w @@ -71,6 +88,7 @@ INC2 & LDAk ?&w POP2 JMP2r -@dict &header "unsigned 20 "char 20 "rom[] 20 "= 20 "{ 0a 09 $1 - &footer "}; 0a 00 +@dict &a "unsigned 20 "char 20 $1 + &b "[] 20 "= 20 "{ 0a 09 $1 + &c "}; 0a 00