mirror of
https://github.com/alexhopeoconnor/DFTE.git
synced 2026-10-22 02:32:13 +10:00
Release v1.1.0
This commit is contained in:
+33
-17
@@ -1,25 +1,41 @@
|
||||
# Configuration and memory limits
|
||||
|
||||
DFTE object layouts depend on fixed `DFTE_*` compile-time limits. Define any changes through shared PlatformIO `build_flags` so the library and every consuming translation unit agree on the same layout.
|
||||
DFTE has a stable public object layout. `TemplateContext` owns its rendering
|
||||
stack and read buffer at runtime, so choosing capacities cannot make a consumer
|
||||
and the compiled library disagree about object size.
|
||||
|
||||
```ini
|
||||
build_flags =
|
||||
-DDFTE_BUFFER_SIZE=768
|
||||
-DDFTE_MAX_STACK_DEPTH=24
|
||||
-DDFTE_PLACEHOLDER_NAME_SIZE=32
|
||||
-DDFTE_MAX_ITERATIONS=80
|
||||
```cpp
|
||||
TemplateContext standard; // default: 16 stack frames, 512-byte buffer
|
||||
TemplateContext pageContext(6, 128); // known shallow response, smaller allocation
|
||||
if (!pageContext.isReady()) {
|
||||
// Allocation failed; do not start a response with this context.
|
||||
}
|
||||
```
|
||||
|
||||
| Flag | Default | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `DFTE_BUFFER_SIZE` | 512 | Streaming buffer size in `TemplateContext` |
|
||||
| `DFTE_MAX_STACK_DEPTH` | 16 | Render stack frames; nested templates usually need two frames each |
|
||||
| `DFTE_PLACEHOLDER_NAME_SIZE` | 24 | Maximum token length including `%` characters |
|
||||
| `DFTE_PROGMEM_CHUNK_SIZE` | 512 | PROGMEM source copy window |
|
||||
| `DFTE_RAM_CHUNK_SIZE` | 128 | RAM source copy window |
|
||||
| `DFTE_MAX_ITERATIONS` | 50 | Safety cap for one render call |
|
||||
| `DFTE_MAX_PLACEHOLDERS_DEFAULT` | 16 | Default registry constructor capacity |
|
||||
The context allocates its stack and read buffer when it is constructed. Its
|
||||
approximate heap use is `maxDepth * sizeof(RenderingContext) + bufferSize`, plus
|
||||
allocator overhead; its fixed 24-byte placeholder-token storage is part of the
|
||||
stable context object. Allocate one context per concurrently streaming request; use explicit
|
||||
small capacities for bounded pages rather than changing global definitions.
|
||||
Nested template expansion normally consumes two stack frames per level.
|
||||
|
||||
`DFTE_MAX_PLACEHOLDERS_DEFAULT` is only a constructor default; pass an explicit registry capacity where a device needs more. DeviceFramework runtime template parameters do not change DFTE’s compile-time object layout.
|
||||
| Setting | Default | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `DFTE_MAX_STACK_DEPTH` | 16 | Default depth passed by the no-argument `TemplateContext` constructor |
|
||||
| `DFTE_BUFFER_SIZE` | 512 | Default read-buffer size passed by the no-argument constructor |
|
||||
| `DFTE_MAX_ITERATIONS` | 50 | Safety cap for one renderer call |
|
||||
| `DFTE_PROGMEM_CHUNK_SIZE` | 512 | Source-copy window for flash data |
|
||||
| `DFTE_RAM_CHUNK_SIZE` | 128 | Source-copy window for RAM data |
|
||||
| `DFTE_MAX_PLACEHOLDERS_DEFAULT` | 16 | Default `PlaceholderRegistry` capacity |
|
||||
|
||||
The first two are constructor defaults, not layout controls: a consuming
|
||||
translation unit can choose them without an ABI mismatch. The source-copy and
|
||||
iteration settings change renderer behaviour, so set them consistently for a
|
||||
whole PlatformIO build. `DFTE_PLACEHOLDER_NAME_SIZE` is no longer a supported
|
||||
setting; placeholder tokens have a fixed ABI-stable capacity of 23 characters
|
||||
plus the terminator.
|
||||
|
||||
`DFTE_MAX_PLACEHOLDERS_DEFAULT` is only a constructor default; pass an explicit
|
||||
registry capacity where a device needs more.
|
||||
|
||||
Back to [documentation](README.md) · [project overview](../README.md).
|
||||
|
||||
Reference in New Issue
Block a user