2004-12-18 09:16:31 +00:00
|
|
|
/*
|
2004-12-18 09:58:49 +00:00
|
|
|
* $Id: macros.h,v 1.2 2004-12-18 09:58:49 bacon Exp $
|
2004-12-18 09:16:31 +00:00
|
|
|
*/
|
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#ifndef _XP_MACROS_H_
|
|
|
|
#define _XP_MACROS_H_
|
2004-12-18 09:16:31 +00:00
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#include <xp/types.h>
|
2004-12-18 09:16:31 +00:00
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#define XP_NULL ((void*)0)
|
|
|
|
#define XP_EOF ((xp_cint_t)-1)
|
2004-12-18 09:16:31 +00:00
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#define xp_sizeof(n) (sizeof(n))
|
|
|
|
#define xp_countof(n) (sizeof(n) / sizeof(n[0]))
|
2004-12-18 09:16:31 +00:00
|
|
|
|
|
|
|
#if defined(_WIN32)
|
2004-12-18 09:58:49 +00:00
|
|
|
#define xp_main _tmain
|
2004-12-18 09:16:31 +00:00
|
|
|
#else
|
2004-12-18 09:58:49 +00:00
|
|
|
#define xp_main main
|
2004-12-18 09:16:31 +00:00
|
|
|
#endif
|
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#define XP_LOOP_CONTINUE(id) goto __loop_ ## id ## _begin__;
|
|
|
|
#define XP_LOOP_BREAK(id) goto __loop_ ## id ## _end__;
|
|
|
|
#define XP_LOOP_BEGIN(id) __loop_ ## id ## _begin__: {
|
|
|
|
#define XP_LOOP_END(id) XP_LOOP_CONTINUE(id) } __loop_ ## id ## _end__:;
|
2004-12-18 09:16:31 +00:00
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#define XP_QUOTE(val) __XP_QUOTE(val)
|
|
|
|
#define __XP_QUOTE(val) #val
|
2004-12-18 09:16:31 +00:00
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#define __XP_CHAR(quote) quote
|
|
|
|
#define __XP_TEXT(quote) quote
|
|
|
|
#define XP_MCHAR(quote) quote
|
|
|
|
#define XP_MTEXT(quote) quote
|
2004-12-18 09:16:31 +00:00
|
|
|
|
|
|
|
/*
|
2004-12-18 09:58:49 +00:00
|
|
|
#define __XP_CHAR(quote) L##quote
|
|
|
|
#define __XP_TEXT(quote) L##quote
|
|
|
|
#define XP_WCHAR(quote) L##quote
|
|
|
|
#define XP_WTEXT(quote) L##quote
|
2004-12-18 09:16:31 +00:00
|
|
|
*/
|
|
|
|
|
2004-12-18 09:58:49 +00:00
|
|
|
#define XP_CHAR(quote) __XP_CHAR(quote)
|
|
|
|
#define XP_TEXT(quote) __XP_TEXT(quote)
|
2004-12-18 09:16:31 +00:00
|
|
|
|
|
|
|
#endif
|