\ asciiz 10/18/97 gwj \ words for dealing with \ nul-terminated strings \ store asciiz string : z! ( z addr -- ) swap begin 2dup c@ dup >r swap c! 1+ swap 1+ swap r> 0= until 2drop ; \ find the length of an asciiz string : zlen ( z -- n ) dup begin dup c@ while 1+ repeat swap - ; \ convert asciiz into addr & cnt : zcount ( z -- addr cnt ) dup zlen ; \ display an asciiz string : z. ( z -- ) zcount type ; \ store addr&cnt as asciiz : strz! ( addr1 cnt addr2 -- ) >r tuck r@ swap chars move r> + 0 swap c! ; \ store counted string as asciiz : $z! ( $ addr -- ) swap count rot strz! ; \ comma an asciiz string into the \ dictionary : z, ( z -- ) here over zlen char+ allot z! ; \ comma a counted string into the \ dictionary as an asciiz string : $z, ( z -- ) here over c@ char+ allot $z! ; \ build an asciiz literal : z" ( -- $ ) state @ if postpone ahead [char] " word here >r $z, align postpone then r> postpone literal else [char] " word here tuck $z! then ; immediate \ create an asciiz string constant : zconstant ( z ; name -- ) here swap z, constant ; \ create an asciiz string constant \ from a counted string : $zconstant ( $ ; name -- ) here swap $z, constant ;