pp.h File Reference

A file full of preprocessor helpers. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ppCastPtr(type)   (type)(void*)
 Do a typecast that doesn't trigger B.S. 'type punned pointer' warnings.
#define ppNULL
 Placeholder "nothing" parameter for preprocessor directives.
#define ppCM   ,
 Drop a comma ',' into a block of template junk so preprocessor doesn't interpret it.
#define ppLP   (
 Drop a left-parenthesis '(' into a block of template junk so preprocessor doesn't interpret it.
#define ppRP   )
 Drop a right-parenthesis ')' into a block of template junk so preprocessor doesn't interpret it.
#define ppEat(p)
 Eat some trailing thing from an expansion.
#define ppEat2(p1, p2)
 Eat some more trailing things from an expansion.
#define ppToken(d)   d
 Force separate translation of intermediate preprocessor stage.
#define ppTokStr(d)   _ppTokStr(d)
 Interpret, then convert a preprocessor directive (d) into a string.
#define ppConcat(a, b)   _ppConcat(a,b)
 Interpret two tokens, concatenate the results together.
#define ppConcat3(a, b, c)   _ppConcat3(a,b,c)
 Interpret three tokens, concatenate the results together.
#define ppConcat4(a, b, c, d)   _ppConcat4(a,b,c,d)
 Interpret four tokens, concatenate the results together.
#define ppConcat5(a, b, c, d, e)   _ppConcat5(a,b,c,d,e)
 Interpret four tokens, concatenate the results together.
#define ppConcat6(a, b, c, d, e, f)   _ppConcat6(a,b,c,d,e,f)
 Interpret four tokens, concatenate the results together.
#define ppScr(label)   ppConcat(label,__LINE__)
 Build a unique scratch label for macro functions.
#define ppC_CPP(c, cpp)   c
 Selectively choose C or CPP based on C or C++ compiler.
#define ppRaw(rawcooked, raw)   ppConcat(ppRAW_,rawcooked)(raw)
 Selectively choose 'raw' or 'cooked' code, such as containers that contain raw.
#define ppForUnit(p)
 Make cutting unit-based definitions a little easier.
#define offsetof(s, m)   ((size_t)&(((s *)0)->m))
 Get offset of member 'm' in class or struct 's'.
#define dereference(s, m, p)   ((s *)((size_t)(p) - offsetof(s,m)))
 Convert a pointer 'p' *KNOWN* to be from a member of 's' back to a pointer to 's'.


Detailed Description

A file full of preprocessor helpers.

Author:
David Mace

Definition in file pp.h.


Define Documentation

#define dereference ( s,
m,
 )     ((s *)((size_t)(p) - offsetof(s,m)))

Convert a pointer 'p' *KNOWN* to be from a member of 's' back to a pointer to 's'.

Parameters:
s Structure to perform offsetof operation on
m Member to find offset of
p Pointer to a structure member, known to be member of 's'
Returns:
Pointer to structure

Definition at line 197 of file pp.h.

#define offsetof ( s,
 )     ((size_t)&(((s *)0)->m))

Get offset of member 'm' in class or struct 's'.

Parameters:
s Structure to perform offsetof operation on
m Member to find offset of
Returns:
Count of bytes between start of structure and 'm'

Definition at line 185 of file pp.h.

#define ppEat (  ) 

Eat some trailing thing from an expansion.

Parameters:
p Token to eat

Definition at line 66 of file pp.h.

#define ppEat2 ( p1,
p2   ) 

Eat some more trailing things from an expansion.

Parameters:
p1 Eat me
p2 Eat me

Definition at line 73 of file pp.h.

#define ppScr ( label   )     ppConcat(label,__LINE__)

Build a unique scratch label for macro functions.

root Something to group labels together with derive Label to apply to

Definition at line 117 of file pp.h.

#define ppToken (  )     d

Force separate translation of intermediate preprocessor stage.

Parameters:
d token to expand to its meaninf

Definition at line 79 of file pp.h.

#define ppTokStr (  )     _ppTokStr(d)

Interpret, then convert a preprocessor directive (d) into a string.

Parameters:
d Token to expand and make a string from

Definition at line 85 of file pp.h.


Generated on Fri Jan 2 15:28:35 2009 for Squat by  doxygen 1.5.6