--- cvsroot/libecb/ecb.pod 2015/02/11 19:16:12 1.60 +++ cvsroot/libecb/ecb.pod 2015/02/18 20:29:27 1.62 @@ -70,7 +70,7 @@ For C and C use C. -=head2 LANGUAGE/COMPILER VERSIONS +=head2 LANGUAGE/ENVIRONMENT/COMPILER VERSIONS All the following symbols expand to an expression that can be tested in preprocessor instructions as well as treated as a boolean (use C to @@ -165,6 +165,32 @@ =back +=head2 MACRO TRICKERY + +=over 4 + +=item ECB_CONCAT (a, b) + +Expands any macros in C and C, then concatenates the result to form +a single token. This is mainly useful to form identifiers from components, +e.g.: + + #define S1 str + #define S2 cpy + + ECB_CONCAT (S1, S2)(dst, src); // == strcpy (dst, src); + +=item ECB_STRINGIFY (arg) + +Expands any macros in C and returns the stringified version of +it. This is mainly useful to get the contents of a macro in string form, +e.g.: + + #define SQL_LIMIT 100 + sql_exec ("select * from table limit " ECB_STRINGIFY (SQL_LIMIT)); + +=back + =head2 ATTRIBUTES A major part of libecb deals with additional attributes that can be @@ -185,7 +211,7 @@ declare a variable but do not always use it: { - int var ecb_unused; + ecb_unused int var; #ifdef SOMECONDITION var = ...; @@ -200,6 +226,12 @@ Similar to C, but marks a function, variable or type as deprecated. This makes some compilers warn when the type is used. +=item ecb_deprecated_message (message) + +Same as C, but if possible, supply a diagnostic that is +used instead of a generic depreciation message when the object is being +used. + =item ecb_inline Expands either to C or to just C, if inline @@ -247,8 +279,8 @@ loop, because it knows it doesn't overwrite input values. void - multiply (float *ecb_restrict src, - float *ecb_restrict dst, + multiply (ecb_restrict float *src, + ecb_restrict float *dst, int len, float factor) { int i; @@ -384,7 +416,7 @@ : (n * (uint32_t)rndm16 ()) >> 16; } -=item bool ecb_expect (expr, value) +=item ecb_expect (expr, value) Evaluates C and returns it. In addition, it tells the compiler that the C evaluates to C a lot, which can be used for static @@ -441,7 +473,7 @@ real_reserve_method (size); /* presumably noinline */ } -=item bool ecb_assume (cond) +=item ecb_assume (cond) Try to tell the compiler that some condition is true, even if it's not obvious. @@ -471,13 +503,13 @@ completely, as it knows that C<< current + 1 > end >> is false and the call will never be executed. -=item bool ecb_unreachable () +=item ecb_unreachable () This function does nothing itself, except tell the compiler that it will never be executed. Apart from suppressing a warning in some cases, this function can be used to implement C or similar functions. -=item bool ecb_prefetch (addr, rw, locality) +=item ecb_prefetch (addr, rw, locality) Tells the compiler to try to prefetch memory at the given Cess for either reading (C = 0) or writing (C = 1). A C of @@ -636,6 +668,20 @@ =over 4 +=item ECB_INFINITY + +Evaluates to positive infinity if supported by the platform, otherwise to +a truly huge number. + +=item ECB_NON + +Evaluates to a quiet NAN if supported by the platform, otherwise to +C. + +=item float ecb_ldexpf (float x, int exp) + +Same as C, but always available. + =item uint32_t ecb_float_to_binary32 (float x) [-UECB_NO_LIBM] =item uint64_t ecb_double_to_binary64 (double x) [-UECB_NO_LIBM]