注释添加.

This commit is contained in:
Saturneic 2018-08-22 22:03:33 +08:00
parent aec58814c3
commit 5eaafa0b64
2 changed files with 476 additions and 66 deletions

View File

@ -35,7 +35,7 @@
9233C30F212292B000FB2485 /* md5.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = md5.c; path = id/md5.c; sourceTree = "<group>"; };
9246994F20CD000300B4E894 /* list.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = list.c; sourceTree = "<group>"; };
9246995020CD000300B4E894 /* list_expand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = list_expand.h; sourceTree = "<group>"; };
9246995120CD000300B4E894 /* list.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = list.h; sourceTree = "<group>"; };
9246995120CD000300B4E894 /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = list.h; sourceTree = "<group>"; };
9246995820CE52A700B4E894 /* stack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stack.h; sourceTree = "<group>"; };
9246995920CE52A700B4E894 /* stack.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack.c; sourceTree = "<group>"; };
9246995B20CE5C8900B4E894 /* stack_expand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stack_expand.h; sourceTree = "<group>"; };

View File

@ -3,141 +3,551 @@
#include "../type/type.h"
#include "../id/id.h"
/************************************************
*
************************************************/
/****
*ID相关
*/
/*直接获取一个以整型值初始化的节点不带ID的缩略*/
#define lni(x) nodeWithInt(x,0)
/*直接获取一个以无符号整型值初始化的不带ID节点的缩略*/
#define lnu(x) nodeWithUInt(x,0)
/*直接获取一个以无符号长整形值初始化的节点的缩略*/
#define lnull(x) nodeWithULLInt(x,0)
/*直接获取一个以浮点值初始化的不带ID节点的缩略*/
#define lnd(x) nodeWithDouble(x,0)
/*直接获取一个以字符串值初始化的不带ID节点的缩略*/
#define lns(x) nodeWithString(x,0)
/*直接获取一个以指针值初始化的不带ID节点的缩略*/
#define lnp(x) nodeWithPointer(x,0)
/****
*ID相关
*/
/*直接获取一个以整型值初始化的带ID节点的缩略*/
#define lsni(x) nodeWithInt(x,1)
/*直接获取一个以浮点值初始化的带ID节点的缩略*/
#define lsnd(x) nodeWithDouble(x,1)
/*直接获取一个以字符串值初始化的带ID节点的缩略*/
#define lsns(x) nodeWithString(x,1)
/*直接获取一个以指针值初始化的节点的缩略*/
#define lsnp(x) nodeWithPointer(x,1)
/************************************************
*
************************************************/
/****
*
*/
/*在链表尾部直接加入一个已经用整型值初始化的不带ID的节点*/
#define lisrti(list, x) insertInTail(list, lni(x));
/*在链表尾部直接加入一个已经用浮点值初始化的不带ID的节点*/
#define lisrtd(list, x) insertInTail(list, lnd(x));
/*在链表尾部直接加入一个已经用无符号整型值初始化的不带ID的节点*/
#define lisrtu(list, x) insertInTail(list, lnu(x));
/*在链表尾部直接加入一个已经用无符号长整型值初始化的不带ID的节点*/
#define lisrtull(list, x) insertInTail(list, lnull(x));
/*在链表尾部直接加入一个已经用指针值初始化的不带ID的节点*/
#define lisrtp(list, x) insertInTail(list, lnp(x));
/*在链表尾部直接加入一个已经用字符串值初始化的不带ID的节点*/
#define lisrts(list, x) insertInTail(list, lns(x));
/****
*
*/
/*在链表头部直接加入一个已经用整型值初始化的不带ID的节点*/
#define lisrhi(list, x) insertInHead(list, lni(x));
/*在链表头部直接加入一个已经用浮点值初始化的不带ID的节点*/
#define lisrhd(list, x) insertInHead(list, lnd(x));
/*在链表头部直接加入一个已经用无符号整型值初始化的不带ID的节点*/
#define lisrhu(list, x) insertInHead(list, lnu(x));
/*在链表头部直接加入一个已经用无符号长整型值初始化的不带ID的节点*/
#define lisrhull(list, x) insertInHead(list, lnull(x));
/*在链表头部直接加入一个已经用指针值初始化的不带ID的节点*/
#define lisrhp(list, x) insertInHead(list, lnp(x));
/*在链表头部直接加入一个已经用字符串值初始化的不带ID的节点*/
#define lisrhs(list, x) insertInHead(list, lns(x));
/************************************************
*
************************************************/
/*快速获得指针类型的节点所储存的值*/
#define lidxp(list, x) getByPointerForNode(findByIndexForNode(list, x))
/*快速获得整型类型的节点所储存的值*/
#define lidxi(list, x) getByIntForNode(findByIndexForNode(list, x))
/*快速获得浮点类型的节点所储存的值*/
#define lidxd(list, x) getByDoubleForNode(findByIndexForNode(list, x))
/*快速获得字符串类型的节点所储存的值*/
#define lidxs(list, x) getByStringForNode(findByIndexForNode(list, x))
/*快速获得无符号长整型类型的节点所储存的值*/
#define lupdull(list,x,value) updateValueWithULLIntForNode(findByIndexForNode(list, x),value)
/************************************************
*
************************************************/
/*通过节点的序号直接得到它的值*/
#define lidxvle(list,x) (findByIndexForNode(list, x)->value)
/*通过节点序号直接移除节点*/
#define lrmvidx(list,x) removeByNode(list, findByIndexForNode(list, x)
/*从列表头移除节点的缩略*/
#define lpoph(list) popFromHead(list)
/*从列表尾移除节点的缩略*/
#define lpopt(list) popFromTail(list)
/*通过节点的ID直接获得节点的值*/
#define lfndsid(list,sid) (findByIdForNode(list,sid)->value)
/*创建一个不带ID的链表的缩略*/
#define lstns() initList(0);
#define lstn() initList(0);
int safeModeForNode(int ifon);
int releaseSingleListForsafeModeForNode(List *p_list);
int releaseSingleNodeForsafeModeForNode(List *p_list);
int releaseAllForNode(void);
/*创建一个带有ID的链表缩略*/
#define lstn() initList(1);
List *initList(_Bool if_sid);
Node *initNode(_Bool if_sid);
s_Node *s_initNode(void);
/********************************************************************************************************/
int initMallocValueForNode(Node *,unsigned int,const void *);
/*********************************************************************************************************
*:,.,.
*:,使.,,.
*:使,..
*: 0,-1.
********************************************************************************************************/
extern int safeModeForNode(int ifon);
int insertInHead(List *p_list, Node *p_node);
int insertInTail(List *p_list, Node *p_node);
int insertAfterNode(List *p_list, Node *t_node, Node *p_node);
int insertBeforeNode(List *p_list, Node*t_node, Node *p_node);
int s_insertInHead(List *p_list, s_Node *s_p_node);
int s_insertInTail(List *p_list, s_Node *s_p_node);
/*属于安全模式操作内部调用,释放链表而不释放其中的值.*/
static int releaseSingleListForsafeModeForNode(List *p_list);
int replaceNode(List *p_list, Node *pt_node, Node *p_node);
int exchangeNode(List *p_list, Node *f_node, Node *s_node);
/*属于安全模式操作内部调用,释放节点而不释放其中的值.*/
static int releaseSingleNodeForsafeModeForNode(List *p_list);
Node *copyNode(Node *);
/*安全模式结束时调用,调用后将会释放所有在安全模式区间内用户已经分配过的链表和节点,安全模式将会关闭.*/
extern int releaseAllForNode(void);
int removeById(List *p_list, SID *s_id);
int removeByNode(List *p_list, Node *p_node);
Node *popFromHead(List *p_list);
Node *popFromTail(List *p_list);
/*
*,,if_sid指示是否为新链表分配ID号
*: ,NULL.*/
extern List *initList(_Bool if_sid);
unsigned long long len(List *p_list);
/*
*,,if_sid指示是否为新节点分配ID号
*: ,NULL.*/
extern Node *initNode(_Bool if_sid);
Node *findByIdForNode(List *p_list, SID * s_id);
void *findByIdForCustom(List *p_list, SID *s_id, int func(SID *));
Node *findByValue(List *p_list, unsigned int type, const void *value);
List *mply_findByValue(List *p_list, unsigned int type, const void *value);
int releaseList(List *p_list);
int s_releaseList(List *p_list);
int releaseListForCustom(List *p_list, int (*func)(void *));
int s_releaseListForCustom(List *p_list, int (*func)(void *));
int releaseListForSingle(List *p_list);
/************************************************
*
************************************************/
int releaseNode(Node *p_node);
int s_releaseNode(s_Node *s_p_node);
/*
*,List结构中.
*.,便.
*: ,NULL.*/
extern s_Node *s_initNode(void);
int releaseNodeForCustom(Node *p_node, int (*func)(void *));
int s_releaseNodeForCustom(s_Node *s_p_node, int (*func)(void *));
/*库中内部调用函数,旨在为新节点的储存值获取内存,并将相应的储存值储存在获取到的内存中,并指明储存值的类型.*/
static int initMallocValueForNode(Node *,unsigned int,const void *);
int releaseOnlyNode(Node *p_node);
int isListEmpty(List *p_list);
/*************************************************
*:
*************************************************/
/*
**
*: 0,-1.*/
extern int insertInHead(List *p_list, Node *p_node);
/*
*
*: 0,-1.*/
extern int insertInTail(List *p_list, Node *p_node);
/*
*
*: t_node为指向目标节点的指针;p_node为指向新节点的指针;
*: 0,-1.*/
extern int insertAfterNode(List *p_list, Node *t_node, Node *p_node);
/*
*
*: t_node为指向目标节点的指针;p_node为指向新节点的指针;
*: 0,-1.*/
extern int insertBeforeNode(List *p_list, Node*t_node, Node *p_node);
/*在单项链表的头部插入一个节点
*: 0,-1.*/
extern int s_insertInHead(List *p_list, s_Node *s_p_node);
/*
*
*: 0,-1.*/
extern int s_insertInTail(List *p_list, s_Node *s_p_node);
/***********************************************
:
***********************************************/
/*
*,
*: t_node为指向目标节点的指针;p_node为指向新节点的指针;
*/
extern int replaceNode(List *p_list, Node *t_node, Node *p_node);
/*
*
*: t_node为指向目标节点的指针;p_node为指向新节点的指针;
*/
extern int exchangeNode(List *p_list, Node *f_node, Node *s_node);
/**********************************************
*:
*********************************************/
/*
*,,.
*: ID相同.
*: ,NULL*/
extern Node *copyNode(Node *);
/*
*,,.
*: ID相同.
*: ,NULL*/
List *copyList(List *p_list);
int pushInfo(Info *p_info, const char *head,const char *body);
Error *pushError(unsigned int type, int pri, Info *p_info);
Notice *pushNotice(unsigned int type, Info *p_info);
Info *initInfo(const char *head, const char *body);
Error *createError(Info *info,unsigned int type,int pri);
Notice *createWarning(Info *info, unsigned int type, int pri);
int showError(Error *);
int showWarning(Notice *);
int enableListQuick(List *p_list);
int refreshFnNode(List *p_list);
int sortList(List *p_list, unsigned long long begin, unsigned long long end, int(*func)(Node *f_node, Node *s_node));
int sortListForCustom(List *p_list, int(*func)(Node *f_node, Node *s_node));
int indexTransfromer(List *p_list, unsigned long long m_index);
int indexChange(List *p_list, unsigned long long c_index, int move);
Node *getNodeByFnNode(List *p_list, unsigned long long index);
Node *findFnNode(List *p_list, Node *p_node);
void initIdxcList(List *p_list);
void digHole(List *p_list, Node *p_node);
int disableListQuick(List *p_list);
Node *findByIndexForNode(List *, unsigned long long);
Node *findByIntForNode(List *, int);
Node *findByDoubleForNode(List *, double);
Node *findByStringForNode(List *, char *);
Node *findByPointerForNode(List *, void *);
/***********************************************
*:
***********************************************/
Node *getListTail(List *);
Node *updateNodeByIndex(List *, void *, unsigned long long);
/*
*ID查找链表中的特定节点并从链表中移除相关节点,.
*0,-1.*/
extern int removeById(List *p_list, SID *s_id);
/*
*,
*0,-1.*/
extern int removeByNode(List *p_list, Node *p_node);
/*
*,,,便
*: ,NULL.*/
extern Node *popFromHead(List *p_list);
/*
*,,,便
*: ,NULL.*/
extern Node *popFromTail(List *p_list);
/***********************************************
*:
***********************************************/
/*
**/
extern unsigned long long len(List *p_list);
/*
*
*: 1,0.*/
int isListEmpty(List *p_list);
/*
*
*: */
int getByIntForNode(Node *);
/*
*
*: */
unsigned int getByUIntForNode(Node *);
/*
*
*: */
double getByDoubleForNode(Node *);
/*
*
*: */
char *getByStringForNode(Node *);
/*
*
*: */
void *getByPointerForNode(Node *);
/*
*
*: */
unsigned long long getIndexForNode(List *p_list,Node *p_node);
/*
*,.
*: ,NULL*/
Node *updateNodeByIndex(List *p_list, void *new_value, unsigned long long index);
/***********************************************
*:
**********************************************/
/*
*ID查找链表中相关的单个节点
*: ,NULL.*/
extern Node *findByIdForNode(List *p_list, SID * s_id);
/*
*
*: type指明相关值的类型;value为指向储存相关值的内存的指针.
*: ,NULL.*/
extern Node *findByValue(List *p_list, unsigned int type, const void *value);
/*
*
*: ,NULL.*/
extern Node *findByIndexForNode(List *, unsigned long long);
/*
*
*: ,NULL.*/
extern Node *findByIntForNode(List *, int);
/*
*
*: ,NULL.*/
extern Node *findByDoubleForNode(List *, double);
/*
*.
*: ,NULL.*/
extern Node *findByStringForNode(List *, char *);
/*
*.
*: ,NULL.*/
extern Node *findByPointerForNode(List *, void *);
//void *findByIdForCustom(List *p_list, SID *s_id, int func(SID *));
/*
*.
*: type指明相关值的类型;value为指向储存相关值的内存的指针.
*: ,.NULL.*/
extern List *mply_findByValue(List *p_list, unsigned int type, const void *value);
/***********************************************
*: 使,
**********************************************/
/*
*: .
*: type指明相关值的类型;value为指向储存相关值的内存的指针.
*: 0,-1.*/
static int sortList(List *p_list, unsigned long long begin, unsigned long long end, int(*func)(Node *f_node, Node *s_node));
/*
*.
*: func是一个函数指针, ,
0, 0.
*: 0,-1.*/
extern int sortListForCustom(List *p_list, int(*func)(Node *f_node, Node *s_node));
/***********************************************
*:
**********************************************/
/*
*
*: 0, -1.*/
extern int releaseList(List *p_list);
/*
*
*: 0, -1.*/
extern int s_releaseList(List *p_list);
/*
*
*: func是一个函数指针,,.
*: 0, -1.*/
extern int releaseListForCustom(List *p_list, int (*func)(void *));
/*
*
*: func是一个函数指针,,
* ,.
* 0,-1.
*: 0, -1.*/
extern int s_releaseListForCustom(List *p_list, int (*func)(void *));
/*
*,
*: 0, -1.*/
extern int releaseListForSingle(List *p_list);
/*
*
*: 0, -1.*/
extern int releaseNode(Node *p_node);
/*
*
*: 0, -1.*/
extern int s_releaseNode(s_Node *s_p_node);
/*
*
*: func是一个函数指针,,
* ,.
* 0,-1.
*: 0, -1.*/
extern int releaseNodeForCustom(Node *p_node, int (*func)(void *));
/*
*
*: func是一个函数指针,,
* ,.
* 0,-1.
*: 0, -1.*/
extern int s_releaseNodeForCustom(s_Node *s_p_node, int (*func)(void *));
/*
*,
*: 0, -1.*/
extern int releaseOnlyNode(Node *p_node);
/***********************************************
*:,,
* 便.
**********************************************/
extern int pushInfo(Info *p_info, const char *head,const char *body);
extern Error *pushError(unsigned int type, int pri, Info *p_info);
extern Notice *pushNotice(unsigned int type, Info *p_info);
extern Info *initInfo(const char *head, const char *body);
extern Error *createError(Info *info,unsigned int type,int pri);
extern Notice *createWarning(Info *info, unsigned int type, int pri);
extern int showError(Error *);
extern int showWarning(Notice *);
/***********************************************
*:,.
* ..
***********************************************/
/*
*
*: 0, -1.*/
extern int enableListQuick(List *p_list);
/*
*
*: 0, -1.*/
extern int disableListQuick(List *p_list);
static int refreshFnNode(List *p_list);
static int indexTransfromer(List *p_list, unsigned long long m_index);
static int indexChange(List *p_list, unsigned long long c_index, int move);
static Node *getNodeByFnNode(List *p_list, unsigned long long index);
static Node *findFnNode(List *p_list, Node *p_node);
static void initIdxcList(List *p_list);
static void digHole(List *p_list, Node *p_node);
//Node *getListTail(List *);
/***********************************************
*
***********************************************/
static int if_safeModeForNode;
static List *node_list;
static List *list_list;
#endif