-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for expressions in syscfg values #470
base: master
Are you sure you want to change the base?
Commits on Mar 23, 2022
-
Add support for expressions in syscfg values
This adds support for evaluating syscfg values as expressions. To make it compatible with existing code, syscfg value is only evaluated as expression if its type is explicitly set to "expr", i.e.: syscfg.defs: FOO: description: ... type: expr value: 1 + 2 + 3 Following tokens are allowed in expressions: - literals (integers and strings) - identifiers (references to other syscfg values) - parentheses - binary operators (arthmetic, relational and boolean) - unary operator (boolean negation) - built-in function calls Most of operators support only integer values. Strings are supported by "==" and "!=" only. Available built-in functions are: - min(a,b) - returns lesser of "a" and "b" - max(a,b) - returns greater of "a" and "b" - in_range(v,a,b) - returns if "v" is inside [a,b] range - clamp(v,a,b) - clamps "v" to be inside [a,b] range - ite(v,a,b) - if-then-else, returns "a" if "v", otherwise returns "b" - in_set(v,...) - returns if "v" is one of remaining arguments Note: all arguments to built-in functions shall be integer only, except for "a" and "b" in ite() and all arguments in in_set().
Configuration menu - View commit details
-
Copy full SHA for 19adfe6 - Browse repository at this point
Copy the full SHA 19adfe6View commit details
Commits on Mar 24, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 181abdb - Browse repository at this point
Copy the full SHA 181abdbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8d08985 - Browse repository at this point
Copy the full SHA 8d08985View commit details -
Configuration menu - View commit details
-
Copy full SHA for e553f16 - Browse repository at this point
Copy the full SHA e553f16View commit details -
[expr] Evaluate all syscfg as expressions
Except for defunc settings since those are not used anyway.
Configuration menu - View commit details
-
Copy full SHA for d5ae4e7 - Browse repository at this point
Copy the full SHA d5ae4e7View commit details -
[expr] Add fallback for MYNEWT_VAL_ prefix identifiers
Some settings may reference values with MYNEWT_VAL_ prefix - this was done to actually evaluate them as expression in preprocessor. We can fix those and emit warning instead of failing.
Configuration menu - View commit details
-
Copy full SHA for 3205dd2 - Browse repository at this point
Copy the full SHA 3205dd2View commit details -
[expr] Add support for choices values
If syscfg value is a choice, it's evaluated as an identifier so we need to add special handling in such case - if identifier is evaluated directly "from" entry, we should first check if value is a valid choice.
Configuration menu - View commit details
-
Copy full SHA for 02174f0 - Browse repository at this point
Copy the full SHA 02174f0View commit details -
[expr] Add support for raw syscfg values
This adds function "raw" that expects a single string argument and will return that argument contents as raw value, i.e. syscfg value will be exactly that string without quotes.
Configuration menu - View commit details
-
Copy full SHA for b1367b6 - Browse repository at this point
Copy the full SHA b1367b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e457b9 - Browse repository at this point
Copy the full SHA 2e457b9View commit details -
[expr] Add support for empty string values
This allows to differentiate empty strings (i.e. #define XXX "") and empty values (i.e. #undef XXX).
Configuration menu - View commit details
-
Copy full SHA for 9f920db - Browse repository at this point
Copy the full SHA 9f920dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for a473a1a - Browse repository at this point
Copy the full SHA a473a1aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 369dea1 - Browse repository at this point
Copy the full SHA 369dea1View commit details
Commits on Mar 25, 2022
-
[expr] rewrite evaluator to separate package
this moves evaluator to separate package which interfaces with syscfg via interface. this removes direct dependency on syscfg package.
Configuration menu - View commit details
-
Copy full SHA for 7f1a65d - Browse repository at this point
Copy the full SHA 7f1a65dView commit details