3 * @brief 変愚蛮怒で新しく追加された主要なマクロ定義ヘッダ / Define some simple constants
9 #ifndef INCLUDED_H_DEFINE_H
10 #define INCLUDED_H_DEFINE_H
14 * Hack -- assist "main-acn.c"
24 * The constants "TRUE" and "FALSE"
28 #define TRUE 1 /*!< コンパイル環境に定義がない場合のTRUE定義 */
31 #define FALSE 0 /*!< コンパイル環境に定義がない場合のFALSE定義 */
36 /**** Simple "Macros" ****/
39 #define lbtokg(x) ((int)(((x)*4536)/1000)) /*!< Zangband基準のポンド→キログラム変換定義(全体) */
40 #define lbtokg1(x) ((lbtokg(x)+5)/100) /*!< Zangband基準のポンド→キログラム変換定義(整数部) */
41 #define lbtokg2(x) ( ( (lbtokg(x)+5)%100)/10) /*!< Zangband基準のポンド→キログラム変換定義(少数部) */
43 #define lbtokg(x) ((int)((x)*5)) /*!< 変愚蛮怒基準のポンド→キログラム変換定義(全体) */
44 #define lbtokg1(x) (lbtokg(x)/100) /*!< 変愚蛮怒基準のポンド→キログラム変換定義(整数部) */
45 #define lbtokg2(x) ((lbtokg(x)%100)/10) /*!< 変愚蛮怒基準のポンド→キログラム変換定義(少数部) */
49 * Force a character to lowercase/uppercase
51 #define FORCELOWER(A) ((isupper((A))) ? tolower((A)) : (A))
52 #define FORCEUPPER(A) ((islower((A))) ? toupper((A)) : (A))
56 * Non-typed minimum value macro
59 #define MIN(a,b) (((a) > (b)) ? (b) : (a))
62 * Non-typed maximum value macro
65 #define MAX(a,b) (((a) < (b)) ? (b) : (a))
68 * Non-typed absolute value macro
71 #define ABS(a) (((a) < 0) ? (-(a)) : (a))
74 * Non-typed sign extractor macro
77 #define SGN(a) (((a) < 0) ? (-1) : ((a) != 0))
80 * Refer to the member at offset of structure
82 #define atoffset(TYPE, STRUCT_PTR, OFFSET) (*(TYPE*)(((char*)STRUCT_PTR) + (OFFSET)))