4 typedef entity ArrayList;
8 #define AL_NEW(this, n, default, T) \
11 ArrayList _al = this = new(ArrayList); \
13 _al.al_buf = buf_create(); \
14 for (int i = 0, _n = _al.al_len = n; i < _n; ++i) \
16 const _AL_type__##T() it = default; \
17 AL_set##T(this, i, it); \
21 #define AL_DELETE(this) \
24 buf_del(this.al_buf); \
29 #define _AL_type__s() string
30 #define AL_gets(this, idx) bufstr_get(this.al_buf, idx)
31 #define AL_sets(this, idx, val) bufstr_set(this.al_buf, idx, val)
34 string al_ftos(float f) = #26;
35 float al_stof(string s) = #81;
37 string al_ftos(float f) = #26;
38 float al_stof(string s) = #81;
40 string al_ftos(float f) = #17;
41 float al_stof(string s) = #21;
44 #define _AL_type__f() float
45 #define AL_getf(this, idx) al_stof(AL_gets(this, idx))
46 #define AL_setf(this, idx, val) AL_sets(this, idx, al_ftos(val))
49 int al_etof(entity e) = #512;
50 entity al_ftoe(int i) = #459;
52 int al_etof(entity e) = #512;
53 entity al_ftoe(int i) = #459;
55 int al_etof(entity e) = #79;
56 entity al_ftoe(int i) = #80;
59 #define _AL_type__e() entity
60 #define AL_gete(this, idx) al_ftoe(AL_getf(this, idx))
61 #define AL_sete(this, idx, val) AL_setf(this, idx, al_etof(val))
63 #define AL_EACH(this, T, cond, body) \
66 const noref ArrayList _al = this; \
67 for (int i = 0, n = _al.al_len; i < n; ++i) \
69 const noref _AL_type__##T() it = AL_get##T(_al, i); \