Skip to content

2024.03.03c - For Microcontrollers

Latest
Compare
Choose a tag to compare
@zgoethel zgoethel released this 03 Mar 21:47
· 2 commits to rezacht-core since this release

"Rezacht Core"

Descriptor language transpiler for templated web content in C

This is a port for microcontrollers which omits

  • Reactive UI and supporting JS
  • Component action interfaces
  • Generated view controllers
  • Generated SQL data layers
  • HTML escaping and some security handling
  • Some child-parent relationship features
  • Dependency injection pipeline

Primarily, this port allows

  • Efficient concatenation of numerous strings
  • Component state variables
  • Rendering of static HTML
  • Component and sub-component rendering
  • Conditional and flow control logic

Special Notes

  • Two test components are included and an executable built from test.c demonstrating how to render components
  • Generated C sources are emitted to generated/ and are meant to be committed with your descriptor files
  • Register all new components as #include directives in generated/components.h
  • There is an issue after deleting .view files; after doing so, delete the CMake build folder to resolve "no target to build ..." errors
  • The language server must be running during the CMake build process; this can be achieved by launching a new Terminal in VSCode and running ./tools/SourceGenerator in the background
  • Component state in dynamic memory must be managed externally. Generated HTML and content from writer_t must be freed manually

Included components
tools/SourceGenerator - Source Generator language server executable
tools/rezacht.sh - Submits .view source to the language server for generation
tools/buildall.sh - Cleans generated/ then recursively finds and compiles .view files
CMake Module - Project build structure to build generated C view templates

New components

  • Language server process - Binds to the loopback interface and accepts compilation/IntelliSense requests. A shared process which provides metadata to all running instances of Visual Studio from provided sources.

Component Templates

  • HTML nodes
  • HTML node parameters
  • Inline C expressions
  • Flow control statements if(
  • Loop statements for(
  • Sub-components
  • Component immutable state
  • DOM node grouping operator <>
  • Multiline string operator <">