gwenhywfar
4.3.3
|
00001 /*************************************************************************** 00002 begin : Sat Jun 28 2003 00003 copyright : (C) 2003-2010 by Martin Preuss 00004 email : martin@libchipcard.de 00005 00006 *************************************************************************** 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00021 * MA 02111-1307 USA * 00022 * * 00023 ***************************************************************************/ 00024 00067 #ifndef GWENHYWFAR_MISC_H 00068 #define GWENHYWFAR_MISC_H 00069 00070 #include <gwenhywfar/gwenhywfarapi.h> 00071 #include <gwenhywfar/types.h> 00072 #include <stdio.h> 00073 #include <stdlib.h> 00074 #include <string.h> 00075 #include <assert.h> 00076 00077 00078 #ifdef __cplusplus 00079 extern "C" { 00080 #endif 00081 00082 #define GWEN_LIST_ADD(typ, sr, head) {\ 00083 typ *curr; \ 00084 \ 00085 assert(sr); \ 00086 \ 00087 curr=*head; \ 00088 if (!curr) { \ 00089 *head=sr; \ 00090 } \ 00091 else { \ 00092 while(curr->next) { \ 00093 curr=curr->next; \ 00094 } \ 00095 curr->next=sr; \ 00096 }\ 00097 } 00098 00099 00100 #define GWEN_LIST_INSERT(typ, sr, head) {\ 00101 typ *curr; \ 00102 \ 00103 assert(sr); \ 00104 \ 00105 curr=*head; \ 00106 if (!curr) { \ 00107 *head=sr; \ 00108 } \ 00109 else { \ 00110 sr->next=curr;\ 00111 *head=sr;\ 00112 }\ 00113 } 00114 00115 00116 #define GWEN_LIST_DEL(typ, sr, head) {\ 00117 typ *curr; \ 00118 \ 00119 assert(sr); \ 00120 curr=*head; \ 00121 if (curr) { \ 00122 if (curr==sr) { \ 00123 *head=curr->next; \ 00124 } \ 00125 else { \ 00126 while(curr->next!=sr) { \ 00127 curr=curr->next; \ 00128 } \ 00129 if (curr) \ 00130 curr->next=sr->next; \ 00131 } \ 00132 } \ 00133 sr->next=0;\ 00134 } 00135 00136 00137 /* defgroup */ 00139 00140 #ifdef __cplusplus 00141 } 00142 #endif 00143 00144 00145 #include <gwenhywfar/memory.h> 00146 #include <gwenhywfar/list1.h> 00147 00148 00149 00150 00151 #endif 00152 00153 00154