parsers: avoid NULL dereference when option strings are empty When colon separated options are scanned (like "-P ps2: --show") then the empty list item which results from the trailing colon resulted in key/value pairs becoming NULL. Handle that situation, skip empty list elements. Reported-By: Peter Mortensen via IRC
parsers: use proper conversion routine for PD option data types The generic_arg_to_opt() routine converted text input to protocol decoder option values, but might have lost significant information. Use a signed conversion routine for the int32 data, use a long long routine for uint64 data. This shall unbreak negative values (like UART packet separators), and improve compatibility with 32bit targets (like for large sample numbers or high frequency values).
parsers: rephrase option key/value parsing some more Move the key-value pair separation to a subroutine to avoid redundancy in other locations. Which simplifies the "optional ID" code path as a byproduct. Drop comments which repeat the routine's doxygen content. Keep hash insertion text lines short by moving string allocation to a separate instruction (which rephrases how empty right hand sides are handled for key-only specs).
parsers: extend options parser, support optional ID in key-value lists The options parser accepts a colon separated list of key-value pairs, and a special case where the first item is not a pair but a single word which is an identifier. This lets users select a device driver, or input/output format, or decoder. Extend the options parser to also support an optional identifier as the first item in a list of key-value pairs. Check the first item's keyword for a caller specified literal. This change remains backwards compatible (does not affect behaviour) when users don't pass the special keyword.
parsers: warn about unknown input/output module option keys Misspelled option names fail silently, the setting won't take effect and the user won't notice. $ echo "1, 0" | sigrok-cli -I csv:header=no:column_format=t,l -i - Check whether specified input/output module options are supported, emit warnings when they are not. It's a design choice to raise awareness yet make mismatches non-fatal. This can be useful for generated command lines or during a period of migration after UI changes. The implementation is prepared for optional call site specific captions in diagnostics messages. Callers can either have messages generated by common code, or handle the list of unavailable words themselves, or have common code emit warnings and in addition take extra actions. It's also trivial to make mismatches fatal should the need arise. This resolves the sigrok-cli part of bug #1549. Also addresses brace style nits in bypassing.