WORD: различия между версиями
Перейти к навигации
Перейти к поиску
AtH (обсуждение | вклад) Нет описания правки |
AtH (обсуждение | вклад) Нет описания правки |
||
Строка 27: | Строка 27: | ||
Типичное использование: | Типичное использование: | ||
char WORD ccc<char> | char WORD ccc<char> | ||
== WORD в предыдущем стандарте Forth-83 (англ.) == | |||
WORD char -- addr M,83 | |||
Generates a counted string by non-destructively accepting | |||
characters from the input stream until the delimiting | |||
character char is encountered or the input stream is | |||
exhausted. Leading delimiters are ignored. The entire | |||
character string is stored in memory beginning at addr as a | |||
sequence of bytes. The string is followed by a blank which | |||
is not included in the count. The first byte of the string | |||
is the number of characters {0..255}. If the string is | |||
longer than 255 characters, the count is unspecified. If | |||
the input stream is already exhausted as WORD is called, | |||
then a zero length character string will result. | |||
If the delimiter is not found the value of >IN is the size | |||
of the input stream. If the delimiter is found >IN is | |||
adjusted to indicate the offset to the character following | |||
the delimiter. #TIB is unmodified. | |||
The counted string returned by WORD may reside in the "free" | |||
dictionary area at HERE or above. Note that the text | |||
interpreter may also use this area. See: "input stream" | |||
Версия от 01:43, 7 сентября 2015
WORD — стандартное слово Каллисто.
Считывает одно слово из входного или экранного буфера и размещает его, начиная с адреса HERE
WORD в стандарте ANS Forth
6.1.2450 WORD CORE ( char "<chars>ccc<char>" -- c-addr ) Пропускает ведущие разделители. Выделяет символы ccc ограниченные char. Неопределенная ситуация существует, если длина выделенной строки больше чем длина определенной реализацией строки со счетчиком.
c-addr - адрес временной области, содержащей выделенное слово как строку со счетчиком. Если область анализа была пуста или не содержала других символов кроме разделителей, результирующая строка имеет нулевую длину. За строкой следует не включенный в длину пробел. Программа может изменять символы в пределах строки.
Примечание: Требование, о следовании пробела за строкой устаревшее и включено как уступка существующим программам, которые используют CONVERT. Программа не должна зависеть от существования пробела.
См.: 3.3.3.6 Другие временные области, 3.4.1 Синтаксический анализ.
A.6.1.2450 WORD Типичное использование: char WORD ccc<char>
WORD в предыдущем стандарте Forth-83 (англ.)
WORD char -- addr M,83 Generates a counted string by non-destructively accepting characters from the input stream until the delimiting character char is encountered or the input stream is exhausted. Leading delimiters are ignored. The entire character string is stored in memory beginning at addr as a sequence of bytes. The string is followed by a blank which is not included in the count. The first byte of the string is the number of characters {0..255}. If the string is longer than 255 characters, the count is unspecified. If the input stream is already exhausted as WORD is called, then a zero length character string will result.
If the delimiter is not found the value of >IN is the size of the input stream. If the delimiter is found >IN is adjusted to indicate the offset to the character following the delimiter. #TIB is unmodified.
The counted string returned by WORD may reside in the "free" dictionary area at HERE or above. Note that the text interpreter may also use this area. See: "input stream"
Ссылки
- Слово WORD в стандарте ANS Forth (англ.) и комментарии к нему (англ.)
- Слово WORD в черновике Forth 200x (англ.) и комментарий к нему (англ.)
У этой статьи нет иллюстраций. Вы можете помочь проекту, добавив их. |
Это заготовка статьи. Вы можете помочь проекту, дополнив её. |