+++ /dev/null
-###############################################################################
-#
-# Name: Opts
-# Type: Library
-# Author: Mike Lowis
-# License: BSD 2-Clause
-#
-###############################################################################
-
-# Utility Function Definitions
-#-----------------------------
-# Function for generating an file list
-flist = $(shell env find $(1) -name *.$(strip $(2)) -print)
-
-# Function for generating an file list
-dlist = $(shell env find $(1) -type d -print)
-
-# Function for generating an include list
-incdirs = $(addprefix -I, $(call dlist, $(1)))
-
-# Function for generating file dependencies
-define make-depend
- $(CXX) $(CXXFLAGS) -M $1 | \
- sed -e 's,\($(notdir $2)\) *:,$(dir $2)\1 $(subst .o,.d,$2): ,' \
- > $(subst .o,.d,$2)
-endef
-
-# Project and Artifact Names
-#---------------------------
-PROJ_NAME = data-structures
-TEST_RUNNER = test_runner
-SHARED_NAME = lib$(PROJ_NAME).lib
-STATIC_NAME = lib$(PROJ_NAME).a
-
-# File and Directory Settings
-#----------------------------
-# Root Directories
-SRC_ROOT = source/
-TESTS_ROOT = tests/
-
-# File Extensions
-SRC_EXT = c
-TEST_EXT = cpp
-
-# Libraries to Link Against
-LIBS =
-TEST_LIBS = $(LIBS) \
- tools/UnitTest++/libUnitTest++.a
-
-# Source File Lists
-SRC_FILES = $(call flist, $(SRC_ROOT), $(SRC_EXT))
-TEST_FILES = $(call flist, $(TESTS_ROOT), $(TEST_EXT))
-
-# Object File Lists
-SRC_OBJS = $(SRC_FILES:%.$(SRC_EXT)=%.o)
-TEST_OBJS = $(TEST_FILES:%.$(TEST_EXT)=%.o)
-
-# Dependecy File Lists
-SRC_DEPS = $(SRC_OBJS:%.o=%.d)
-TEST_DEPS = $(TEST_OBJS:%.o=%.d)
-
-# Include Directories
-INC_DIRS = $(call incdirs, $(SRC_ROOT)) \
- $(call incdirs, tools/UnitTest++/src)
-
-# Compiler and Linker Options
-#----------------------------
-CXXFLAGS = $(INC_DIRS) -Wall -Wextra -fPIC
-TEST_CXXFLAGS = $(INC_DIRS)
-ARFLAGS = rcs
-
-# Build Rules
-#------------
-all: release test
-
-release: $(SHARED_NAME) $(STATIC_NAME)
-
-test: $(TEST_RUNNER)
- @echo Running unit tests...
- @./$(TEST_RUNNER)
-
-foo:
- echo $(SRC_DEPS)
-
-# Binaries
-$(SHARED_NAME): $(SRC_OBJS)
- @echo Linking $@...
- @$(CXX) $(CXXFLAGS) -shared -o $@ $(SRC_OBJS) $(LIBS)
-
-$(STATIC_NAME): $(SRC_OBJS)
- @echo Linking $@...
- @$(AR) $(ARFLAGS) -o $@ $(SRC_OBJS) $(LIBS)
-
-$(TEST_RUNNER): unit_test_pp $(SRC_OBJS) $(TEST_OBJS)
- @echo Linking $@...
- @$(CXX) $(TEST_CXXFLAGS) -o $@ $(SRC_OBJS) $(TEST_OBJS) $(TEST_LIBS)
-
-# Libraries
-unit_test_pp:
- @$(MAKE) -C tools/UnitTest++
-
-# Object Files
-$(SRC_OBJS): %.o : %.$(SRC_EXT)
- @echo $<
- @$(call make-depend,$<,$@)
- @$(CXX) -c $(CXXFLAGS) -o $@ $<
-
-$(TEST_OBJS): %.o : %.$(TEST_EXT)
- @echo $<
- @$(call make-depend,$<,$@)
- @$(CXX) -c $(TEST_CXXFLAGS) -o $@ $<
-
-# Cleanup
-clean:
- @$(MAKE) -C tools/UnitTest++ clean
- @$(RM) $(SRC_OBJS)
- @$(RM) $(TEST_OBJS)
- @$(RM) $(SRC_DEPS)
- @$(RM) $(TEST_DEPS)
- @$(RM) $(SHARED_NAME)
- @$(RM) $(STATIC_NAME)
- @$(RM) $(TEST_RUNNER)*
-
--include $(SRC_DEPS)
--include $(TEST_DEPS)
-
--- /dev/null
+-------------------------------------------------------------------------------
+-- Jersey Build Configuration
+-------------------------------------------------------------------------------
+solution "C Data Structures"
+configurations { "Release" }
+targetdir "build"
+
+-------------------------------------------------------------------------------
+-- CDS - A library of common data structures written in C
+-------------------------------------------------------------------------------
+project "cds"
+ kind "SharedLib"
+ language "C"
+ location "build"
+ files { "source/**.*" }
+
+project "test"
+ kind "ConsoleApp"
+ language "C++"
+ location "build"
+ includedirs { "source/**", "tools/UnitTest++/**" }
+ links { "cds", "UnitTest++" }
+ files { "tests/**.*" }
+
+-------------------------------------------------------------------------------
+-- UnitTest++ - A C++ unit testing library
+-------------------------------------------------------------------------------
+project "UnitTest++"
+ kind "SharedLib"
+ language "C++"
+ location "build"
+ files {
+ "tools/UnitTest++/src/*.*",
+ }
+ if os.is "windows" then
+ files { "tools/UnitTest++/src/Win32/**.*" }
+ else
+ files { "tools/UnitTest++/src/Posix/**.*" }
+ end
+
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2012, Michael D. Lowis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2012, Michael D. Lowis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2012, Michael D. Lowis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-#include "bt.h"
-
-bt_tree* bt_new(bt_compare_func compare)
-{
-
-}
-
-void bt_free(bt_tree* tree, int free_contents)
-{
-
-}
-
-int bt_compare_ptr(void* obj1, void* obj2)
-{
-
-}
-
-void bt_insert(bt_tree* tree, void* data)
-{
-
-}
-
-void bt_delete(bt_tree* tree, void* data)
-{
-
-}
-
-void* bt_find(bt_tree* tree, void* data)
-{
-
-}
-
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2012, Michael D. Lowis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-#ifndef BT_H
-#define BT_H
-
-//! A function pointer for a comparison function.
-typedef int (* bt_compare_func) (void*,void*);
-
-//! A binary tree node.
-typedef struct bt_node
-{
- //! The contents of the tree node.
- void* contents;
- //! The left child of the tree node.
- struct bt_node* left;
- //! the right child of the tree node.
- struct bt_node* right;
-} bt_node;
-
-//! A binary tree
-typedef struct bt_tree
-{
- //! The root of the binary tree
- bt_node* root;
- //! The function used to compare data
- bt_compare_func compare;
-} bt_tree;
-
-/**
- * @brief Creates a new empty binary tree.
- *
- * This function creates a new empty binary search tree with the given
- * comparison function. The comparison function will be used during searching,
- * insertions, and deletions, to find and traverse the tree.
- *
- * @param compare The function to use for comparing items in the tree.
- *
- * @return Pointer to the newly created tree.
- **/
-bt_tree* bt_new(bt_compare_func compare);
-
-/**
- * @brief Frees the memory allocated for all nodes of a tree.
- *
- * This function frees all memory associated with the given tree. If
- * free_contents has a non-zero value then the contents pointer of each node
- * will aslo be freed.
- *
- * @param tree The tree to be freed.
- * @param free_contents Determines whether the contents pointers will be freed.
- **/
-void bt_free(bt_tree* tree, int free_contents);
-
-/**
- * @brief Compares the value of two pointers.
- *
- * This function takes two pointers and compares their values returning an
- * integral value representing the result of the comparison. A return value of
- * zero indicates the pointers are equal. A positive value indicates that obj2
- * is greater than obj1 and a negative value indicates the opposite.
- *
- * @param obj1 The first object to be compared.
- * @param obj2 The second object to be compared.
- *
- * @return The result of the comparison.
- **/
-int bt_compare_ptr(void* obj1, void* obj2);
-
-/**
- * @brief Inserts a new node into the tree.
- *
- * This function uses the tree's compare function to traverse the tree until an
- * existing node with the given data is found or until a leaf node is reached.
- * If a node exists containing the given data then no insertion is performed.
- * If a leaf node is reached then the a new leaf node is created and set as the
- * left or right child of that leaf node.
- *
- * @param tree The tree in which the node will be inserted.
- * @param data The data that the new node will contain.
- **/
-void bt_insert(bt_tree* tree, void* data);
-
-/**
- * @brief Deletes a node for the tree.
- *
- * This function uses the tree's compare function to search the tree for a node
- * containing the given data. If a node containing the data is found then the
- * node is freed otherwise no deletion is performed. If free_contents is passed
- * a non-zero value then the contents pointer of the node is also freed.
- *
- * @param tree The tree from which the node will be deleted.
- * @param data The data to search for in the tree.
- * @param free_contents Determines whether the contents pointer will be freed.
- **/
-void bt_delete(bt_tree* tree, void* data, int free_contents);
-
-/**
- * @brief Finds and returns the data from a node containing the given data.
- *
- * This function uses the tree's compare function to search the tree for a node
- * containing the given data. If a node containing the given data is found then
- * the pointer to the contents of the node is returned. Otherwise a null
- * pointer is returned.
- *
- * @param tree The tree to be searched.
- * @param data The data to be searched for.
- *
- * @return Pointer to the found data.
- **/
-void* bt_find(bt_tree* tree, void* data);
-
-#endif
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2012, Michael D. Lowis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2012, Michael D. Lowis
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *****************************************************************************/
-
+++ /dev/null
-// Unit Test Framework Includes
-#include "UnitTest++.h"
-
-// File To Test
-#include "avl.h"
-
-using namespace UnitTest;
-
-//-----------------------------------------------------------------------------
-// Begin Unit Tests
-//-----------------------------------------------------------------------------
-namespace {
- //-------------------------------------------------------------------------
- // Test XXX Function
- //-------------------------------------------------------------------------
- TEST(Verify_XXX)
- {
- }
-}
+++ /dev/null
-// Unit Test Framework Includes
-#include "UnitTest++.h"
-
-// File To Test
-#include "bt.h"
-
-using namespace UnitTest;
-
-//-----------------------------------------------------------------------------
-// Begin Unit Tests
-//-----------------------------------------------------------------------------
-namespace {
- //-------------------------------------------------------------------------
- // Test XXX Function
- //-------------------------------------------------------------------------
- TEST(Verify_XXX)
- {
- }
-}