mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
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>
This commit is contained in:
parent
32d332b786
commit
bf528b9066
5 changed files with 389 additions and 18 deletions
|
|
@ -108,11 +108,18 @@ int snd_config_search_definition(snd_config_t *config,
|
|||
const char *base, const char *key,
|
||||
snd_config_t **result);
|
||||
|
||||
typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data);
|
||||
|
||||
int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,
|
||||
snd_config_expand_fcn_t fcn, void *private_data,
|
||||
snd_config_t **result);
|
||||
int snd_config_expand(snd_config_t *config, snd_config_t *root,
|
||||
const char *args, snd_config_t *private_data,
|
||||
snd_config_t **result);
|
||||
int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
|
||||
snd_config_t *private_data, snd_config_t **result);
|
||||
int snd_config_evaluate_string(snd_config_t **dst, const char *s,
|
||||
snd_config_expand_fcn_t fcn, void *private_data);
|
||||
|
||||
int snd_config_add(snd_config_t *config, snd_config_t *child);
|
||||
int snd_config_add_before(snd_config_t *before, snd_config_t *child);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue