Hengband  2.1.4
 全て データ構造 ファイル 関数 変数 型定義 マクロ定義 ページ
マクロ定義 | 型定義
h-type.h

ゲーム中に用いる変数型定義 / Basic "types". [詳細]

このグラフは、どのファイルから直接、間接的にインクルードされているかを示しています。

ソースコードを見る。

マクロ定義

#define uint   uint_hack
 非マッキントッシュ環境で重複を避けるためのuint_hack型定義 / Hack – prevent problems with non-MACINTOSH [詳細]
 
#define huge   huge_hack
 MSDOS及びWINDOWS環境で重複を避けるためのhuge_hack定義 / Hack – prevent problems with MSDOS and WINDOWS. [詳細]
 
#define byte   byte_hack
 AMIGA環境で重複を避けるためのbyte_hack定義 / Hack – prevent problems with AMIGA. [詳細]
 
#define bool   bool_hack
 C++環境で重複を避けるためのbool_hack定義 Hack – prevent problems with C++. [詳細]
 

型定義

typedef void * vptr
 void型ポインタ定義 / A standard pointer (to "void" because ANSI C says so) [詳細]
 
typedef const char * cptr
 文字列定数用ポインタ定義 / A simple pointer (to unmodifiable strings) [詳細]
 
typedef double real
 doubleをreal型として定義 / Since float's are silly, hard code real numbers as doubles [詳細]
 
typedef int errr
 エラーコードの定義 / Error codes for function return values [詳細]
 
typedef unsigned char byte
 byte型をunsighned charとして定義 / Note that unsigned values can cause math problems / An unsigned byte of memory [詳細]
 
typedef char bool
 bool型をcharとして定義 / Note that a bool is smaller than a full "int" / Simple True/False type [詳細]
 
typedef int sint
 sint型をintとして定義 / A signed, standard integer (at least 2 bytes) [詳細]
 
typedef unsigned int uint
 
typedef unsigned long huge
 
typedef signed short s16b
 
typedef unsigned short u16b
 
typedef signed long s32b
 
typedef unsigned long u32b
 
typedef realreal_ptr
 
typedef errrerrr_ptr
 
typedef char * char_ptr
 
typedef bytebyte_ptr
 
typedef boolbool_ptr
 
typedef sintsint_ptr
 
typedef uintuint_ptr
 
typedef long * long_ptr
 
typedef hugehuge_ptr
 
typedef s16bs16b_ptr
 
typedef u16bu16b_ptr
 
typedef s32bs32b_ptr
 
typedef u32bu32b_ptr
 
typedef vptrvptr_ptr
 
typedef cptrcptr_ptr
 
typedef errr(* func_gen )(vptr, vptr)
 
typedef bool(* func_eql )(vptr, vptr)
 
typedef sint(* func_cmp )(vptr, vptr)
 
typedef uint(* func_hsh )(vptr, uint)
 
typedef vptr(* func_key )(vptr)
 

説明

ゲーム中に用いる変数型定義 / Basic "types".

日付
2014/08/17
作者
不明(変愚蛮怒スタッフ?)
Note the attempt to make all basic types have 4 letters.
This improves readibility and standardizes the code.
Likewise, all complex types are at least 4 letters.
Thus, almost every three letter word is a legal variable.
But beware of certain reserved words ('for' and 'if' and 'do').
Note that the type used in structures for bit flags should be uint.
As long as these bit flags are sequential, they will be space smart.
Note that on some machines, apparently "signed char" is illegal.
It must be true that char/byte takes exactly 1 byte
It must be true that sind/uind takes exactly 2 bytes
It must be true that sbig/ubig takes exactly 4 bytes
On Sparc's, a sint takes 4 bytes (2 is legal)
On Sparc's, a uint takes 4 bytes (2 is legal)
On Sparc's, a long takes 4 bytes (8 is legal)
On Sparc's, a huge takes 4 bytes (8 is legal)
On Sparc's, a vptr takes 4 bytes (8 is legal)
On Sparc's, a real takes 8 bytes (4 is legal)
Note that some files have already been included by "h-include.h"
These include <stdio.h> and <sys/types>, which define some types
In particular, uint is defined so we do not have to define it
Also, see <limits.h> for min/max values for sind, uind, long, huge
(SHRT_MIN, SHRT_MAX, USHRT_MAX, LONG_MIN, LONG_MAX, ULONG_MAX)
These limits should be verified and coded into "h-constant.h".

マクロ定義

#define bool   bool_hack

C++環境で重複を避けるためのbool_hack定義 Hack – prevent problems with C++.

#define byte   byte_hack

AMIGA環境で重複を避けるためのbyte_hack定義 / Hack – prevent problems with AMIGA.

#define huge   huge_hack

MSDOS及びWINDOWS環境で重複を避けるためのhuge_hack定義 / Hack – prevent problems with MSDOS and WINDOWS.

#define uint   uint_hack

非マッキントッシュ環境で重複を避けるためのuint_hack型定義 / Hack – prevent problems with non-MACINTOSH

型定義

typedef char bool

bool型をcharとして定義 / Note that a bool is smaller than a full "int" / Simple True/False type

typedef bool* bool_ptr
typedef unsigned char byte

byte型をunsighned charとして定義 / Note that unsigned values can cause math problems / An unsigned byte of memory

typedef byte* byte_ptr
typedef char* char_ptr
typedef const char* cptr

文字列定数用ポインタ定義 / A simple pointer (to unmodifiable strings)

typedef cptr* cptr_ptr
typedef int errr

エラーコードの定義 / Error codes for function return values

一般に成功時0、失敗時負数、何らかの問題時整数とする。 Success = 0, Failure = -N, Problem = +N

typedef errr* errr_ptr
typedef sint(* func_cmp)(vptr, vptr)
typedef bool(* func_eql)(vptr, vptr)
typedef errr(* func_gen)(vptr, vptr)
typedef uint(* func_hsh)(vptr, uint)
typedef vptr(* func_key)(vptr)
typedef unsigned long huge
typedef huge* huge_ptr
typedef long* long_ptr
typedef double real

doubleをreal型として定義 / Since float's are silly, hard code real numbers as doubles

typedef real* real_ptr
typedef signed short s16b
typedef s16b* s16b_ptr
typedef signed long s32b
typedef s32b* s32b_ptr
typedef int sint

sint型をintとして定義 / A signed, standard integer (at least 2 bytes)

typedef sint* sint_ptr
typedef unsigned short u16b
typedef u16b* u16b_ptr
typedef unsigned long u32b
typedef u32b* u32b_ptr
typedef unsigned int uint
typedef uint* uint_ptr
typedef void* vptr

void型ポインタ定義 / A standard pointer (to "void" because ANSI C says so)

typedef vptr* vptr_ptr