extern "C" {
#endif
-/* Static version of custom GSA arrays. It does not support runtime modifications. */
-#define GSA_STATIC_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+/* Constant version of custom GSA arrays. It does not support runtime modifications. */
+#define GSA_CONST_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc, cust_ins_fl) \
\
int \
#define GSA_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc, cust_ins_fl) \
\
-GSA_STATIC_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+GSA_CONST_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc, cust_ins_fl) \
\
int \
}
+/* Static version with limited support of insert and delete functions. */
+#define GSA_STATIC_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc, cust_ins_fl) \
+\
+GSA_CUST_IMP(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc, cust_ins_fl) \
+\
+void \
+cust_prefix##_init_array_field(cust_array_t *array)\
+{\
+ array->cust_array_field.count=0;\
+ array->cust_array_field.alloc_count=0;\
+ array->cust_array_field.items=NULL;\
+}\
+\
+int \
+cust_prefix##_insert_at(cust_array_t *array, cust_item_t *item, unsigned indx)\
+{\
+ unsigned cnt=array->cust_array_field.count; \
+ uloi_ciddes_t **p; \
+\
+ if(indx>cnt) indx=cnt;\
+ if(cnt+1>=array->cust_array_field.alloc_count)\
+ return -1;\
+\
+ p=array->cust_array_field.items+indx;\
+ memmove(p+1,p,(char*)(array->cust_array_field.items+cnt)-(char*)p);\
+ array->cust_array_field.count=cnt+1;\
+ *p=item;\
+ return 0;\
+}\
+\
+int \
+cust_prefix##_delete_at(cust_array_t *array, unsigned indx)\
+{\
+ unsigned cnt=array->cust_array_field.count;\
+ uloi_ciddes_t **p;\
+ if(indx>=cnt) return -1;\
+ p=array->cust_array_field.items+indx;\
+ array->cust_array_field.count=--cnt;\
+ memmove(p,p+1,(array->cust_array_field.items+cnt-p)*sizeof(void *));\
+ return 0;\
+}\
+
+
#ifdef __cplusplus
} /* extern "C"*/
#endif