WORD is defined as concatenating its inputs, so (WORD "a "b "c) outputs abc. Similarly (WORD "a CHAR 0 "c) outputs a three character word whose third character is c, even if it's hard to see. However, if you apply WORD to a word that has a CHAR 0 character within it (called a NUL character), every character after that character becomes the NUL character.
While this causes no problem in typical usage, it prevents FMSLogo from being used to manipulate binary data.
This is reproducible in UCBLogo 6.0 and MSWLogo 6.5b.
The cause is that WORD uses the C function strncpy, which stops copying at the first NUL character.
How Reproducible:
Every Time
Steps to Reproduce:
MAKE "x (WORD "a char 0 "c)
MAKE "y (WORD :x)
SHOW :x = :y
SHOW RAWASCII ITEM 3 :x
SHOW RAWASCII ITEM 3 :y
What Happens:
:x = :y outputs FALSE
RAWASCII ITEM 3 :x outputs 99 (ASCII for "c)
RAWASCII ITEM 3 :y outputs 0
Expected Result:
:x = :y outputs TRUE
RAWASCII ITEM 3 :x outputs 99 (ASCII for "c)
RAWASCII ITEM 3 :y outputs 99 (ASCII for "c)
This is fixed by [r5225]. The fix will be available in FMSLogo 7.7.0.
Related
Commit: [r5225]