示例#1
0
/*
 * i s A F i c l W o r d
 * Vet a candidate pointer carefully to make sure
 * it's not some chunk o' inline data...
 * It has to have a name, and it has to look
 * like it's in the dictionary address range.
 * NOTE: this excludes :noname words!
 */
int
ficlDictionaryIsAWord(ficlDictionary *dictionary, ficlWord *word)
{
	if ((((ficlInstruction)word) > ficlInstructionInvalid) &&
	    (((ficlInstruction)word) < ficlInstructionLast))
		return (1);

	if (!ficlDictionaryIncludes(dictionary, word))
		return (0);

	if (!ficlDictionaryIncludes(dictionary, word->name))
		return (0);

	if ((word->link != NULL) &&
	    !ficlDictionaryIncludes(dictionary, word->link))
		return (0);

	if ((word->length <= 0) || (word->name[word->length] != '\0'))
		return (0);

	if (strlen(word->name) != word->length)
		return (0);

	return (1);
}
示例#2
0
ficlWord *
ficlDictionaryFindEnclosingWord(ficlDictionary *dictionary, ficlCell *cell)
{
	ficlWord *word;
	int i;

	if (!ficlDictionaryIncludes(dictionary, (void *)cell))
		return (NULL);

	for (i = nSEARCH_CELLS; i > 0; --i, --cell) {
		word = (ficlWord *)
		    (cell + 1 - (sizeof (ficlWord) / sizeof (ficlCell)));
		if (ficlDictionaryIsAWord(dictionary, word))
			return (word);
	}

	return (NULL);
}
示例#3
0
FICL_PLATFORM_EXTERN int         dictIncludes   (ficlDictionary *dictionary, void *p) { return ficlDictionaryIncludes(dictionary, p); }