]> git.mdlowis.com Git - projs/libcds.git/commitdiff
Build now working with makefile rather than ruby
authorMike D. Lowis <mike@mdlowis.com>
Mon, 4 Jun 2012 16:04:41 +0000 (12:04 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Mon, 4 Jun 2012 16:04:41 +0000 (12:04 -0400)
Makefile
source/ht/ht.c
tools/UnitTest++/TestUnitTest++.exe [deleted file]

index fe8b5909e5835ff9134701d420fd0df25f15ce1f..2d6fef22eef4bab0fbcd4ea4d1a13ad0a74c5ec2 100644 (file)
--- 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)
+
index c71e672f5f996fe05e72d88ec09e13ba2ba2e9b7..f2fb2bae8f756c206497a6e5cc4431496e43dacb 100644 (file)
 #include <string.h>
 #include <stdio.h>
 
-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 (file)
index f3da1a2..0000000
Binary files a/tools/UnitTest++/TestUnitTest++.exe and /dev/null differ