vcs.slashdirt.org Git - sw/tic2json.git/log
tic2json_main(): add `yyin` argument
Allows specifying the input FILE for the parsers.
tic2json: introduce PRINT2BUF
This commit implements a wrapper around print routines that will output
JSON to a buffer provided to tic2json_main(). If the `cb` parameter is
not NULL, this callback will be called before the content of the buffer
are overwritten, after each frame that would normally be printed by the
program.
s/printf/ticprintf/ and define ticprintf -> printf
Update README/ChangeLog, mark version 2.1
Improve code documentation
tic2json_main(): print error message to stderr
Make etiq_en an array of bool
tic2json: implement '-V' to show version
embedded: add ARM Mbed stub
lexers: %option nounistd
We don't need it, it's not always available on embedded platforms
tic2json: unistd.h is not needed for BAREBUILD
Add missing semicolon in parsers' start rule
Purely for the sake of consistency, the generated code is unchanged.
README: add note about embedded stubs
embedded/ESP: fix component CMakeLists
Add build recipes for Raspberry Pi Pico SDK
This commit adds recipes for a quick implementation of tic2json on
Raspberry Pi Pico SDK.
The included main() stub sets up a serial conversion with raw TIC on
input (RX) and JSON on output (TX).
The build recipe is hackish, but it get things done.
README: add snapshot, explicit GPLv2-only
BAREBUILD: s/ticmain/tic2json_main/
Add build recipes for ESP8266/ESP32 FreeRTOS IDF
This commit adds recipes for a quick implementation of tic2json on
Espressif FreeRTOS IDF SDK. It builds identically for ESP8266 and ESP32
(tested only on ESP8266).
The included main_app() stub sets up a serial conversion with raw TIC
on input (RX) and JSON on output (TX).
The build recipe is hackish, but it get things done.
Makefile: add 'csources' target
Enables an easy way to generate C sources from .l/.y files
README: switch to markdown
add LICENSE.md
Simplify building BAREBUILD
This simplifies building for a barebone MCU: a separate 'ticmain()' is
provided instead of main(), all unnecessary bits are disabled and only
one TIC version is supported at a time.
don't report errors in lexers by default
The parser will take care of that anyway. This reduces chatter during
initial sync.
Errors will still be reported in debug mode.
ticv02.l: separate etiquettes from data processing
Following the previous commit and to avoid a similar issue in standard
mode, apply the same recipe:
Use an exclusive start condition to process data.
Logic: when we encounter the first SEP in INITIAL condition, everything
that comes after is DATA and not etiquette until we start a new dataset.
Only change states at delimiters and use condition catchalls for them to
ensure resync in case of data errors.
This makes initial frame sync a little more error-verbose.
ticv01.l: separate etiquettes from data processing
Rationale: data can contain etiquettes patterns, for instance:
{ "label": "OPTARIF", "data": "BASE"}
{ "label": "BASE", "data":
13205849}
Use an exclusive start condition to process data.
Logic: when we encounter the first SEP in INITIAL condition, everything
that comes after is DATA and not etiquette until we start a new dataset.
Only change states at delimiters and use condition catchalls for them to
ensure resync in case of data errors.
This makes initial frame sync a little more error-verbose.
tic2json: correct spelling for mandatory options
ticv01 lexer: fix desc typo
tic2json: remove useless variable
Bump version, update ChangeLog
update README
parser TICv01: specify which meters are supported
TICv01: support des étiquettes propres au concentrateur téléreport
doc
print_field(): const arg
parser v02: move etiquette error to recursive rule
matches v01
Further split out parser from output producer
rename tic2json.h -> tic.h
minor cleanup no code change
make filter_mode a bool
hook both versions
Makefile: prepare to support multiple versions
parser v02: disambiguate parse_config
Add lexer/parser for v01
ticv02: add prefixes to lexer/parser
rename tic2json.y to ticv02.y
carve out output formatting from the parser
rename tic2json.l to ticv02.l
Update ChangeLog
bump version number
parser: add option to decode STGE
parser: static local functions
parser: report frame status in dictionary mode
add ChangeLog
clarify filter file format
parser: implement idtag
useful to tag data from different meters
Introduce version number, simplify usage() prototype
parser: cleanup frame handling
minor reformat
add README
introduce pr_err() and BAREBUILD
rename and improve makefile
parser: hooked logic is unnecessary
The grammar is properly written :)
parser: one less global variable
parser: reduce unnecessary calls
parser: simplify grammar
first pass at improving memory footprint
down to 24KB and 8KB heap
parser: help: French audience
parser: implement long date
parser: implement optional output as dictionary
parser: only print description when requested
add basic Makefile
implement filtering via simple config file
lexer: remove commented out v1 etiquettes
lexer: switch to 7bit
parser: formatting cleanup, no code change
parser: implement frame skipping
parser: add usage() and option to add \n after fields
parser: implement label unpacking
This exposes the full description as well as label unit as per specification,
at the cost of slightly increased stack usage
parser: prepare implementing label unpacking
No output change for now.
This comes at zero cost over the previous implementation, save for binary size increase.
Further reduce memory pressure by using const char for labels
This essentially halves the number of allocations by only using them for
dynamic data (namely horodate and data).
Valgrind output on 100KB test:
- Before:
see previous commit
- After:
thread 1 finished and used 21967 bytes out of
8388608 on its stack. Margin:
8366641 bytes.
total heap usage: 4,961 allocs, 4,961 frees, 83,025 bytes allocated
parser: don't malloc()
At the cost of a slight stack usage increase, this drastically reduces
overall memory usage and improves performance since we don't incur the
malloc() penalty.
Sample figures from a single run over a 100KB test capture:
- Before:
thread 1 finished and used 17151 bytes out of
8388608 on its stack. Margin:
8371457 bytes.
total heap usage: 13,996 allocs, 13,996 frees, 255,865 bytes allocated
- After:
thread 1 finished and used 21967 bytes out of
8388608 on its stack. Margin:
8366641 bytes.
total heap usage: 9,516 allocs, 9,516 frees, 112,505 bytes allocated
parser: output frames as individual root elements
parser: simplify error recovery
parser: implement masking zero-values
parser: parse hex values (STGE)
parser: process int values as ints
parser: prepare to process int values
don't copy label
add stty.settings
fix error handling/recovery
Improve error reporting too.
Error messages are sent to stderr, so stdout still carries a valid JSON
stream.
initial commit fully working on sample data
tic2json TIC parser/converter
RSS
Atom