"ZCHAR-EXT - zero-terminated C-like charstrings"

zchar FORTH
* Z" ( [chars<">] -- z* )

scan the input to the next doublequote and create a buffer
that holds the chars - return the address of that zero-terminated
string-buffer, either POCKET-PAD or ALLOTed into the dictionary.

FORTH/BASE zchar compiling primitive

* ZCOUNT ( z* -- z* len )

push length of z-string, additionally to the string addr itself.
 : ZSTRLEN ZCOUNT NIP ;
(see libc strlen(3)) / compare with COUNT / ZSTRLEN

FORTH/BASE zchar ordinary primitive

* ZSTRLEN ( z* -- len )

push length of z-string.
 : ZSTRLEN ZCOUNT NIP ;
(see libc strlen(3)) / compare with ZMOVE / CMOVE

FORTH/BASE zchar ordinary primitive

* ZMOVE ( zsrc* zdest* -- )

copy a zero terminated string
(see libc strcpy(3)) / compare with ZSTRLEN / COUNT

FORTH/BASE zchar ordinary primitive

* ZPLACE ( addr* len zaddr* -- )

copy string and place as 0 terminated
(see libc strncpy(3)) / see also +ZPLACE / Z+PLACE

FORTH/BASE zchar ordinary primitive

* +ZPLACE ( caddr* u zdest* -- )

Add the string defined by CADDR LEN to the zero terminated string
at ZDEST - (for older scripts the SYNONYM named APPENDZ exists)
(see libc strncat(3)) / compare with ZPLACE / +PLACE

FORTH/BASE zchar ordinary primitive

APPENDZ

[] no special info, see general notes

FORTH/BASE zchar forthword synonym

* S\" ( [backslashed-strings_<">] -- str cnt )

scan the following text to create a literal just
like S" does, but backslashes can be used to
escape special chars. The rules for the backslashes
follow C literals, implemented techniques are
\n \r \b \a \f \v \e \777
and all non-alnum chars represent themselves, esp.
\" \' \ \? \! \% \( \) \[ \] \{ \} etcetera.
most importantly the doublequote itself can be escaped.
but be also informed that the usage of \' and \" is not
portable as some systems preferred to map [\'] into ["].
Here I use the experimental addition to map [\q] to ["] and [\i] to [']

FORTH/BASE zchar compiling primitive

* C\" ( [backslashed-strings_<">] -- bstr* )

scan the following text to create a literal just
like C" does, but backslashes can be used to
escape special chars. The rules for the backslashes
follow C literals, implemented techniques are
\n \r \b \a \f \v \e \777
and all non-alnum chars represent themselves, esp.
\" \' \ \? \! \% \( \) \[ \] \{ \} etcetera.
most importantly the doublequote itself can be escaped.
but be also informed that the usage of \' and \" is not
portable as some systems preferred to map [\'] into ["].
Here I use the experimental addition to map [\q] to ["] and [\i] to [']

FORTH/BASE zchar compiling primitive

* Z\" ( [backslashed-strings_<">] -- zstr* )

scan the following text to create a literal just
like Z" does, but backslashes can be used to
escape special chars. The rules for the backslashes
follow C literals, implemented techniques are
\n \r \b \a \f \v \e \777
and all non-alnum chars represent themselves, esp.
\" \' \ \? \! \% \( \) \[ \] \{ \} etcetera.
most importantly the doublequote itself can be escaped
but be also informed that the usage of \' and \" is not
portable as some systems preferred to map [\'] into ["].
Here I use the experimental addition to map [\q] to ["] and [\i] to [']

FORTH/BASE zchar compiling primitive

ENVIRONMENT ENVIRONMENT ZCHAR-EXT

[] no special info, see general notes

ENVIRONMENT zchar ordinary constant