Eneboo - Documentación para desarrolladores
|
00001 /* Copyright (C) 2000 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00015 00016 #ifndef _list_h_ 00017 #define _list_h_ 00018 00019 #ifdef __cplusplus 00020 extern "C" { 00021 #endif 00022 00023 typedef struct st_list { 00024 struct st_list *prev,*next; 00025 void *data; 00026 } LIST; 00027 00028 typedef int (*list_walk_action)(void *,void *); 00029 00030 extern LIST *list_add(LIST *root,LIST *element); 00031 extern LIST *list_delete(LIST *root,LIST *element); 00032 extern LIST *list_cons(void *data,LIST *root); 00033 extern LIST *list_reverse(LIST *root); 00034 extern void list_free(LIST *root,unsigned int free_data); 00035 extern unsigned int list_length(LIST *); 00036 extern int list_walk(LIST *,list_walk_action action,gptr argument); 00037 00038 #define list_rest(a) ((a)->next) 00039 #define list_push(a,b) (a)=list_cons((b),(a)) 00040 #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); } 00041 00042 #ifdef __cplusplus 00043 } 00044 #endif 00045 #endif