Phase 3: dictionary loading pipeline + binary embedding

- engine_init.cc: loads StenoDictionaryCollection from embedded binary,
  validates JSC4 magic + timestamp, constructs dict list + full processor
  pipeline (Repeat → AllUp → JeffModifiers → Engine)
- dict_embed.S: embeds compiled dict binary via .incbin directive.
  Falls back to null placeholder if no dict available
- CMakeLists.txt: dict binary discovery (dicts/steno_dict.bin or
  JAVELIN_DICT_BIN cmake var), assembly embedding
- tools/dict_compiler/compile_dict.py: stroke parser + skeleton compiler.
  Full JSC4 binary format not yet implemented — for now, use Javelin
  web tool (lim.au) to generate dict binary
- dicts/: directory for compiled dictionary binaries

Dict compiler is the remaining gap — JSC4 format requires exact XIP
pointer layout matching Javelin's C++ struct casting.
This commit is contained in:
afiqzudinhadi 2026-06-22 21:26:23 +08:00
parent d4dc836b52
commit 1751171667
6 changed files with 411 additions and 46 deletions

View file

@ -190,6 +190,30 @@ if(CONFIG_ZMK_JAVELIN_STENO)
${ZMK_BEHAVIOR_SRC}
)
# Dictionary binary embedding.
# Users place compiled dict at dicts/steno_dict.bin (or set
# JAVELIN_DICT_BIN via CMake cache / corne.conf extra args).
# If no dict found, a null placeholder is embedded and engine
# logs a warning at boot.
if(DEFINED JAVELIN_DICT_BIN)
set(DICT_BIN_PATH "${JAVELIN_DICT_BIN}")
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/dicts/steno_dict.bin")
set(DICT_BIN_PATH "${CMAKE_CURRENT_LIST_DIR}/dicts/steno_dict.bin")
else()
set(DICT_BIN_PATH "")
endif()
if(NOT "${DICT_BIN_PATH}" STREQUAL "")
set_source_files_properties(src/dict_embed.S PROPERTIES
COMPILE_DEFINITIONS "JAVELIN_DICT_BIN_PATH=\"${DICT_BIN_PATH}\""
)
message(STATUS "Javelin steno: embedding dictionary from ${DICT_BIN_PATH}")
else()
message(WARNING "Javelin steno: no dictionary binary found — engine will not start")
endif()
target_sources(app PRIVATE src/dict_embed.S)
endif() # central role check
endif() # CONFIG_ZMK_JAVELIN_STENO