]> git.alsa-project.org Git - alsa-lib.git/commit
conf: add possibility to evaluate simple integer math expressions
authorJaroslav Kysela <perex@perex.cz>
Mon, 29 Nov 2021 13:57:29 +0000 (14:57 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 30 Nov 2021 10:33:35 +0000 (11:33 +0100)
commitbf528b90660543b0f3b75d1a9c91319d79be680f
treea9fa1e4435ef56ca52949a482ba400edc37fdeb6
parent32d332b786c19583157f440fb3eb478cbdeee49a
conf: add possibility to evaluate simple integer math expressions

It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.

Examples:

$[1 + 1]
$[$[2 + 2] / $var1]
$[0xa0 | 0x05]

As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
include/conf.h
src/Makefile.am
src/conf.c
src/confeval.c [new file with mode: 0644]
test/lsb/config.c