00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NPS_DARRAY_H
00013 #define NPS_DARRAY_H
00014 #endif
00015
00016 #include <stdlib.h>
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef T_
00029 #error "T_ not defined"
00030 #endif
00031
00032 #ifndef TY
00033 #error "TY not defined"
00034 #endif
00035
00036 #include "../error/error.h"
00037
00038 #if !defined BUILDING_NPS_DARRAY && !defined NPS_SMALL && !defined DARRAY_LKG
00039 # define DARRAY_LKG static inline
00040 #else
00041 # define DARRAY_LKG
00042 #endif
00043
00044 typedef struct {
00045 unsigned long size;
00046 unsigned long length;
00047 TY *data;
00048 } T_(array_t);
00049
00050
00051
00052
00053
00054
00055
00056
00057 DARRAY_LKG T_(array_t) *T_(array_new)(unsigned long length, unsigned long size, TY *initVal);
00058 DARRAY_LKG void T_(array_del)(T_(array_t) *a);
00059 DARRAY_LKG int T_(array_append)(T_(array_t) *a, TY data, nps_error_t *error);
00060 DARRAY_LKG TY T_(array_pop)(T_(array_t) *o);
00061 DARRAY_LKG TY T_(array_get)(T_(array_t) *a, unsigned long ix);
00062 DARRAY_LKG void T_(array_set)(T_(array_t) *a, unsigned long ix, TY value);
00063
00064 DARRAY_LKG int T_(array_resize)(T_(array_t) *a,unsigned long size, nps_error_t *error);
00065 DARRAY_LKG void T_(array_iter)(T_(array_t) *o, void (*operator)(TY ));
00066 DARRAY_LKG void T_(array_sort)(T_(array_t) *o, int (*cmp)(const void *, const void *));
00067 DARRAY_LKG int64_t T_(array_len)(T_(array_t) *o);
00068
00069 #ifndef NPS_DARRAY_H_KEEP
00070 #undef T_
00071 #undef TY
00072
00073 #endif
00074
00075
00076
00077