Mercurial > hg > xemacs-beta
comparison src/dynarr.h @ 183:e121b013d1f0 r20-3b18
Import from CVS: tag r20-3b18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:54:23 +0200 |
parents | 376386a54a3c |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
182:f07455f06202 | 183:e121b013d1f0 |
---|---|
23 /* Written by Ben Wing, December 1993. */ | 23 /* Written by Ben Wing, December 1993. */ |
24 | 24 |
25 #ifndef _XEMACS_DYNARR_H_ | 25 #ifndef _XEMACS_DYNARR_H_ |
26 #define _XEMACS_DYNARR_H_ | 26 #define _XEMACS_DYNARR_H_ |
27 | 27 |
28 #define Dynarr_declare(type) \ | 28 #define Dynarr_declare(type) \ |
29 type *base; \ | 29 type *base; \ |
30 int elsize; \ | 30 int elsize; \ |
31 int cur; \ | 31 int cur; \ |
32 int largest; \ | 32 int largest; \ |
33 int max | 33 int max |
34 | 34 |
35 typedef struct dynarr | 35 typedef struct dynarr |
36 { | 36 { |
37 Dynarr_declare (void); | 37 Dynarr_declare (void); |
48 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) | 48 #define Dynarr_atp(d, pos) (&Dynarr_at (d, pos)) |
49 #define Dynarr_length(d) ((d)->cur) | 49 #define Dynarr_length(d) ((d)->cur) |
50 #define Dynarr_largest(d) ((d)->largest) | 50 #define Dynarr_largest(d) ((d)->largest) |
51 #define Dynarr_reset(d) ((d)->cur = 0) | 51 #define Dynarr_reset(d) ((d)->cur = 0) |
52 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur) | 52 #define Dynarr_add_many(d, el, len) Dynarr_insert_many (d, el, len, (d)->cur) |
53 #define Dynarr_insert_many_at_start(d, el, len) \ | 53 #define Dynarr_insert_many_at_start(d, el, len) \ |
54 Dynarr_insert_many (d, el, len, 0) | 54 Dynarr_insert_many (d, el, len, 0) |
55 | 55 |
56 #define Dynarr_add(d, el) ( \ | 56 #define Dynarr_add(d, el) ( \ |
57 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \ | 57 (d)->cur >= (d)->max ? Dynarr_resize ((d), (d)->cur+1) : (void) 0, \ |
58 ((d)->base)[(d)->cur++] = (el), \ | 58 ((d)->base)[(d)->cur++] = (el), \ |