Blender V2.61 - r43446
Defines

BLI_array.h File Reference

Go to the source code of this file.

Defines

#define BLI_array_declare(arr)
#define BLI_array_staticdeclare(arr, maxstatic)
#define BLI_array_totalsize_dyn(arr)
#define BLI_array_totalsize(arr)
#define BLI_array_count(arr)   _##arr##_count
#define _bli_array_grow_items(arr, num)
#define BLI_array_growitems(arr, num)
#define BLI_array_growone(arr)   BLI_array_growitems(arr, 1)
#define BLI_array_append(arr, item)
#define BLI_array_append_r(arr, item)
#define BLI_array_free(arr)
#define BLI_array_pop(arr)
#define BLI_array_empty(arr)   _##arr##_count=0
#define BLI_array_set_length(arr, count)   _##arr##_count = (count)
#define BLI_array_fake_user(arr)
#define BLI_array_fixedstack_declare(arr, maxstatic, realsize, allocstr)
#define BLI_array_fixedstack_free(arr)   if (_##arr##_is_static) MEM_freeN(arr) \

Define Documentation

#define _bli_array_grow_items (   arr,
  num 
)
Value:
(                                    \
    (BLI_array_totalsize(arr) >= _##arr##_count + num) ?                      \
        (_##arr##_count += num) :                                             \
        (                                                                     \
            (void) (_##arr##_tmp = MEM_callocN(                               \
                    sizeof(*arr) * (num < _##arr##_count ?                    \
                                    (_##arr##_count * 2 + 2) :                \
                                    (_##arr##_count + num)),                  \
                    #arr " " __FILE__ ":" STRINGIFY(__LINE__)                 \
                    )                                                         \
                    ),                                                        \
            (void) (arr && memcpy(_##arr##_tmp,                               \
                                  arr,                                        \
                                  sizeof(*arr) * _##arr##_count)              \
                    ),                                                        \
            (void) (arr && ((void *)(arr) != (void*)_##arr##_static ?         \
                    (MEM_freeN(arr), arr) :                                   \
                    arr)                                                      \
                    ),                                                        \
            (void) (arr = _##arr##_tmp                                        \
                    ),                                                        \
            (_##arr##_count += num)                                           \
        )                                                                     \
)

Definition at line 93 of file BLI_array.h.

#define BLI_array_append (   arr,
  item 
)
Value:
(                                        \
    (void) BLI_array_growone(arr),                                            \
    (void) (arr[_##arr##_count - 1] = item)                                   \
)

Definition at line 130 of file BLI_array.h.

#define BLI_array_append_r (   arr,
  item 
)
Value:
(                                      \
    (void) BLI_array_growone(arr),                                            \
    (void) (arr[_##arr##_count - 1] = item),                                  \
    (&arr[_##arr##_count - 1])                                                \
)

Definition at line 137 of file BLI_array.h.

#define BLI_array_count (   arr)    _##arr##_count

Definition at line 87 of file BLI_array.h.

#define BLI_array_declare (   arr)
Value:
int   _##arr##_count = 0;                                                 \
    void *_##arr##_tmp;                                                       \
    void *_##arr##_static = NULL

Definition at line 57 of file BLI_array.h.

#define BLI_array_empty (   arr)    _##arr##_count=0

Definition at line 157 of file BLI_array.h.

#define BLI_array_fake_user (   arr)
Value:
(void)_##arr##_count,                                                     \
    (void)_##arr##_tmp,                                                       \
    (void)_##arr##_static

Definition at line 166 of file BLI_array.h.

#define BLI_array_fixedstack_declare (   arr,
  maxstatic,
  realsize,
  allocstr 
)
Value:
char _##arr##_static[maxstatic*sizeof(*arr)];                             \
    const int _##arr##_is_static= ((void *)_##arr##_static) != (              \
        arr= (realsize <= maxstatic) ?                                        \
            (void *)_##arr##_static :                                         \
            MEM_mallocN(sizeof(*arr)*realsize, allocstr)                      \
        )                                                                     \

Definition at line 175 of file BLI_array.h.

#define BLI_array_fixedstack_free (   arr)    if (_##arr##_is_static) MEM_freeN(arr) \

Definition at line 183 of file BLI_array.h.

#define BLI_array_free (   arr)
Value:
if (arr && (char *)arr != _##arr##_static) {                              \
        BLI_array_fake_user(arr);                                             \
        MEM_freeN(arr);                                                       \
    }

Definition at line 143 of file BLI_array.h.

#define BLI_array_growitems (   arr,
  num 
)
Value:
(                                      \
    ((void *)(arr)==NULL && (void *)(_##arr##_static) != NULL) ?              \
        ((arr= (void*)_##arr##_static), (_##arr##_count += num)) :            \
        _bli_array_grow_items(arr, num)                                       \
)

Definition at line 119 of file BLI_array.h.

#define BLI_array_growone (   arr)    BLI_array_growitems(arr, 1)

Definition at line 126 of file BLI_array.h.

#define BLI_array_pop (   arr)
Value:
(                                                 \
    (arr&&_##arr##_count) ?                                                   \
        arr[--_##arr##_count] :                                               \
        0                                                                     \
)

Definition at line 149 of file BLI_array.h.

#define BLI_array_set_length (   arr,
  count 
)    _##arr##_count = (count)

Definition at line 162 of file BLI_array.h.

#define BLI_array_staticdeclare (   arr,
  maxstatic 
)
Value:
int   _##arr##_count = 0;                                                 \
    void *_##arr##_tmp;                                                       \
    char _##arr##_static[maxstatic*sizeof(arr)]

Definition at line 64 of file BLI_array.h.

#define BLI_array_totalsize (   arr)
Value:
(                                           \
    (size_t)                                                                  \
    (((void *)(arr) == (void *)_##arr##_static && (void *)(arr) != NULL) ?    \
        (sizeof(_##arr##_static) / sizeof(*arr)) :                            \
        BLI_array_totalsize_dyn(arr))                                         \
)

Definition at line 78 of file BLI_array.h.

#define BLI_array_totalsize_dyn (   arr)
Value:
(                                       \
    ((arr)==NULL) ?                                                           \
        0 :                                                                   \
        MEM_allocN_len(arr) / sizeof(*arr)                                    \
)

Definition at line 71 of file BLI_array.h.