⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.h

📁 打魔兽战网的都知道他是什么
💻 H
字号:
/* * Copyright (C) 1999,2000  Ross Combs (rocombs@cs.nmsu.edu) * * 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. */#ifndef INCLUDED_LIST_TYPES#define INCLUDED_LIST_TYPEStypedef struct elem#ifdef LIST_INTERNAL_ACCESS{    void *        data;    struct elem * prev;    struct elem * next;}#endift_elem;typedef struct list#ifdef LIST_INTERNAL_ACCESS{    unsigned int  len;    t_elem *      head;    t_elem *      tail;}#endift_list;#endif/*****/#ifndef JUST_NEED_TYPES#ifndef INCLUDED_LIST_PROTOS#define INCLUDED_LIST_PROTOSextern t_list * list_create(void) ;extern int list_destroy(t_list * list);extern unsigned int list_get_length(t_list const * list);extern int list_prepend_data(t_list * list, void * data);extern int list_append_data(t_list * list, void * data);extern t_elem * list_get_elem_by_data(t_list const * list, void const * data);extern t_elem const * list_get_elem_by_data_const(t_list const * list, void const * data);/* note changed API for those commands:     due to direct removal of elements from list, you need to take special care during list traversal.     a pointer to the traversal variable needs to be passed to the list_remove functions, so they     can properly modify it to point to the "previous" element (the one before the element to be deleted)     so the next elem_get_next call will address the "next" element (the one after the element to be deleted) */   extern int list_remove_data(t_list * list, void const * data, t_elem ** elem); /* delete matching item */extern int list_remove_elem(t_list * list, t_elem ** elem);extern void * list_get_data_by_pos(t_list const * list, unsigned int pos);#ifdef LIST_DEBUGextern t_elem * list_get_first_real(t_list const * list, char const * fn, unsigned int ln);# define list_get_first(L) list_get_first_real(L,__FILE__,__LINE__)#elseextern t_elem * list_get_first(t_list const * list);#endif#ifdef LIST_DEBUGextern t_elem const * list_get_first_const_real(t_list const * list, char const * fn, unsigned int ln);# define list_get_first_const(L) list_get_first_const_real(L,__FILE__,__LINE__)#elseextern t_elem const * list_get_first_const(t_list const * list);#endifextern void * elem_get_data(t_elem const * elem);extern int elem_set_data(t_elem * elem, void * data);#define elem_get_next(list,elem) elem_get_next_real(list,elem,__FILE__,__LINE__)extern t_elem * elem_get_next_real(t_list const * list, t_elem const * elem,char const * fn, unsigned int ln);extern t_elem const * elem_get_next_const(t_list const * list, t_elem const * elem);#define LIST_TRAVERSE(list,curr) for (curr=(list)?list_get_first(list):(NULL); curr; curr=elem_get_next(list,curr))#define LIST_TRAVERSE_CONST(list,curr) for (curr=(list)?list_get_first_const(list):(NULL); curr; curr=elem_get_next_const(list,curr))#endif#endif

⌨️ 快捷键说明

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