vegastrike
0.5.1.r1
|
Portable Open Source Harness header file. More...
Go to the source code of this file.
Macros | |
#define | POSH_OS_EMBEDDED |
#define | POSH_OS_STRING "Embedded/Unknown" |
#define | POSH_CDECL |
#define | POSH_STDCALL |
#define | POSH_FASTCALL |
#define | POSH_IMPORTEXPORT |
#define | POSH_PUBLIC_API(rtype) extern POSH_IMPORTEXPORT rtype |
#define | POSH_BIG_ENDIAN 1 |
#define | POSH_ENDIAN_STRING "big" |
#define | POSH_COMPILE_TIME_ASSERT(name, x) typedef int _POSH_dummy_##name[(x) ? 1 : -1] |
#define | POSH_BigU16(x) (x) |
#define | POSH_BigU32(x) (x) |
#define | POSH_BigS16(x) (x) |
#define | POSH_BigS32(x) (x) |
#define | POSH_LittleU16(x) POSH_SwapU16( x ) |
#define | POSH_LittleU32(x) POSH_SwapU32( x ) |
#define | POSH_LittleS16(x) POSH_SwapS16( x ) |
#define | POSH_LittleS32(x) POSH_SwapS32( x ) |
Typedefs | |
typedef unsigned char | posh_byte_t |
typedef unsigned char | posh_u8_t |
typedef signed char | posh_i8_t |
typedef signed char | posh_s8_t |
typedef unsigned short | posh_u16_t |
typedef short | posh_i16_t |
typedef short | posh_s16_t |
typedef unsigned | posh_u32_t |
typedef int | posh_i32_t |
typedef int | posh_s32_t |
Portable Open Source Harness header file.
NOTE: Unlike most header files, this one is designed to be included multiple times, which is why it does not have the #ifndef/#define preamble.
POSH relies on environment specified preprocessor symbols in order to infer as much as possible about the target OS/architecture and the host compiler capabilities.
NOTE: POSH is simple and focused. It attempts to provide basic functionality and information, but it does NOT attempt to emulate missing functionality. I am also not willing to make POSH dirty and hackish to support truly ancient and/or outmoded and/or bizarre technologies such as non-ANSI compilers, systems with non-IEEE floating point formats, 16-bit operating systems, etc.
Please refer to the accompanying HTML documentation or visit http://www.poshlib.org for more information on how to use POSH.
Definition in file posh.h.
#define POSH_CDECL |
Specifies that a function should use the C calling convention. The cdecl convention passes parameters on the stack, with the caller responsible for cleaning up the stack (which in turn allows for variable argument lists). It's marginally slower than the other calling conventions, and is the default calling convention for the C language.
* extern void POSH_CDECL someFunction( const char *, ... );
*
- Todo:
- need to get a comprehensive list of how cdecl, et. al. are specified
#define POSH_COMPILE_TIME_ASSERT | ( | name, | |
x | |||
) | typedef int _POSH_dummy_##name[(x) ? 1 : -1] |
Cross-platform compile time assertion macro that will cause a syntax error at compile time if the assertion 'x' is not true.
#define POSH_FASTCALL |
Specifies that a function should use the register/"fastcall" calling convention. The fastcall convention passes as many parameters as possible via registers. If there is an overflow, the remaining parameters are passed on the stack. It is the called function's responsibility to remove clean up the stack.
* extern void POSH_FASTCALL someFunction( int x, int y, int z );
*
#define POSH_PUBLIC_API | ( | rtype) | extern POSH_IMPORTEXPORT rtype |
use as a wrapper for all publicly exported functions and data <code><b>POSH_PUBLIC_API</code></b> should be used as a wrapper around any data or function return type values that are exported from a DLL. This macro ensures proper linkage irrespective of compiler. Example usage: <pre><code>
* POSH_PUBLIC_API(int) functionThatReturnsInt( void ); * POSH_PUBLIC_API(int) globalIntVariable; *
#define POSH_STDCALL |
Specifies that a function should use the PASCAL/"stdcall" calling convention. The stdcall convention passes parameters on the stack, however the called function is responsible for stack cleanup. This is slightly faster than cdecl, but without the ability to handle variable argument lists. It is also the default calling convention for the Pascal language.
* extern void POSH_STDCALL someFunction( void );
*
POSH_COMPILE_TIME_ASSERT | ( | posh_byte_t | , |
sizeof(posh_byte_t) | = =1 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_u16_t | , |
sizeof(posh_u16_t) | = =2 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_s16_t | , |
sizeof(posh_s16_t) | = =2 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_u32_t | , |
sizeof(posh_u32_t) | = =4 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_s32_t | , |
sizeof(posh_s32_t) | = =4 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_testfloat_t | , |
sizeof(float) | = =4 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_testdouble_t | , |
sizeof(double) | = =8 |
||
) |
POSH_COMPILE_TIME_ASSERT | ( | posh_32bit_pointer | , |
sizeof(void *) | = =4 |
||
) |