gpp4 1.3.1
|
00001 /* 00002 ccp4_array.h: header file for resizable array implementation. 00003 Copyright (C) 2002 Kevin Cowtan 00004 00005 This library is free software: you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation, either 00008 version 3 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with This library. If not, see 00017 <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00069 #ifndef __CCP4_ARRAY_INC 00070 #define __CCP4_ARRAY_INC 00071 00072 #ifdef __cplusplus 00073 extern "C" { 00074 #endif 00075 00076 #include <stdlib.h> 00077 #include <string.h> 00078 00080 typedef const void *ccp4_constptr; 00082 typedef char *ccp4_byteptr; 00084 typedef void *ccp4_ptr; 00085 00088 typedef struct ccp4array_base_ { 00089 int size; 00090 int capacity; 00091 } ccp4array_base; 00092 00098 #define ccp4array_new(v) ccp4array_new_((ccp4_ptr*)(&v)) 00099 00106 #define ccp4array_new_size(v,s) ccp4array_new_size_((ccp4_ptr*)(&v),s,sizeof(*v)) 00107 00116 #define ccp4array_resize(v,s) ccp4array_resize_((ccp4_ptr*)(&v),s,sizeof(*v)) 00117 00126 #define ccp4array_reserve(v,s) ccp4array_reserve_((ccp4_ptr*)(&v),s,sizeof(*v)) 00127 00134 #define ccp4array_append(v,d) ccp4array_append_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),sizeof(*v)) 00135 00143 #define ccp4array_append_n(v,d,n) ccp4array_append_n_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),n,sizeof(*v)) 00144 00152 #define ccp4array_append_list(v,l,n) ccp4array_append_list_((ccp4_ptr*)(&v),(ccp4_constptr)l,n,sizeof(*v)) 00153 00161 #define ccp4array_insert(v,i,d) ccp4array_insert_((ccp4_ptr*)(&v),i,(ccp4_constptr)(&d),sizeof(*v)) 00162 00169 #define ccp4array_delete_ordered(v,i) ccp4array_delete_ordered_((ccp4_ptr*)(&v),i,sizeof(*v)) 00170 00176 #define ccp4array_delete(v,i) ccp4array_delete_((ccp4_ptr*)(&v),i,sizeof(*v)) 00177 00182 #define ccp4array_delete_last(v) ccp4array_delete_last_((ccp4_ptr*)(&v),sizeof(*v)) 00183 00188 #define ccp4array_size(v) ccp4array_size_((ccp4_constptr*)(&v)) 00189 00194 #define ccp4array_free(v) ccp4array_free_((ccp4_ptr*)(&v)) 00195 00199 ccp4_ptr ccp4array_new_(ccp4_ptr *p); 00203 ccp4_ptr ccp4array_new_size_(ccp4_ptr *p, const int size, const size_t reclen); 00207 void ccp4array_resize_(ccp4_ptr *p, const int size, const size_t reclen); 00211 void ccp4array_reserve_(ccp4_ptr *p, const int size, const size_t reclen); 00215 void ccp4array_append_(ccp4_ptr *p, ccp4_constptr data, const size_t reclen); 00219 void ccp4array_append_n_(ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen); 00223 void ccp4array_append_list_(ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen); 00227 void ccp4array_insert_(ccp4_ptr *p, const int i, ccp4_constptr data, const size_t reclen); 00231 void ccp4array_delete_ordered_(ccp4_ptr *p, const int i, const size_t reclen); 00235 void ccp4array_delete_(ccp4_ptr *p, const int i, const size_t reclen); 00239 void ccp4array_delete_last_(ccp4_ptr *p, const size_t reclen); 00243 int ccp4array_size_(ccp4_constptr *p); 00247 void ccp4array_free_(ccp4_ptr *p); 00248 00249 #ifdef __cplusplus 00250 } 00251 #endif 00252 00253 #endif /* __CCP4_ARRAY_INC */ 00254 00255 /* 00256 Local variables: 00257 mode: font-lock 00258 End: 00259 */