Condition Macros
The macros in the sample condition_macros.cfg configuration file below are used as shortcuts for specifying special, complicated conditional tests, for example if a value has increased or deviated by some amount.
/////////////////////////////////////////////////////////////////////////////// // conditional macros - logical conditions /////////////////////////////////////////////////////////////////////////////// increased(V, T, I) // a logical condition that is true if the value of variable // (V) was not previously defined and is now > 0; or was // defined and if the value has equaled or exceeded // threshold (T) for the first time, or if the value has // increased by (I) or more // (V) is the variable (without type qualifier, e.g., cap) // (T) is the threshold (e.g., 75%) // (I) is the increase (e.g., 5%) ( ( #defined(%(V)) && ( ( ( #(V) >= %(V) ) && ( %(V) < (T) ) ) || ( (I) && ( #(V) - %(V) >= (I) ) ) ) ) || ( ! #defined(%(V)) && ( #(V) > 0 ) ) ) /////////////////////////////////////////////////////////////////////////////// deviated(V, P) // a logical condition that is true if a value has increased // or decreased by a certain percentage or more, or was // non-existent or 0 bytes and is now > 0 bytes // (V) is the variable (without type qualifier, e.g., size) // (P) is the percentage (e.g., 20%) ( ( #defined(%(V)) && ( ( ( %(V) != 0 && (#(V) - %(V))/%(V) >= (P) ) || ( %(V) != 0 && (#(V) - %(V))/%(V) <= -(P) ) ) || ( ( %(V) == 0 ) && ( #(V) != 0 ) ) ) ) || ( ! #defined(%(V)) && ( #(V) != 0 ) ) ) /////////////////////////////////////////////////////////////////////////////// isint(N) // is (N) an integer? ( (N) == #trunc((N)) ) ///////////////////////////////////////////////////////////////////////////////
For more examples, see Samples.