[WIP] Add C API shared library (dasher.h / CAPI.cpp)#11
Open
willwade wants to merge 36 commits into
Open
Conversation
Expose DasherCore as a flat C shared library for cross-platform FFI. Includes command-buffer screen, pointer input, settings, and output text access. Builds as dasher.dll / libdasher.so via BUILD_CAPI cmake option.
Added set_target_properties(DasherCore PROPERTIES POSITION_INDEPENDENT_CODE ON) to make sure the static library is compiled with -fPIC so it can be linked into a shared library. should pass gh action build now
..that make working with ARGB colors much easier for frontends
Use %f instead of Windows-specific %I64Ld format specifier for double values in function timing output. compiles nicely on all platforms
- ColorIO: ParseLegacy() handles old <colours>/<palette>/<colour> format
- ColorIO: maps positional colour indices to named groups used by alphabets
- CAPI: colorToARGB detects Color{0,0,0,1} (0-1 range) and scales to 0-255
- DasherInterfaceBase: also scan colour.*.xml (British spelling)
Accepts key codes (0=Start/Stop, 1-4=Buttons, 100=Primary, 101=Secondary, 102=Tertiary) and pressed state. The active DasherCore input filter handles interpretation — works with DefaultFilter, OneButtonDynamic, TwoButtonDynamic, ClickFilter etc.
New C API functions: - dasher_get_parameter_count/info: introspect all engine parameters - dasher_get_parameter_enum_count/name/value: enum dropdown values - dasher_get_parameter_string_values: alphabet/palette/filter lists - dasher_get_palette_count/name/preview_colors: colour theme enumeration - dasher_set_palette: change colour theme - dasher_get_alphabet_count/name: alphabet enumeration - dasher_save_settings: persist settings to XML
Added const char* group to dasher_parameter_info. Groups: "Input", "Language", "Appearance", "Speed", "Output", "Advanced", "Other". The mapping is a switch in CAPI.cpp's parameterGroup() function. User directory separation — dasher_create now takes (data_dir, user_dir, out_error): - data_dir = read-only bundled data (alphabets, colours, training) - user_dir = writable directory for settings (NULL = use data_dir) - out_error = if not NULL, receives error message on failure Error reporting — Exceptions during creation are caught and the message is returned via out_error (including e.what() from std::exception). Current palette accessor — dasher_get_current_palette(ctx) returns the active palette name.
Add settings_manifest.json and a Python generator (Scripts/generate_parameters.py) that emits src/DasherCore/Parameters.cpp. The generator reads the manifest and handles bool/long/string defaults, enum values, ranged parameters, UI types, persistence and platform-specific overrides, and writes an AUTOGENERATED header; Parameters.cpp was updated/regenerated accordingly.
Add CMake logic to generate src/DasherCore/Parameters.cpp from settings_manifest.json using Scripts/generate_parameters.py. The change defines manifest/generator/output paths, locates a Python3 interpreter, and adds an add_custom_command to run the generator (with DEPENDS and WORKING_DIRECTORY). If Python3 is not found a warning guides developers to run the script manually.
Not sure i really like this. But I think better we do as much i10n in this repo than in downstream ones. It means all dasher's become standardised.
…witch; add group field to Parameter_Value; update codegen to emit group
…m KeithAAC datasets (34 languages, ~30k utterances each); add generate_training.py script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose DasherCore as a flat C shared library for cross-platform FFI. Includes command-buffer screen, pointer input, settings, and output text access. Builds as dasher.dll / libdasher.so via BUILD_CAPI cmake option.
Note - GLM 5.5 did a lot of this.. it definitely needs reviewing.. my c++ skills are very poor..