list.h

来自「使用于OS/2下的小工具的C源程序,使用于OS/2下的小工具的C源程序」· C头文件 代码 · 共 60 行

H
60
字号
/* =====================================================
*
* LIST.C
*
* This file contains definitions for doubly linked list data structure.
*
* Copyright(c): Martti Ylikoski. 1991
*
* Programmer:	Martti Ylikoski
* Created:	21.12.1991
* Version:	1.0
*
* ====================================================== */
#ifndef LIST_DEFINED
#define LIST_DEFINED
/* Error definitions: move later to list.h and make them enum */
#define LIST_OK  0

#define LIST_ERR_MEMORY_ALLOCATION	100
#define LIST_ERR_BAD_POINTER            101
#define LIST_ERR_NO_CURR                102
#define LIST_ERR_END_LIST               103
#define LIST_ERR_BEG_LIST               104

typedef struct {
    void *buf ;        /* pointer to actual data */
   long buflen ;       /* length of data */
   int used ;          /* needed ?? */
   void *prior ;       /* prior item in chain */
   void *next ;        /* next item in chain */
   /* void *userdata */
} LIST_ENTRY ;

typedef struct {
   LIST_ENTRY *beginptr ; /* first entry in list */
   LIST_ENTRY *endptr ;   /* last entry in list */
   LIST_ENTRY *currptr ;  /* current entry */
   long currno ;          /* current rows ordinal number in list */
   long itemscount ;       /* count of items in list */
   /* void * userdata */
/*    int ( *searchfn) () ; */
} HNDLIST ;

HNDLIST *ListInit(void) ;
int ListExit(HNDLIST *lhandle) ;
int ListAdd (HNDLIST *lhandle, void *buf, long buflen ) ;
int ListInsert(HNDLIST *lhandle, void *buf, long buflen) ;
int ListDel(HNDLIST *lhandle) ;
int ListReturn(HNDLIST *lhandle, void **buf, unsigned long *buflen) ;
int ListOverwrite(HNDLIST *lhandle, void *buf, long buflen) ;
int ListFirst(HNDLIST *lhandle) ;
int ListLast(HNDLIST *lhandle) ;
int ListForward(HNDLIST *lhandle, long forward) ;
int ListNext(HNDLIST *lhandle) ;
int ListBackward(HNDLIST *lhandle, long backward) ;
int ListPrior(HNDLIST *lhandle) ;
LIST_ENTRY *ListGetPos(HNDLIST * lhandle, int *actioncode, long *currno) ;
int ListSetPos(HNDLIST * lhandle, LIST_ENTRY *newcurrptr, long newcurrno) ;
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?