00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #ifndef __CCP4_ARRAY_INC
00060 #define __CCP4_ARRAY_INC
00061
00062 #ifdef __cplusplus
00063 extern "C" {
00064 #endif
00065
00066 #include <stdlib.h>
00067 #include <string.h>
00068 static char rcsidha[] = "$Id$";
00069
00071 typedef const void *ccp4_constptr;
00073 typedef char *ccp4_byteptr;
00075 typedef void *ccp4_ptr;
00076
00078 typedef struct ccp4array_base_ {
00079 int size, capacity;
00080 } ccp4array_base;
00081
00087 #define ccp4array_new(v) ccp4array_new_((ccp4_ptr*)(&v))
00088
00095 #define ccp4array_new_size(v,s) ccp4array_new_size_((ccp4_ptr*)(&v),s,sizeof(*v))
00096
00105 #define ccp4array_resize(v,s) ccp4array_resize_((ccp4_ptr*)(&v),s,sizeof(*v))
00106
00115 #define ccp4array_reserve(v,s) ccp4array_reserve_((ccp4_ptr*)(&v),s,sizeof(*v))
00116
00123 #define ccp4array_append(v,d) ccp4array_append_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),sizeof(*v))
00124
00132 #define ccp4array_append_n(v,d,n) ccp4array_append_n_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),n,sizeof(*v))
00133
00141 #define ccp4array_append_list(v,l,n) ccp4array_append_list_((ccp4_ptr*)(&v),(ccp4_constptr)l,n,sizeof(*v))
00142
00150 #define ccp4array_insert(v,i,d) ccp4array_insert_((ccp4_ptr*)(&v),i,(ccp4_constptr)(&d),sizeof(*v))
00151
00158 #define ccp4array_delete_ordered(v,i) ccp4array_delete_ordered_((ccp4_ptr*)(&v),i,sizeof(*v))
00159
00165 #define ccp4array_delete(v,i) ccp4array_delete_((ccp4_ptr*)(&v),i,sizeof(*v))
00166
00171 #define ccp4array_delete_last(v) ccp4array_delete_last_((ccp4_ptr*)(&v),sizeof(*v))
00172
00177 #define ccp4array_size(v) ccp4array_size_((ccp4_constptr*)(&v))
00178
00183 #define ccp4array_free(v) ccp4array_free_((ccp4_ptr*)(&v))
00184
00188 ccp4_ptr ccp4array_new_(ccp4_ptr *p);
00192 ccp4_ptr ccp4array_new_size_(ccp4_ptr *p, const int size, const size_t reclen);
00196 void ccp4array_resize_(ccp4_ptr *p, const int size, const size_t reclen);
00200 void ccp4array_reserve_(ccp4_ptr *p, const int size, const size_t reclen);
00204 void ccp4array_append_(ccp4_ptr *p, ccp4_constptr data, const size_t reclen);
00208 void ccp4array_append_n_(ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen);
00212 void ccp4array_append_list_(ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen);
00216 void ccp4array_insert_(ccp4_ptr *p, const int i, ccp4_constptr data, const size_t reclen);
00220 void ccp4array_delete_ordered_(ccp4_ptr *p, const int i, const size_t reclen);
00224 void ccp4array_delete_(ccp4_ptr *p, const int i, const size_t reclen);
00228 void ccp4array_delete_last_(ccp4_ptr *p, const size_t reclen);
00232 int ccp4array_size_(ccp4_constptr *p);
00236 void ccp4array_free_(ccp4_ptr *p);
00237
00238 #ifdef __cplusplus
00239 }
00240 #endif
00241
00242 #endif