#include <sys/types.h>
Go to the source code of this file.
|
#define | GEN_ALLOC_typedef(ta, type, field, len, a) |
|
#define | GEN_ALLOC_ready(ta, type, field, len, a, i, n, x, base, ta_ready) |
|
#define | GEN_ALLOC_readyplus(ta, type, field, len, a, i, n, x, base, ta_rplus) |
|
#define | GEN_ALLOC_append(ta, type, field, len, a, i, n, x, base, ta_rplus, ta_append) |
|
◆ GEN_ALLOC_append
#define GEN_ALLOC_append |
( |
| ta, |
|
|
| type, |
|
|
| field, |
|
|
| len, |
|
|
| a, |
|
|
| i, |
|
|
| n, |
|
|
| x, |
|
|
| base, |
|
|
| ta_rplus, |
|
|
| ta_append ) |
Value:int ta_append(ta *x,type *i) \
{ if (!ta_rplus(x,1)) return 0; x->field[x->len++] = *i; return 1; }
Definition at line 70 of file genalloc.h.
◆ GEN_ALLOC_ready
#define GEN_ALLOC_ready |
( |
| ta, |
|
|
| type, |
|
|
| field, |
|
|
| len, |
|
|
| a, |
|
|
| i, |
|
|
| n, |
|
|
| x, |
|
|
| base, |
|
|
| ta_ready ) |
Value:int ta_ready(ta *x,unsigned int n) \
{ unsigned int i; \
if (x->field) { \
i = x->a; \
if (n > i) { \
x->a = base + n + (n >> 3); \
if (
alloc_re((
void **)&x->field,i *
sizeof(type),x->a *
sizeof(type)))
return 1; \
x->a = i; return 0; } \
return 1; } \
x->len = 0; \
return !!(x->field = (type *)
alloc((x->a = n) *
sizeof(type))); }
void * alloc(unsigned int)
int alloc_re(void **, unsigned int, unsigned int)
Definition at line 44 of file genalloc.h.
◆ GEN_ALLOC_readyplus
#define GEN_ALLOC_readyplus |
( |
| ta, |
|
|
| type, |
|
|
| field, |
|
|
| len, |
|
|
| a, |
|
|
| i, |
|
|
| n, |
|
|
| x, |
|
|
| base, |
|
|
| ta_rplus ) |
Value:int ta_rplus(ta *x,unsigned int n) \
{ unsigned int i; \
if (x->field) { \
i = x->a; n += x->len; \
if (n > i) { \
x->a = base + n + (n >> 3); \
if (
alloc_re((
void **)&x->field,i *
sizeof(type),x->a *
sizeof(type)))
return 1; \
x->a = i; return 0; } \
return 1; } \
x->len = 0; \
return !!(x->field = (type *)
alloc((x->a = n) *
sizeof(type))); }
Definition at line 57 of file genalloc.h.
◆ GEN_ALLOC_typedef
#define GEN_ALLOC_typedef |
( |
| ta, |
|
|
| type, |
|
|
| field, |
|
|
| len, |
|
|
| a ) |
Value: typedef struct ta { type *field; unsigned int len; unsigned int a; } ta;
Definition at line 39 of file genalloc.h.