misc.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003  -------------------
00004  cvs         : $Id: misc.h 1393 2007-11-22 18:26:05Z martin $
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                             \
00090   curr=*head;               \
00091   if (!curr) {              \
00092     *head=sr;               \
00093   }                         \
00094   else {                    \
00095     while(curr->next) {     \
00096       curr=curr->next;      \
00097     }                       \
00098     curr->next=sr;          \
00099   }\
00100   }
00101 
00102 
00103 #define GWEN_LIST_INSERT(typ, sr, head) {\
00104   typ *curr;                \
00105                             \
00106   assert(sr);               \
00107                             \
00108   curr=*head;               \
00109   if (!curr) {              \
00110     *head=sr;               \
00111   }                         \
00112   else {                    \
00113     sr->next=curr;\
00114     *head=sr;\
00115   }\
00116   }
00117 
00118 
00119 #define GWEN_LIST_DEL(typ, sr, head) {\
00120   typ *curr;                   \
00121                                \
00122   assert(sr);                  \
00123   curr=*head;                  \
00124   if (curr) {                  \
00125     if (curr==sr) {            \
00126       *head=curr->next;        \
00127     }                          \
00128     else {                     \
00129       while(curr->next!=sr) {  \
00130         curr=curr->next;       \
00131       }                        \
00132       if (curr)                \
00133         curr->next=sr->next;   \
00134     }                          \
00135   }                            \
00136   sr->next=0;\
00137   }
00138 
00139 
00140  /* defgroup */
00142 
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146 
00147 
00148 #include <gwenhywfar/memory.h>
00149 #include <gwenhywfar/list1.h>
00150 
00151 
00152 
00153 
00154 #endif
00155 
00156 
00157 

Generated on Fri Apr 11 01:53:47 2008 for gwenhywfar by  doxygen 1.5.5