pfe-zchar-ext
Prev? | pfe Forth Wordset List | ?

## Name

pfe-zchar-ext ? ZCHAR-EXT - zero-terminated C-like charstrings

## Synopsis

`Z" ( [chars&lt;"&gt;] -- z* ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`ZCOUNT ( z* -- z* len ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`ZSTRLEN ( z* -- len ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`ZMOVE ( zsrc* zdest* -- ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`ZPLACE ( addr* len zaddr* -- ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`+ZPLACE ( caddr* u zdest* -- ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`S\" ( [backslashed-strings_&lt;"&gt;] -- str cnt ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`C\" ( [backslashed-strings_&lt;"&gt;] -- bstr* ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

`Z\" ( [backslashed-strings_&lt;"&gt;] -- zstr* ) ?=>? (` | `)`; | ?

`[FORTH]`;
?

## Description

Z" ( [chars&lt;"&gt;] -- z* ) => [FORTH]

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 `ALLOT`ed into the dictionary.

ZCOUNT ( z* -- z* len ) => [FORTH]

push length of z-string, additionally to the string addr itself.

      : ZSTRLEN ZCOUNT NIP ;

(see libc strlen(3)) / compare with `COUNT` / `ZSTRLEN`

ZSTRLEN ( z* -- len ) => [FORTH]

push length of z-string.

      : ZSTRLEN ZCOUNT NIP ;

(see libc strlen(3)) / compare with `ZMOVE` / `CMOVE`

ZMOVE ( zsrc* zdest* -- ) => [FORTH]

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

ZPLACE ( addr* len zaddr* -- ) => [FORTH]

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

+ZPLACE ( caddr* u zdest* -- ) => [FORTH]

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`

S\" ( [backslashed-strings_&lt;"&gt;] -- str cnt ) => [FORTH]

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 [']

C\" ( [backslashed-strings_&lt;"&gt;] -- bstr* ) => [FORTH]

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 [']

Z\" ( [backslashed-strings_&lt;"&gt;] -- zstr* ) => [FORTH]

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 [']

Prev? | Up | ?
pfe-your-ext? | Home | ?