/* * d i c t A p p e n d W o r d * Create a new word in the dictionary with the specified * ficlString, code, and flags. Does not require a NULL-terminated * name. */ ficlWord * ficlDictionaryAppendWord(ficlDictionary *dictionary, ficlString name, ficlPrimitive code, ficlUnsigned8 flags) { ficlUnsigned8 length = (ficlUnsigned8)FICL_STRING_GET_LENGTH(name); char *nameCopy; ficlWord *word; ficlDictionaryLock(dictionary, FICL_TRUE); /* * NOTE: ficlDictionaryAppendString advances "here" as a side-effect. * It must execute before word is initialized. */ nameCopy = ficlDictionaryAppendString(dictionary, name); word = (ficlWord *)dictionary->here; dictionary->smudge = word; word->hash = ficlHashCode(name); word->code = code; word->semiParen = ficlInstructionSemiParen; word->flags = (ficlUnsigned8)(flags | FICL_WORD_SMUDGED); word->length = length; word->name = nameCopy; /* * Point "here" to first ficlCell of new word's param area... */ dictionary->here = word->param; if (!(flags & FICL_WORD_SMUDGED)) ficlDictionaryUnsmudge(dictionary); ficlDictionaryLock(dictionary, FICL_FALSE); return (word); }
FICL_PLATFORM_EXTERN void dictUnsmudge (ficlDictionary *dictionary) { ficlDictionaryUnsmudge(dictionary); }