<commit_before>#ifndef LIST_H
#define LIST_H
#include <stdlib.h>
typedef enum {false,true} bool;
typedef struct handle{
    size_t item_index;
    bool alive;
}handle;


#define LIST_ITEM(type) item_of_##type

#define LIST(type) list_of_##type

#define LIST_CREATE(type,init_cap) list_of_##type##_create(init_cap)

#define LIST_DESTROY(type,list) list_of_##type##_destroy(list)

#define LIST_REALLOC_ITEMS(type,list) list_of_##type##_reallocate_items(list)

#define LIST_REALLOC_HANDLES(type,list) list_of_##type##_reallocate_handles(list)

#define LIST_ADD(type,list,data) list_of_##type##_add(list,data)

#define LIST_GET(type,list,handle_index) list_of_##type##_get(list,handle_index)

#define LIST_DELETE(type,list,handle_index) list_of_##type##_delete(list,handle_index)

#define LIST_DEC(type)\
typedef struct LIST_ITEM(type){\
    type data;\
    size_t handle_index;\
}LIST_ITEM(type);\
typedef struct LIST(type){\
    LIST_ITEM(type)* items;\
    size_t item_capacity;\
    size_t item_size;\
    handle* handles;\
    size_t handle_capacity;\
    size_t handle_size;\
}LIST(type);\
LIST(type) list_of_##type##_create(size_t init_cap);\
void list_of_##type##_destroy(LIST(type)* list);\
void list_of_##type##_reallocate_items(LIST(type)* list);\
void list_of_##type##_reallocate_handles(LIST(type)* list);\
size_t list_of_##type##_add(LIST(type)* list,type data);\
type* list_of_##type##_get(LIST(type)* list,size_t handle_index);\
bool list_of_##type##_delete(LIST(type)* list,size_t handle_index);\<commit_msg>added a vector data type<commit_after>#ifndef LIST_H
#define LIST_H
#include <stdlib.h>
typedef enum {false,true} bool;
typedef struct handle{
    size_t item_index;
    bool alive;
}handle;

#define ARRAY(type) array_of_##type

#define ARRAY_CREATE(type,init_cap) array_of_##type##_create(init_cap)

#define ARRAY_DESTROY(type,array) array_of_##type##_destroy(array)

#define ARRAY_ADD(type,array,data) array_of_##type##_add(array,data)

#define ARRAY_EXPAND(type,array,amount) array_of_##type##_expand(array,amount)

#define ARRAY_DEC(type)\
typedef struct ARRAY(type){\
    type* array;\
    size_t size;\
    size_t capacity;\
}ARRAY(type);\
ARRAY(type) array_of_##type##_create(size_t init_cap);\
void array_of_##type##_destroy(array_of_##type* array);\
size_t array_of_##type##_add(array_of_##type* array,type data);\
void array_of_##type##_expand(array_of_##type* array,size_t amount);\

#define ARRAY_DEF(type)\
ARRAY(type) array_of_##type##_create(size_t init_cap){\
    ARRAY(type) output = {malloc(sizeof(type) * init_cap),0,init_cap};\
    return output;\
}\
void array_of_##type##_destroy(array_of_##type* array){\
    free(array->array);\
}\
size_t array_of_##type##_add(array_of_##type* array,type data);\
    if(array->size >= array->capacity){\
        ARRAY_EXPAND(array,array->capacity*2)\
    }\
    array->array[array->size++] = data\
    return array->size--;\
}\
void array_of_##type##_expand(array_of_##type* array,size_t amount){\
    type* tmp_array = realloc(array->array,sizeof(type)* amount);\
    array->array  = tmp_array;\
}\




#define LIST_ITEM(type) item_of_##type

#define LIST(type) list_of_##type

#define LIST_CREATE(type,init_cap) list_of_##type##_create(init_cap)

#define LIST_DESTROY(type,list) list_of_##type##_destroy(list)

#define LIST_REALLOC_ITEMS(type,list) list_of_##type##_reallocate_items(list)

#define LIST_REALLOC_HANDLES(type,list) list_of_##type##_reallocate_handles(list)

#define LIST_ADD(type,list,data) list_of_##type##_add(list,data)

#define LIST_GET(type,list,handle_index) list_of_##type##_get(list,handle_index)

#define LIST_DELETE(type,list,handle_index) list_of_##type##_delete(list,handle_index)


#define LIST_DEC(type)\
typedef struct LIST_ITEM(type){\
    type data;\
    size_t handle_index;\
}LIST_ITEM(type);\
typedef struct LIST(type){\
    LIST_ITEM(type)* items;\
    size_t item_capacity;\
    size_t item_size;\
    handle* handles;\
    size_t handle_capacity;\
    size_t handle_size;\
}LIST(type);\
LIST(type) list_of_##type##_create(size_t init_cap);\
void list_of_##type##_destroy(LIST(type)* list);\
void list_of_##type##_reallocate_items(LIST(type)* list);\
void list_of_##type##_reallocate_handles(LIST(type)* list);\
size_t list_of_##type##_add(LIST(type)* list,type data);\
type* list_of_##type##_get(LIST(type)* list,size_t handle_index);\
bool list_of_##type##_delete(LIST(type)* list,size_t handle_index);\
{'fraction_non_alphanumeric': 0.15758534931042278, 'fraction_numerical': 0.0004521817770743839, 'mean_word_length': 7.315789473684211, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6895879', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1662, 'n_words': 270}