Main Page | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# dkcDefined.h

Go to the documentation of this file.

    00001
    00014 #ifndef dkutil_c_Defined__h
    00015 #define dkutil_c_Defined__h
    00016
    00017
    00018 #include <stdio.h>
    00019 #include <stddef.h>
    00020
    00021
    00022 //**********************************************************
    00023 //ここらへんって32ビット環境依存だから＾＾；；；；；注意してね＾＾；；；
    00024 //**********************************************************
    00025
    00026 //定数を定義する
    00028 #define DKINGYO_ULONGLONG_MAX 18446744073709551615
    00029
    00030 #define DKINGYO_LONGLONG_MAX 9223372036854775807
    00031
    00032 #define DKINGYO_LONGLONG_MIN -9223372036854775808
    00033
    00034 /*
    00035
    00036 (0xffffffff) unsigned long の最大値
    00037 INT_MAX 2147483647 (signed)  int の最大値
    00038 INT_MIN -2147483647-1 (signed)  int の最小値
    00039 LONG_MAX 2147483647 (signed)  long の最大値
    00040 LONG_MIN -2147483647-1 (signed)  long の最小値
    00041 */
    00042
    00043
    00044
    00045
    00046 //**********************************************************
    00047 //共通の定義
    00048 //**********************************************************
    00049
    00050
    00051
    00052 #ifdef __cplusplus
    00053 #       define DKUTIL_EXTERN extern "C"
    00054 #else
    00055
    00056 #       define DKUTIL_EXTERN extern
    00057 #endif
    00058
    00059
    00060
    00062 #define DKINGYO_NOT_MOUNTED -100
    00063
    00064 #define DKINGYO_NO_DEFINED_FUNCTION DKINGYO_NOT_MOUNTED
    00065
    00066
    00067
    00068 #ifdef _DEBUG
    00069 #       ifndef DEBUG
    00070 #               define DEBUG
    00071 #       endif
    00072 #endif
    00073 #ifdef _NDEBUG
    00074 #       ifndef NDEBUG
    00075 #               define NDEBUG
    00076 #       endif
    00077 #endif
    00078
    00079
    00080 //**********************************************************
    00081 //識別するための定義
    00082 //**********************************************************
    00083
    00084
    00085
    00086 enum edkOS{//OSのバージョンを取得するための列挙
    00087         enuWindows3_1 = 1,
    00088         enuWindowsNT3_51,
    00089         enuWindowsNT4_0,
    00090         enuWindows95,
    00091         enuWindows98,
    00092         enuWindows2000,
    00093         enuWindowsMe,
    00094         enuWindowsXP,
    00096         enuWindows_NET,
    00097
    00098 };
    00099
    00100
    00101 enum edkOSExtension{
    00103         edkOSE_OSR2 = 1,
    00105         edkOSE_edkSE,
    00107         edkOSE_HomeEditon,
    00109         edkOSE_Professional,
    00111         edkOSE_DataCenter_Server,
    00113         edkOSE_Advanced_Server,
    00114         edkOSE_Enterprise_Server,
    00115         edkOSE_Web_Server,
    00117         edkOSE_Server,
    00118
    00119 };
    00120
    00122 enum{
    00123         enuDKINGYO_BMPFILEHEADER_ADR = 1,
    00124         enuDKINGYO_BMPCOREHEADER_ADR,
    00125         enuDKINGYO_BMPINFOHEADER_ADR,
    00126         enuDKINGYO_BMPPALLETE_ADR,
    00127         enuDKINGYO_BMPGRAPH_ADR,
    00129         enuDKINGYO_ISBMPFILE_EXACT_CHECK,
    00131         enuDKINGYO_ISBMPFILE_CAMOUFLAGE_CHECK,
    00132 };
    00133
    00135 enum edkVariableType{
    00137         edkVariableUnknown = 0,//これを削除しないこと。この０のままにしておくこと。
    00139         edkInt,
    00141         edkUInt,
    00143         edkLongLong,
    00145         edkULongLong,
    00147         edkDouble,
    00149         edkString,
    00150 };
    00151
    00152
    00153
    00155 enum{
    00157         enuSTRLENGTH_INT_DU = 1,//ここは絶対に１ですからね！！いじっちゃダメ！
    00159         enuSTRLENGTH_UINT_DU,
    00161         enuSTRLENGTH_LONGLONG_DU,
    00163         enuSTRLENGTH_ULONGLONG_DU,
    00165         enuSTRLENGTH_DOUBLE,
    00166 };
    00167
    00169 enum edkFileSignature{
    00170         edkfALL = 0,
    00171         //テキスト系
    00172         edkfTXT,
    00173         edkfHTML,
    00174         edkfXML,
    00175         //ムービー系
    00176         edkfAVI,
    00177         edkfMPEG,
    00178         edkfMOV,
    00179         //音系
    00180         edkfWAV,
    00181         edkfMIDI,
    00182         edkfMP3,
    00183         edkfOGG,
    00184         //画像系
    00185         edkfPNG,
    00186         edkfBMP,
    00187         edkfTIFF,
    00188         edkfJPEG,
    00189         edkfGIF,
    00190         //圧縮系
    00191         edkfZIP,
    00192         edkfLZH,
    00193         edkfGZ,
    00194         edkfGCA,
    00195         edkfDGC,
    00196         edkfRAR,
    00197         //最後の印。
    00198         edkfSENTINEL,
    00199 };
    00200
    00201
    00207 enum edkResult{
    00209         edk_FAILED = -1,
    00211         edk_SUCCEEDED = 0,
    00213         edk_Not_Found,
    00215         edk_FileNotFound,
    00217         edk_Not_Selected,
    00219         edk_ArgumentException,
    00221         edk_ParsingError,
    00222
    00229         edk_LogicError,
    00231         edk_BufferOverFlow,
    00233         edk_OutputBufferWasLost,
    00235         edk_InputBufferWasLost,
    00237         edk_FileSignatureException,
    00239         edk_Not_Satisfactory,
    00241         edk_Not_Defined_Function,
    00243         edk_OutOfMemory,
    00245         edk_EndProcess,
    00247         edk_LogicException,
    00248 };
    00249
    00250 #define DKUTIL_SUCCEEDED(s) (s==edk_SUCCEEDED)
    00251 #define DKUTIL_FAILED(s) (s)//(s != edk_SUCCEEDED)
    00252 #define DKUTIL_FAILED_BOOL(s) (s != edk_SUCCEEDED)
    00253 #define DKUTIL_SUCCEEDED_BOOL(s) (s==edk_SUCCEEDED)
    00254 //**********************************************************
    00255 //デフォルト数の設定用定数の定義
    00256 //**********************************************************
    00257 enum{
    00259         enuExtendVaListLength = 256,
    00261         enuDefaultExpandSize = 100,
    00262 };
    00263
    00264 //**********************************************************
    00265 //型定義
    00266 //**********************************************************
    00267
    00268 //共通型
    00269 typedef void (*VOIDFUNC)(void);
    00270 typedef void (*VOIDARGFUNC)(void *);
    00271 typedef void (*VOIDARGFUNCFLAG)(void *,int);
    00272
    00273
    00274 #if 0
    00275
    00276
    00277
    00279 typedef void (*OGG_CALLBACK_DU)(char *ptr,size_t permit_num,size_t offset);
    00280
    00281
    00282 //CPUClockオブジェクト?型（実はオブジェクトとクラスの違いがわかってない私。
    00283
    00284 typedef BOOL (*ISTYPE_DU)(void);
    00285 typedef void (*NAMETYPE_DU)(char *,size_t);
    00286 typedef long (*CPUCLOCK_DU)(void);
    00287
    00288 typedef struct dCPUInfoObject{
    00289         ISTYPE_DU isMMX;
    00290         ISTYPE_DU isMMX2;
    00291         ISTYPE_DU isSSE;
    00292         ISTYPE_DU isSSE2;
    00293         ISTYPE_DU is3DNOW;
    00294         ISTYPE_DU isE3DNOW;
    00295         ISTYPE_DU isFPU;
    00296         ISTYPE_DU isTSC;
    00297         ISTYPE_DU isCPUID;
    00298         CPUCLOCK_DU GetCPUClock;
    00299         NAMETYPE_DU CopyCPUName;
    00300         NAMETYPE_DU CopyCPUType;
    00301         NAMETYPE_DU CopyCPUInfo;
    00302 }DKINGYOUTILITY2_CPU_INFO;
    00303
    00304
    00305
    00306
    00307 enum edkCSTL{
    00308         edkCSTL_push_back = 1,
    00309         edkCSTL_push_front,
    00310         edkCSTL_insert,
    00311 }
    00312
    00314 struct dkutil_CSTLContainer{
    00316         void *(*begin)(void);
    00318         void *(*end)(void);
    00320         void *(*next)(int);
    00322         void *(*first_data)(void);
    00324         void *(*next_data)(int);
    00333
    00334         int (*insert)(int flag,void *data,size_t size,const void *priority,size_t priority_size);
    00335 };
    00336
    00337 //SingleList Object type
    00338
    00340 typedef void (*SLIST_PUSH_DU)(size_t,const char *,size_t);
    00342 typedef void (*SLIST_POP_DU)(size_t,void);
    00344 typedef char *(*SLIST_GET_ITERATOR_DU)(size_t,void);
    00346 typedef char *(SLIST_NEXT_DU)(size_t,const char *);
    00347
    00349 typedef struct dSingleListObject{
    00350         size_t handle;
    00351         int (*push_back)(struct dSingleListObject *,const char *,size_t);
    00352         int (*push_front)(struct dSingleListObject *,const char *,size_t);
    00353         int (*pop_front)(struct dSingleListObject *);
    00354         int (*clear)(struct dSingleListObject *);
    00355         char *(*begin)(struct dSingleListObject *);
    00356         char *(*end)(struct dSingleListObject *);
    00357         char *(*next)(struct dSingleListObject *,char *);
    00358         int (*destructor)(struct dSingleListObject *);
    00359         int (*constructor)(struct dSingleListObject *);
    00360         char *(*reference_ptr)(struct dSingleListObject *,char *);
    00361         void (*set_size)(struct dSingleListObject *,size_t );
    00362 }DKINGYOUTILITY2_SINGLE_LIST;
    00363
    00364
    00365
    00366
    00368 enum edkParsedStringType{
    00369         enuDU2CSV_STRING = 1,
    00371         enuDU2CSV_STRING_32MORE,
    00372         enuDU2CSV_INT,
    00373         enuDU2CSV_LONGLONG,
    00374         enuDU2CSV_ULONGLONG,
    00375         enuDU2CSV_DOUBLE,
    00376 };
    00377
    00379 #define DCSVSTRUCTURE_PERMITSIZE_OFFSET_EXTENTION_NUM 3
    00380
    00381 #define DCSVSTRUCTURE_DEFAULT_STRING_BUFF_SIZE 32
    00382
    00383 typedef struct dCSVStructure{
    00384         size_t x,y;
    00385         int datatype;
    00386         union{
    00387                 union{
    00388                         union{
    00389                                 char str[DCSVSTRUCTURE_DEFAULT_STRING_BUFF_SIZE];
    00390                                 size_t permitsize[4];//添え字の３にptrの確保したサイズをぶち込めばいいな！！
    00391                         };
    00392                         char *ptr;
    00393                 };
    00394                 int i;
    00395                 LONGLONG ll;
    00396                 ULONGLONG ull;
    00397                 double dbl;
    00398         };
    00399         //size_t access_permit;//本当はstrとptrのunion内に入れたいけど
    00400         //ポインタは48BITとかあるらしいので、外部で我慢。
    00401         void (*constructor)(struct dCSVStructure *,int,size_t);
    00402         void (*destructor)(struct dCSVStructure *);
    00403 }DKINGYOUTILITY2_CSV_STRUCTURE;
    00404
    00405 #endif
    00406
    00407 typedef struct dkc_Allocator{
    00408         void (*malloc__)(size_t size);
    00409         void (*free__)(void *);
    00410         void (*realloc__)(void *,size_t);
    00411         void (*zero_memory)(void *,size_t);
    00412 }DKC_ALLOCATOR;
    00413
    00414
    00415 //**********************************************************
    00416 //dKingyoUtility2と同じ　マクロとか
    00417 //**********************************************************
    00418
    00420 #define MB(str) MessageBox(NULL,str,"Message",MB_OK)//MessageBox
    00421
    00422 #define MB2(s,title) MessageBox(NULL,s,title,MB_OK);
    00423
    00424 #define ODS(str) OutputDebugString(str)//OutputDebugString
    00425
    00427 #define SWAP_NUM(a,b) \
    00428     a = b - a ;\
    00429     b -= a ;\
    00430     a += b
    00431
    00437
    00438 #define SM_OFFSET(p_type,field)     ((unsigned int)&(((p_type)NULL)->field))
    00439
    00441 #define SET_RECT(rect, l, t, r, b) \
    00442 {\
    00443     rect##.left   = l;\
    00444     rect##.top    = t;\
    00445     rect##.right  = r;\
    00446     rect##.bottom = b;\
    00447 }
    00448
    00449 #define NULL_CHAR_ARRAY(s) memset((void *)s,0,sizeof(s))
    00450
    00451
    00452
    00453
    00454 #ifdef __cplusplus
    00455
    00485
    00486 #define SET_VA_LIST(buff,buffnum,origin) \
    00487 {\
    00488         va_list VaList;\
    00489         va_start( VaList , origin ) ;\
    00490         int r;\
    00491         r = _vsnprintf( buff ,buffnum - 1, origin , VaList );\
    00492         if(0 > r){\
    00493                 buff[buffnum - 1] = '\0';\
    00494         }else{\
    00495                 buff[r+1] = '\0';\
    00496         }\
    00497         va_end( VaList ); \
    00498 }
    00499
    00500
    00501 #       define DKUTIL_SAFE_REALLOC(b,s) ::realloc(b,s)
    00502 #       define DKUTIL_SAFE_MALLOC(s) ::malloc(s)
    00503 #       define DKUTIL_SAFE_FREE(a) if(a){::free(a);a=NULL;}
    00504
    00506 #       define DKUTIL_STRUCTURE_INIT(s) ::memset(&(s),0,sizeof(s))
    00507
    00508 #       define DKUTIL_MEMZERO(mem,size) ::memset(mem,0,size)
    00509 #else // for c lang
    00510 #define SET_VA_LIST_C(VaList,r,buff,buffnum,origin) \
    00511 {\
    00512         va_start( VaList , origin ) ;\
    00513         r = _vsnprintf( buff ,buffnum - 1, origin , VaList );\
    00514         if(0 > r){\
    00515                 buff[buffnum - 1] = '\0';\
    00516         }else{\
    00517                 buff[r+1] = '\0';\
    00518         }\
    00519         va_end( VaList ); \
    00520 }
    00521
    00522 #define DKUTIL_SAFE_REALLOC(b,s) realloc(b,s)
    00523 #define DKUTIL_SAFE_MALLOC(s) malloc(s)
    00524 #define DKUTIL_SAFE_FREE(a) if(a){free(a);a=NULL;}
    00525 #define DKUTIL_STRUCTURE_INIT(s) memset(&(s),0,sizeof(s))
    00526
    00527 #       define DKUTIL_MEMZERO(mem__,size__) memset(mem__,0,size__)
    00528 #endif
    00529
    00531 #define DKUTIL_ARRAY_NUMOF(array) (sizeof(array)/sizeof(array[0]))
    00532
    00533 #define DKUTIL_NAMELINK(X,Y) X##Y
    00534
    00535 #define DKUTIL_MAKESIGNATURE(X) DKUTIL_NAMELINK(X,__LINE__)
    00536
    00537 #define DKUTIL_MAKE_UINT_ID(id) ((((UINT)(id) & 0xFF) << 24) |     \
    00538                   (((UINT)(id) & 0xFF00) << 8) |    \
    00539                   (((UINT)(id) & 0xFF0000) >> 8) |  \
    00540                   (((UINT)(id) & 0xFF000000) >> 24))
    00541 #endif // end of include once