Name

name-to-string:header — ordinary primitive

Synopsis

FORTH
NAME>STRING ( name-token -- str-ptr str-len )(); 
 ;

Description

convert a name-token into a string-span, used to detect the name for a word and print it. The word ID. can be defined as

 : ID. NAME>STRING TYPE ;

the implementation of NAME>STRING depends on the header layout that is defined during the configuration of the forth system.

 : NAME>STRING COUNT 31 AND ; ( for fig-like names )
 : NAME>STRING COUNT ;        ( default, name is a simple counted string )
 : NAME>STRING @ ZCOUNT ;     ( name-token is a pointer to a C-level string )
 : NAME>STRING COUNT 31 AND   ( hybrid of fig-like and zero-terminated )
      DUP 31 = IF DROP 1+ ZCOUNT THEN
 ;
 : NAME>STRING HEAD:: COUNT CODE:: PAD PLACE PAD ; ( different i86 segments )