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
 WINDOWS環境で重複を避けるためのhuge_hack定義 / Hack – prevent problems with 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".

マクロ定義詳解

◆ bool

#define bool   bool_hack

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

◆ byte

#define byte   byte_hack

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

◆ huge

#define huge   huge_hack

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

◆ uint

#define uint   uint_hack

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

型定義詳解

◆ bool

typedef char bool

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

◆ bool_ptr

typedef bool* bool_ptr

◆ byte

typedef unsigned char byte

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

◆ byte_ptr

typedef byte* byte_ptr

◆ char_ptr

typedef char* char_ptr

◆ cptr

typedef const char* cptr

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

◆ cptr_ptr

typedef cptr* cptr_ptr

◆ errr

typedef int errr

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

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

◆ errr_ptr

typedef errr* errr_ptr

◆ func_cmp

typedef sint(* func_cmp) (vptr, vptr)

◆ func_eql

typedef bool(* func_eql) (vptr, vptr)

◆ func_gen

typedef errr(* func_gen) (vptr, vptr)

◆ func_hsh

typedef uint(* func_hsh) (vptr, uint)

◆ func_key

typedef vptr(* func_key) (vptr)

◆ huge

typedef unsigned long huge

◆ huge_ptr

typedef huge* huge_ptr

◆ long_ptr

typedef long* long_ptr

◆ real

typedef double real

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

◆ real_ptr

typedef real* real_ptr

◆ s16b

typedef signed short s16b

◆ s16b_ptr

typedef s16b* s16b_ptr

◆ s32b

typedef signed long s32b

◆ s32b_ptr

typedef s32b* s32b_ptr

◆ sint

typedef int sint

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

◆ sint_ptr

typedef sint* sint_ptr

◆ u16b

typedef unsigned short u16b

◆ u16b_ptr

typedef u16b* u16b_ptr

◆ u32b

typedef unsigned long u32b

◆ u32b_ptr

typedef u32b* u32b_ptr

◆ uint

typedef unsigned int uint

◆ uint_ptr

typedef uint* uint_ptr

◆ vptr

typedef void* vptr

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

◆ vptr_ptr

typedef vptr* vptr_ptr