Skip to main content

Module vocabulary_host

Module vocabulary_host 

Source
Expand description

kr_vocabulary: dictionary sources that engines adopt, without scheduling or native editing authority.

A vocabulary handle holds six vocabulary sources, the English and Russian Vim spell files and four learned-word slots, each with a configured path, flags, a generation and a current snapshot. Two locks keep the slow path away from the controller thread:

  acquisition  one Source per slot; held across file I/O by kr_vocabulary_observe
  published    path, flags, generation and snapshot per slot; held briefly by configure,
               adopt, and the start and end of observe

Observe takes acquisition before published and nothing takes them in the other order, so configure and adopt never wait for a file read. A configuration change advances the slot’s generation; an observation that began under the old generation finds the change when it locks published again and publishes nothing (STALE_CONFIGURATION). Adoption clones every snapshot under one lock, so an engine never pairs a language from before a change with one from after it.

Structs§

VocabularyHandle
kr_vocabulary: six vocabulary sources behind two locks, shared by the acquisition queue and the controller thread. Free only after every operation has completed.

Functions§

kr_adopt_vocabulary⚠
Adopt the language views and learned lists together, without changing session state or authority.
kr_vocabulary_configure⚠
Configure one logical source without I/O. Changed paths or flags immediately become missing.
kr_vocabulary_configure_default⚠
Configure one language’s Vim spell file under the absolute home directory, without I/O: .vim/spell (vimfiles\spell on Windows) and en.utf-8.add or ru.utf-8.add. A missing file there behaves as with MISSING_IS_EMPTY; a joined path over MAX_PATH is BOUNDS.
kr_vocabulary_free⚠
Free after all source and adoption operations have completed. Null is a no-op.
kr_vocabulary_new⚠
Allocate an isolated source handle with no configured paths or file reads.
kr_vocabulary_observe⚠
Observe on a serialized acquisition queue, outside UI/native input callbacks.