43 #include <string.h> |
43 #include <string.h> |
44 #include "common.h" |
44 #include "common.h" |
45 |
45 |
46 #define ITERATE_SUBSCRIPTS(link) \ |
46 #define ITERATE_SUBSCRIPTS(link) \ |
47 for (link = data; link; link = link->next) |
47 for (link = data; link; link = link->next) |
|
48 |
|
49 #define foreach_counter(NAME) \ |
|
50 (int)(reinterpret_cast<int> (foreach_counter##NAME) / sizeof (foreach_counter##NAME)) |
|
51 #define foreach(T,NAME,ARRAY) \ |
|
52 if (ARRAY.size() > 0) for (T NAME = ARRAY[0], *foreach_counter##NAME = 0; \ |
|
53 foreach_counter(NAME) < (int)(ARRAY.size()); \ |
|
54 NAME = ARRAY[reinterpret_cast<int> (++foreach_counter##NAME) / sizeof (foreach_counter##NAME)]) |
48 |
55 |
49 // Single element of an array |
56 // Single element of an array |
50 template <class T> class arrayElement { |
57 template <class T> class arrayElement { |
51 public: |
58 public: |
52 T value; |
59 T value; |