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 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
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