00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
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