1 /*********************************************************************************
\r
3 * --------------------------------------------------------------------------------
\r
5 * This file is part of MiMic
\r
6 * Copyright (C)2011 Ryo Iizuka
\r
8 * MiMic is free software: you can redistribute it and/or modify
\r
9 * it under the terms of the GNU Lesser General Public License as published
\r
10 * by the Free Software Foundation, either version 3 of the License, or
\r
11 * (at your option) any later version.
\r
13 * This program is distributed in the hope that it will be useful,
\r
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 * GNU General Public License for more details.
\r
18 * You should have received a copy of the GNU Lesser General Public License
\r
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
21 * For further information please contact.
\r
23 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
\r
25 *********************************************************************************/
\r
26 #include "NyLPC_cPtrTbl.h"
\r
28 void NyLPC_cPtrTbl_initialize(NyLPC_TcPtrTbl_t* i_inst,void** i_buf,NyLPC_TUInt16 i_size)
\r
30 i_inst->size=i_size;
\r
33 memset(i_inst->buf,0,i_size*sizeof(void*));
\r
35 void* NyLPC_cPtrTbl_get(NyLPC_TcPtrTbl_t* i_inst,NyLPC_TUInt16 i_index)
\r
37 return i_inst->buf[i_index];
\r
40 void NyLPC_cPtrTbl_set(NyLPC_TcPtrTbl_t* i_inst,NyLPC_TUInt16 i_index,void* i_val)
\r
42 void** p=(i_inst->buf+i_index);
\r
59 NyLPC_TInt16 NyLPC_cPtrTbl_add(NyLPC_TcPtrTbl_t* i_inst,void* i_val)
\r
62 void** p=i_inst->buf;
\r
64 for(i=i_inst->size-1;i>=0;i--){
\r
66 NyLPC_cPtrTbl_set(i_inst,i,i_val);
\r
74 * i_indexの要素に、NULLをセットして削除します。
\r
76 void NyLPC_cPtrTbl_remove(NyLPC_TcPtrTbl_t* i_inst,NyLPC_TUInt16 i_index)
\r
78 NyLPC_cPtrTbl_set(i_inst,i_index,NULL);
\r
82 NyLPC_TInt16 NyLPC_cPtrTbl_getIndex(NyLPC_TcPtrTbl_t* i_inst,void* i_val)
\r
85 void** p=i_inst->buf;
\r
87 for(i=i_inst->size-1;i>=0;i--){
\r
97 * この数は、テーブルに存在する有効なポインタの数です。
\r
99 NyLPC_TInt16 NyLPC_cPtrTbl_getLength(NyLPC_TcPtrTbl_t* i_inst)
\r
101 return i_inst->len;
\r
104 NyLPC_TBool NyLPC_cPtrTbl_hasEmpty(NyLPC_TcPtrTbl_t* i_inst)
\r
106 return i_inst->len<i_inst->size;
\r