Пример #1
0
/*
 * d i c t C r e a t e W o r d l i s t
 * Create and initialize an anonymous wordlist
 */
ficlHash *
ficlDictionaryCreateWordlist(ficlDictionary *dictionary, int bucketCount)
{
	ficlHash *hash;

	ficlDictionaryAlign(dictionary);
	hash = (ficlHash *)dictionary->here;
	ficlDictionaryAllot(dictionary,
	    sizeof (ficlHash) + (bucketCount - 1) * sizeof (ficlWord *));

	hash->size = bucketCount;
	ficlHashReset(hash);
	return (hash);
}
Пример #2
0
void *
ficlDictionaryAppendData(ficlDictionary *dictionary, void *data,
    ficlInteger length)
{
	char *here = (char *)dictionary->here;
	char *oldHere = here;
	char *from = (char *)data;

	if (length == 0) {
		ficlDictionaryAlign(dictionary);
		return ((char *)dictionary->here);
	}

	while (length) {
		*here++ = *from++;
		length--;
	}

	*here++ = '\0';

	dictionary->here = FICL_POINTER_TO_CELL(here);
	ficlDictionaryAlign(dictionary);
	return (oldHere);
}
Пример #3
0
/*
 * d i c t E m p t y
 * Empty the dictionary, reset its hash table, and reset its search order.
 * Clears and (re-)creates the hash table with the size specified by nHash.
 */
void
ficlDictionaryEmpty(ficlDictionary *dictionary, unsigned bucketCount)
{
	ficlHash *hash;

	dictionary->here = dictionary->base;

	ficlDictionaryAlign(dictionary);
	hash = (ficlHash *)dictionary->here;
	ficlDictionaryAllot(dictionary,
	    sizeof (ficlHash) + (bucketCount - 1) * sizeof (ficlWord *));

	hash->size = bucketCount;
	ficlHashReset(hash);

	dictionary->forthWordlist = hash;
	dictionary->smudge = NULL;
	ficlDictionaryResetSearchOrder(dictionary);
}
Пример #4
0
FICL_PLATFORM_EXTERN void        dictAlign      (ficlDictionary *dictionary) { ficlDictionaryAlign(dictionary); }