1.1 --- a/templates/ops.h Sun Feb 19 18:39:11 2017 +0100
1.2 +++ b/templates/ops.h Sun Feb 19 19:06:22 2017 +0100
1.3 @@ -74,12 +74,20 @@
1.4 __attr __test_context(__ref context, __attr attr);
1.5 __attr __update_context(__ref context, __attr attr);
1.6
1.7 -#define __test_context_set(__TARGET, __CONTEXT, __ATTR) \
1.8 - (__test_context_update(__CONTEXT, __ATTR) ? (__set_context(__TARGET, (__attr) {.value=__CONTEXT}), __ATTR) : __ATTR)
1.9 +/* Revert the local context to that employed by the attribute if the supplied
1.10 + context is not appropriate. */
1.11 +
1.12 +#define __test_context_revert(__TARGET, __CONTEXT, __ATTR) \
1.13 + (__test_context_update(__CONTEXT, __ATTR) \
1.14 + ? __ATTR \
1.15 + : (__set_context(__TARGET, __CONTEXT_AS_VALUE(__ATTR)), __ATTR))
1.16 +
1.17 +/* Set the local context to the specified context if appropriate. */
1.18
1.19 #define __test_context_static(__TARGET, __CONTEXT, __REF) \
1.20 - (__test_context_update(__CONTEXT, (__attr) {.value=__REF}) ? \
1.21 - (__set_context(__TARGET, (__attr) {.value=__CONTEXT}), (__attr) {.value=__REF}) : (__attr) {.value=__REF})
1.22 + (__test_context_update(__CONTEXT, (__attr) {.value=__REF}) \
1.23 + ? (__set_context(__TARGET, (__attr) {.value=__CONTEXT}), (__attr) {.value=__REF}) \
1.24 + : (__attr) {.value=__REF})
1.25
1.26 #define __get_context(__TARGET) (__tmp_contexts[__TARGET])
1.27 #define __set_context(__TARGET, __ATTR) (__tmp_contexts[__TARGET] = (__ATTR).value)