string wordset

description

-- The Optional String Word Set

Copyright (C) Tektronix, Inc. 1998 - 2001. All rights reserved.

description: The basic words for handling string buffers. There are much more buffer words used in most Forth implementations around but they can usually implemented as colon-word quite effectivly on the basis of the STRING wordset.

FORTH
-TRAILING ( str-ptr str-len -- str-ptr str-len' )(); 
 ;

check the given buffer if it contains whitespace at its end. If so, shorten str-len to meet the last non-whitespace character in the buffer.

dpANS 17.6.1.0170 - standard forth word

FORTH
/STRING ( str-ptr str-len n -- str-ptr' str-len' )(); 
 ;

shorten the buffer from the beginning by n characters, i.e.

  str-ptr += n ;
  str-len -= n; 
 

dpANS 17.6.1.0245 - standard forth word

FORTH

BLANK ( str-ptr str-len -- )();
p4:"blank";

FILL a given buffer with BL blanks

dpANS 17.6.1.0780 - standard forth word

FORTH
CMOVE ( from-ptr to-ptr len -- )(); 
 ;

memcpy an area from->to for len bytes, starting at the lower addresses, see CMOVE>

dpANS 17.6.1.0910 - standard forth word

FORTH
CMOVE> ( from-ptr to-ptr len -- )(); 
 ;

memcpy an area from->to for len bytes, starting with the higher addresses, see CMOVE

FORTH
COMPARE ( str-ptr1 str-len1 str-ptr2 str-len2 -- n )(); 
 ;

compare both str-buffers, return 0 if they are equal, -1 if lower or shorter, and 1 if greater or longer

dpANS 17.6.1.0935 - standard forth word

FORTH
SEARCH ( str-ptr1 str-len1 str-ptr2 str-len2 -- str-ptr1' str-len1' flag )(); 
 ;

search the str-buffer1 for the text of str-buffer2, if it is contained return TRUE and return buffer-values that point to the contained string, otherwise return FALSE and leave the original str-buffer1.

dpANS 17.6.1.2191 - standard forth word

FORTH

SLITERAL ( -- string )();
p4:"sliteral";

 compile-time: ( CS: str-ptr str-len -- )

this word does almost the same as LITERAL - it takes an S" string as specified in the CS-STACK at compile time and compiles into the current definition where it is returned as if there were a direct string-literal. This can be used to compute a string-literal at compile-time and hardwire it.

 example:
   : ORIGINAL-HOME  [ $HOME COUNT ] SLITERAL ; ( -- str-ptr str-len )
 

dpANS 17.6.1.2212 - standard forth word

ENVIRONMENT

STRING-EXT ( .. )();
as:"string-minus-ext";

( 1994  )  constant STRING-EXT

an ordinary constant (no special usage info)