// Copyright (c) 2013年 Hikaru Nishida. All rights reserved.\r
//\r
\r
+//UIPArray関連のうち、このソースファイルで完結する関数群\r
+\r
//\r
//Include headers\r
//\r
//\r
typedef struct CHNLIB_UIPARRAY_INTERNAL_TAG CHNLIB_UIPArray_Internal_Tag;\r
struct CHNLIB_UIPARRAY_INTERNAL_TAG {\r
+ //UIPArrayの一つの添字に対応するデータを格納する構造体\r
uint data32;\r
void *pointer;\r
};\r
\r
struct CHNLIB_UIPARRAY {\r
+ //UnsignedIntとPointerを格納するArray構造体\r
CHNLIB_StructureHeader header;\r
\r
int using_tags; //Number of using tags in this pack.\r
//\r
CHNLIB_UIPArray *CHNLIB_UIPArray_Initialize(void)\r
{\r
+ //ポインタを初期化する(NULLを返す)。\r
return NULL;\r
}\r
\r
int CHNLIB_UIPArray_AppendLast(CHNLIB_UIPArray **array, uint data32, void *pointer)\r
{\r
+ //Arrayの末尾にデータを追加する。\r
int index;\r
\r
index = 0;\r
\r
int CHNLIB_UIPArray_GetNumberOfDatas(const CHNLIB_UIPArray *array)\r
{\r
+ //Arrayで現在使用中のデータの個数を返す。\r
int tags;\r
\r
tags = 0;\r
\r
uint CHNLIB_UIPArray_GetData32ByIndex(const CHNLIB_UIPArray *array, int index)\r
{\r
+ //retv:array[index]->data32\r
for(; (index / CHNLIB_UIPArray_INTERNAL_PACKDATAS) > 0; index -= CHNLIB_UIPArray_INTERNAL_PACKDATAS){\r
if(array == NULL){\r
return 0;\r
\r
void *CHNLIB_UIPArray_GetPointerByIndex(const CHNLIB_UIPArray *array, int index)\r
{\r
+ //retv:array[index]->pointer\r
for(; (index / CHNLIB_UIPArray_INTERNAL_PACKDATAS) > 0; index -= CHNLIB_UIPArray_INTERNAL_PACKDATAS){\r
if(array == NULL){\r
return NULL;\r
\r
int CHNLIB_UIPArray_GetIndexByData32(const CHNLIB_UIPArray *array, uint data32)\r
{\r
+ //指定されたdata32を持つ最小のIndexを返す。\r
int i, i_max;\r
\r
i_max = CHNLIB_UIPArray_GetNumberOfDatas(array);\r
\r
void *CHNLIB_UIPArray_GetPointerByData32(const CHNLIB_UIPArray *array, uint data32)\r
{\r
+ //指定されたdata32を持つindexのデータのPointerを返す。\r
return CHNLIB_UIPArray_GetPointerByIndex(array, CHNLIB_UIPArray_GetIndexByData32(array, data32));\r
}\r
\r
//\r
CHNLIB_UIPArray *CHNLIB_UIPArray_Internal_Allocate(void)\r
{\r
+ //Arrayの実体を確保する。\r
+ //このソース以外から呼び出してはならない。\r
CHNLIB_UIPArray *tag;\r
\r
- tag = (CHNLIB_UIPArray *)CHNLIB_System_AllocateMemory_Strict(sizeof(CHNLIB_UIPArray), __FILE__, __LINE__, __FUNCTION__);\r
+ tag = (CHNLIB_UIPArray *)CHNLIB_System_AllocateMemory_Strict(sizeof(CHNLIB_UIPArray), CHNLIB_DEBUG_ARGUMENTS);\r
\r
CHNLIB_StructureHeader_Initialize(&tag->header, CHNLIB_STRUCT_ID_UIPArray);\r
\r