The word which BUTFIRST outputs ends at the first NUL (CHAR 0) character in the input word. As a result, when used BUTFIRST is used in iteration it won't iterate to any any characters past the first NUL. This prevents some template operators like MAP from working correctly when the word has more than one NUL.
This is a regression in FMSLogo 6.7.0.
Steps to Reproduce:
1) SHOW BUTFIRST WORD CHAR 0 "x
2) SHOW BUTFIRST (WORD CHAR 0 CHAR 0 "x)
3) SHOW BUTFIRST BUTFIRST (WORD CHAR 0 CHAR 0 "x)
What Happens
1) Prints x, as expected.
2) Prints nothing. This is expected, because NUL stops printing.
3) Prints nothing. This is the bug.
Expected Result:
1) Prints x
2) Prints nothing
3) Prints x
Likelihood:
Low. NUL characters are very rare in FMSLogo. I've only experienced them when using DLLCALL to get binary data from outside the standard proceedure library, which was only made possible in FMSLogo 7.1.0. NUL characters are very common in binary data.
Impact:
Medium. Confusion. It also forces the programmer to use less natural instructions for manipulating the data. That said, I haven't yet been completely blocked from doing what I need to, but I have written code that I'll cleanup/rewrite once this bug is fixed.
This was fixed in FMSLogo 7.7.0 by the fix for Bug #540. The fix was [r5225].
Related
Bugs:
#540Commit: [r5225]