Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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