From: Mike D. Lowis Date: Mon, 4 Jun 2012 16:04:41 +0000 (-0400) Subject: Build now working with makefile rather than ruby X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=58a518f83b729f981798701d5366b4c9c9838bf5;p=projs%2Flibcds.git Build now working with makefile rather than ruby --- diff --git a/Makefile b/Makefile index fe8b590..2d6fef2 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ endef # Project and Artifact Names #--------------------------- -PROJ_NAME = opts +PROJ_NAME = data-structures TEST_RUNNER = test_runner SHARED_NAME = lib$(PROJ_NAME).lib STATIC_NAME = lib$(PROJ_NAME).a @@ -115,3 +115,6 @@ clean: @$(RM) $(STATIC_NAME) @$(RM) $(TEST_RUNNER)* +-include $(SRC_DEPS) +-include $(TEST_DEPS) + diff --git a/source/ht/ht.c b/source/ht/ht.c index c71e672..f2fb2ba 100644 --- a/source/ht/ht.c +++ b/source/ht/ht.c @@ -29,106 +29,106 @@ #include #include -unsigned int ht_hash_string(void* key) -{ - char* key_str = (char*)key; - unsigned int hash = 0; - int i = 0; - for (i = 0; key_str[i] != '\0'; i++) - { - hash += key_str[i]; - } - return hash; -} - -ht_table* ht_new(unsigned int size, ht_hash_func fn) -{ - unsigned int table_size = size * sizeof(ht_node*); - ht_table* table = (ht_table*) malloc( sizeof(ht_table) ); - table->size = size; - table->table = (ht_node**) malloc( table_size ); - table->hash_func = (fn != NULL) ? fn : ht_hash_string; - memset(table->table, 0, table_size); - return table; -} - -void ht_free(ht_table* table, int free_key, int free_value) -{ - int i = 0; - for (i = 0; i < table->size; i++) - { - ht_node* cur = table->table[i]; - while (cur != NULL) - { - printf("Index: %d\tKey: %s\tVal: %#x\tNext: %#x\n", i, cur->key, (int)cur->val, (int)cur->next); - ht_node* next = cur->next; - free( cur->key ); - free( cur->val ); - free( cur ); - cur = next; - } - } -} - -void ht_put(ht_table* table, void* key, void* val) -{ - unsigned int index = table->hash_func( key ) % table->size; - ht_node* cur = table->table[index]; - ht_node* last = cur; - - while (cur != NULL) - { - if ( !strcmp( key, cur->key ) ) - { - cur->val = val; - break; - } - last = cur; - cur = cur->next; - } - - if (cur == NULL) - { - ht_node* node = (ht_node*) malloc( sizeof(ht_node) ); - node->key = (char*) strdup( key ); - node->val = val; - node->next = NULL; - - if (last != NULL) - { - last->next = node; - } - else - { - table->table[ index ] = node; - } - } -} - -void* ht_get(ht_table* table, void* key) -{ - void* ret = NULL; - unsigned int index= table->hash_func( key ) % table->size; - ht_node* node = table->table[ index ]; - while ( node != NULL ) - { - if ( !strcmp( key, node->key ) ) - { - ret = node->val; - break; - } - node = node->next; - } - return ret; -} - -void ht_delete(ht_table* table, void* key, int free_key, int free_value) -{ - return 0; -} - -ht_table* ht_resize(ht_table* table, unsigned int size) -{ - return 0; -} +//unsigned int ht_hash_string(void* key) +//{ +// char* key_str = (char*)key; +// unsigned int hash = 0; +// int i = 0; +// for (i = 0; key_str[i] != '\0'; i++) +// { +// hash += key_str[i]; +// } +// return hash; +//} +// +//ht_table* ht_new(unsigned int size, ht_hash_func fn) +//{ +// unsigned int table_size = size * sizeof(ht_node*); +// ht_table* table = (ht_table*) malloc( sizeof(ht_table) ); +// table->size = size; +// table->table = (ht_node**) malloc( table_size ); +// table->hash_func = (fn != NULL) ? fn : ht_hash_string; +// memset(table->table, 0, table_size); +// return table; +//} +// +//void ht_free(ht_table* table, int free_key, int free_value) +//{ +// int i = 0; +// for (i = 0; i < table->size; i++) +// { +// ht_node* cur = table->table[i]; +// while (cur != NULL) +// { +// printf("Index: %d\tKey: %s\tVal: %#x\tNext: %#x\n", i, cur->key, (int)cur->val, (int)cur->next); +// ht_node* next = cur->next; +// free( cur->key ); +// free( cur->val ); +// free( cur ); +// cur = next; +// } +// } +//} +// +//void ht_put(ht_table* table, void* key, void* val) +//{ +// unsigned int index = table->hash_func( key ) % table->size; +// ht_node* cur = table->table[index]; +// ht_node* last = cur; +// +// while (cur != NULL) +// { +// if ( !strcmp( key, cur->key ) ) +// { +// cur->val = val; +// break; +// } +// last = cur; +// cur = cur->next; +// } +// +// if (cur == NULL) +// { +// ht_node* node = (ht_node*) malloc( sizeof(ht_node) ); +// node->key = (char*) strdup( key ); +// node->val = val; +// node->next = NULL; +// +// if (last != NULL) +// { +// last->next = node; +// } +// else +// { +// table->table[ index ] = node; +// } +// } +//} +// +//void* ht_get(ht_table* table, void* key) +//{ +// void* ret = NULL; +// unsigned int index= table->hash_func( key ) % table->size; +// ht_node* node = table->table[ index ]; +// while ( node != NULL ) +// { +// if ( !strcmp( key, node->key ) ) +// { +// ret = node->val; +// break; +// } +// node = node->next; +// } +// return ret; +//} +// +//void ht_delete(ht_table* table, void* key, int free_key, int free_value) +//{ +// return 0; +//} +// +//ht_table* ht_resize(ht_table* table, unsigned int size) +//{ +// return 0; +//} diff --git a/tools/UnitTest++/TestUnitTest++.exe b/tools/UnitTest++/TestUnitTest++.exe deleted file mode 100644 index f3da1a2..0000000 Binary files a/tools/UnitTest++/TestUnitTest++.exe and /dev/null differ