-#define VECTOR_MAKE(T,N) \
- T* N##_data = NULL; \
- long N##_elements = 0; \
- long N##_allocated = 0; \
- int N##_add(T element) { \
- if (N##_elements == N##_allocated) { \
- if (N##_allocated == 0) { \
- N##_allocated = 12; \
- } else { \
- N##_allocated *= 2; \
- } \
- void *temp = mem_a(N##_allocated * sizeof(T)); \
- if (!temp) { \
- mem_d(temp); \
- return -1; \
- } \
- memcpy(temp, N##_data, (N##_elements * sizeof(T))); \
- mem_d(N##_data); \
- N##_data = (T*)temp; \
- } \
- N##_data[N##_elements] = element; \
- return N##_elements++; \
+/* Builds vector type (usefull for inside structures) */
+#define VECTOR_TYPE(T,N) \
+ T* N##_data = NULL; \
+ long N##_elements = 0; \
+ long N##_allocated = 0
+/* Builds vector add */
+#define VECTOR_CORE(T,N) \
+ int N##_add(T element) { \
+ if (N##_elements == N##_allocated) { \
+ if (N##_allocated == 0) { \
+ N##_allocated = 12; \
+ } else { \
+ N##_allocated *= 2; \
+ } \
+ void *temp = mem_a(N##_allocated * sizeof(T)); \
+ if (!temp) { \
+ mem_d(temp); \
+ return -1; \
+ } \
+ memcpy(temp, N##_data, (N##_elements * sizeof(T))); \
+ mem_d(N##_data); \
+ N##_data = (T*)temp; \
+ } \
+ N##_data[N##_elements] = element; \
+ return N##_elements++; \
+ } \
+ int N##_put(T* elements, size_t len) { \
+ len --; \
+ elements--; \
+ while (N##_add(*++elements) != -1 && len--); \
+ return N##_elements; \