📄 list.h
字号:
/******************************************************************************
Copyright(C) 2005,2006 Frank ZHANG
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA.
/******************************************************************************
* Authors : Frank ZHANG (openmgcp@gmail.com)
* Description :
*
*
* Date of creation : 04/03/2005
*
*
* History :
* 2005/04/03 Frank ZHANG : - Creation
******************************************************************************/
#ifndef __LIST_H__
#define __LIST_H__
#ifdef __cplusplus
extern "C" {#endif
/* Single-linked list*/
typedef struct TSListNode_tag {
void *data;
struct TSListNode_tag *next;
} TSListNode;
typedef struct TSList_tag {
int count;
TSListNode *cur;
TSListNode *pre;
TSListNode *head;
TSListNode *tail;
} TSList, SLIST;
/* Doubly-linked list */
typedef struct TDListNode_tag {
void *data;
struct TDListNode_tag *next;
struct TDListNode_tag *prev;
} TDListNode;
typedef struct TDList_tag {
int count;
TDListNode *cur;
TDListNode *pre;
TDListNode *head;
TDListNode *tail;
} TDList,DLIST;
/* List node data compare function */
typedef int (*CompareEqualFunc)(void *pFirstData, void *pSecondData);
void SListInit(TSList* pList);
void SListReset(TSList* pList);
TSListNode* SListNextNode(TSList* pList);
void* SListGetCurData(TSList* pList);
void SListFreeAll(TSList* pList);
void SListDel(TSList* pList);
TSListNode* SListAdd(TSList* pList, void* pData);
TSListNode* SListAppend(TSList* pList, void* pData);
TSListNode* SListFindByPointer(TSList* pList, void* pData);
TSListNode* SListFind(TSList* pList, void* pData, CompareEqualFunc CompFunc);
void SListDelCurNode(TSList* pList);
void SListDelNodeByData(TSList* pList, void* pData);
void SListMerger(TSList* pDesList, TSList* pSrcList);
#ifdef __cplusplus}#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -