misc.h

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

Generated on Sat Sep 16 11:19:15 2006 for gwenhywfar by  doxygen 1.4.7