|
#define | DG__DYNARR_H |
|
#define | DG_DYNARR_INDEX_CHECK_LEVEL 3 |
|
#define | DG_DYNARR_ASSERT(cond, msg) assert((cond) && msg) |
|
#define | DG_DYNARR_DEF |
|
#define | DG_DYNARR_INLINE static INLINE |
|
#define | DA_TYPEDEF(TYPE, NewArrayTypeName) DG_DYNARR_TYPEDEF(TYPE, NewArrayTypeName) |
|
#define | da_init(a) dg_dynarr_init(a) |
|
#define | da_init_external(a, buf, buf_cap) dg_dynarr_init_external(a, buf, buf_cap) |
|
#define | da_free(a) dg_dynarr_free(a) |
|
#define | da_push(a, v) dg_dynarr_push(a, v) |
|
#define | da_add(a, v) dg_dynarr_add(a, v) |
|
#define | da_addn(a, vals, n) dg_dynarr_addn(a, vals, n) |
|
#define | da_addn_zeroed(a, n) dg_dynarr_addn_zeroed(a, n) |
|
#define | da_addn_uninit(a, n) dg_dynarr_addn_uninit(a, n) |
|
#define | da_insert(a, idx, v) dg_dynarr_insert(a, idx, v) |
|
#define | da_insertn(a, idx, vals, n) dg_dynarr_insertn(a, idx, vals, n) |
|
#define | da_insertn_zeroed(a, idx, n) dg_dynarr_insertn_zeroed(a, idx, n) |
|
#define | da_insertn_uninit(a, idx, n) dg_dynarr_insertn_uninit(a, idx, n) |
|
#define | da_set(a, idx, v) dg_dynarr_set(a, idx, v) |
|
#define | da_setn(a, idx, vals, n) dg_dynarr_setn(a, idx, vals, n) |
|
#define | da_delete(a, idx) dg_dynarr_delete(a, idx) |
|
#define | da_deleten(a, idx, n) dg_dynarr_deleten(a, idx, n) |
|
#define | da_deletefast(a, idx) dg_dynarr_deletefast(a, idx) |
|
#define | da_deletenfast(a, idx, n) dg_dynarr_deletenfast(a, idx, n) |
|
#define | da_clear(a) dg_dynarr_clear(a) |
|
#define | da_setcount(a, cnt) dg_dynarr_setcount(a, cnt) |
|
#define | da_reserve(a, cap) dg_dynarr_reserve(a, cap) |
|
#define | da_shrink_to_fit(a) dg_dynarr_shrink_to_fit(a) |
|
#define | da_pop(a) dg_dynarr_pop(a) |
|
#define | da_last(a) dg_dynarr_last(a) |
|
#define | da_lastptr(a) dg_dynarr_lastptr(a) |
|
#define | da_get(a, idx) dg_dynarr_get(a,idx) |
|
#define | da_getptr(a, idx) dg_dynarr_getptr(a, idx) |
|
#define | da_begin(a) dg_dynarr_begin(a) |
|
#define | da_end(a) dg_dynarr_end(a) |
|
#define | da_count(a) dg_dynarr_count(a) |
|
#define | da_capacity(a) dg_dynarr_capacity(a) |
|
#define | da_empty(a) dg_dynarr_empty(a) |
|
#define | da_oom(a) dg_dynarr_oom(a) |
|
#define | da_sort(a, cmp) dg_dynarr_sort(a, cmp) |
|
#define | DG_DYNARR_TYPEDEF(TYPE, NewArrayTypeName) typedef struct { TYPE* p; dg__dynarr_md md; } NewArrayTypeName; |
|
#define | dg_dynarr_init(a) dg__dynarr_init((void**)&(a).p, &(a).md, NULL, 0) |
|
#define | dg_dynarr_init_external(a, buf, buf_cap) dg__dynarr_init((void**)&(a).p, &(a).md, (buf), (buf_cap)) |
|
#define | dg_dynarr_free(a) dg__dynarr_free((void**)&(a).p, &(a).md) |
|
#define | dg_dynarr_push(a, v) (dg__dynarr_maybegrowadd(dg__dynarr_unp(a), 1) ? (((a).p[(a).md.cnt++] = (v)),0) : 0) |
|
#define | dg_dynarr_add(a, v) dg_dynarr_push((a), (v)) |
|
#define | dg_dynarr_addn(a, vals, n) |
|
#define | dg_dynarr_addn_zeroed(a, n) (dg__dynarr_add(dg__dynarr_unp(a), (n), 1) ? &(a).p[(a).md.cnt-(size_t)(n)] : NULL) |
|
#define | dg_dynarr_addn_uninit(a, n) (dg__dynarr_add(dg__dynarr_unp(a), (n), 0) ? &(a).p[(a).md.cnt-(size_t)(n)] : NULL) |
|
#define | dg_dynarr_insert(a, idx, v) |
|
#define | dg_dynarr_insertn(a, idx, vals, n) |
|
#define | dg_dynarr_insertn_zeroed(a, idx, n) |
|
#define | dg_dynarr_insertn_uninit(a, idx, n) |
|
#define | dg_dynarr_set(a, idx, v) |
|
#define | dg_dynarr_setn(a, idx, vals, n) |
|
#define | dg_dynarr_delete(a, idx) (dg__dynarr_checkidx((a),(idx)), dg__dynarr_delete(dg__dynarr_unp(a), (idx), 1)) |
|
#define | dg_dynarr_deleten(a, idx, n) (dg__dynarr_checkidx((a),(idx)), dg__dynarr_delete(dg__dynarr_unp(a), (idx), (n))) |
|
#define | dg_dynarr_deletefast(a, idx) (dg__dynarr_checkidx((a),(idx)), dg__dynarr_deletefast(dg__dynarr_unp(a), (idx), 1)) |
|
#define | dg_dynarr_deletenfast(a, idx, n) (dg__dynarr_checkidx((a),(idx)), dg__dynarr_deletefast(dg__dynarr_unp(a), idx, n)) |
|
#define | dg_dynarr_clear(a) ((a).md.cnt=0) |
|
#define | dg_dynarr_setcount(a, n) (dg__dynarr_maybegrow(dg__dynarr_unp(a), (n)) ? ((a).md.cnt = (n)) : 0) |
|
#define | dg_dynarr_reserve(a, cap) dg__dynarr_maybegrow(dg__dynarr_unp(a), (cap)) |
|
#define | dg_dynarr_shrink_to_fit(a) dg__dynarr_shrink_to_fit(dg__dynarr_unp(a)) |
|
#define | dg_dynarr_pop(a) |
|
#define | dg_dynarr_last(a) |
|
#define | dg_dynarr_lastptr(a) (((a).md.cnt > 0) ? ((a).p + (a).md.cnt - 1) : NULL) |
|
#define | dg_dynarr_get(a, idx) (dg__dynarr_checkidx((a),(idx)), (a).p[dg__dynarr_idx((a).md, (idx))]) |
|
#define | dg_dynarr_getptr(a, idx) |
|
#define | dg_dynarr_begin(a) ((a).p) |
|
#define | dg_dynarr_end(a) ((a).p + (a).md.cnt) |
|
#define | dg_dynarr_count(a) ((a).md.cnt) |
|
#define | dg_dynarr_capacity(a) ((a).md.cap & DG__DYNARR_SIZE_T_ALL_BUT_MSB) |
|
#define | dg_dynarr_empty(a) ((a).md.cnt == 0) |
|
#define | dg_dynarr_oom(a) ((a).md.cap == 0) |
|
#define | dg_dynarr_sort(a, cmp) qsort((a).p, (a).md.cnt, sizeof((a).p[0]), (cmp)) |
|
#define | dg__dynarr_unp(a) (void**)&(a).p, &(a).md, sizeof((a).p[0]) |
|
#define | DG__DYNARR_WHILE0 while(0) |
|
#define | dg__dynarr_checkidx(a, i) DG_DYNARR_ASSERT((size_t)i < a.md.cnt, "index out of bounds!") |
|
#define | dg__dynarr_checkidxle(a, i) DG_DYNARR_ASSERT((size_t)i <= a.md.cnt, "index out of bounds!") |
|
#define | dg__dynarr_check_notempty(a, msg) DG_DYNARR_ASSERT(a.md.cnt > 0, msg) |
|
#define | dg__dynarr_idx(md, i) (((size_t)(i) < md.cnt) ? (size_t)(i) : 0) |
|