Forth-83 spec定义单词expect
,如下所示:
EXPECT addr +n -- M,83
Receive characters and store each into memory. The transfer
begins at addr proceeding towards higher addresses one byte
per character until either a "return" is received or until
+n characters have been transferred. No more than +n
characters will be stored. The "return" is not stored into
memory. No characters are received or transferred if +n is
zero. All characters actually received and stored into
memory will be displayed, with the "return" displaying as a
space.
因此,它会读取但不包括RETURN或EOL。
但是如果没有终止符,并且没有返回读取的字符数,我怎么知道字符串的结束位置?
Leo Brodie引用了一个单词accept
,它有一些非常相似的东西,它有一个签名( addr +n -- +m )
。这确实会返回读取的字符数,这正是我所期望的。但那不符合规范......