--- /dev/null
+*.o
+/src/obj/*.so
+/test/test
+/doc/html/
+/doc/latex/
+++ /dev/null
-#Document updated on 2014-12-09.
-################################
-
-#Active developers.
-
-Years | Name | Contact email
----------|--------------------|--------------------------
-2013-now | Benjamin Auder | benjamin.a@mailoo.org
-
-#Past code contributors.
-
-Years | Name
-----------|--------------------
+++ /dev/null
-To build on (hopefully) any GNU/Linux [brackets means "optional"] :
-
- make [src]
- [make test]
- make install
-
-To (un)install the library :
-
- make (un)install
-Expat License (often called "MIT license")
+ISC license https://opensource.org/licenses/ISC
-Copyright (c) 2013-2014 Benjamin Auder
+Copyright (C) 2013-2018 Benjamin Auder
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
LIBRARY = libcgds.so
INSTALL_PREFIX = /usr/local
+all: src
+
src:
cd src && $(MAKE) && cd ..
test:
- cd test && $(MAKE) && cd ..
+ cd test && ./makeMain.sh && $(MAKE) && cd ..
doc:
cd doc && $(MAKE) && cd ..
Various data structures, from stack to tree, which can contain any data type.
+## Installation
+
+ make [src]
+ make install
+'src' is Makefile default target.
+
## Example
Vector* v = vector_new(int);
-src
\ No newline at end of file
+src/
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/bash
-
-subfolder=$1
-
-cd $subfolder
-cat Makefile.base > Makefile
-printf "\n" >> Makefile
-for folder in `find . -path ./obj -prune -o -type d -print`; do
- mkdir -p obj/$folder
-done
-
-sources=`find . -type f -name \*.c`
-objects=""
-for file in $sources; do
- objects+="obj/${file%?}o "
-done
-printf "obj/\$(TARGET): $objects\n" >> Makefile
-printf '\t$(CC) $(LDFLAGS) -o $@ $^\n\n' >> Makefile
-
-for file in $sources; do
- deps=`grep '#include "' $file | cut -d ' ' -f 2 | sed 's/^"\(.*\)"$/..\/\1/g' | tr '\n' ' '`
- fileDotO="obj/${file%?}o"
- printf "$fileDotO: $file $deps\n" >> Makefile
- printf '\t$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<\n\n' >> Makefile
-done
-
-cd ..
+++ /dev/null
-obj/
-Makefile
--- /dev/null
+CC = gcc
+CFLAGS = -g -std=gnu99 -fPIC
+LDFLAGS = -shared
+INCLUDES = -I..
+
+SRC_DIR = ./
+OBJ_DIR = ./obj
+
+TARGET = $(OBJ_DIR)/libcgds.so
+
+SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
+H_FILES = $(wildcard $(SRC_DIR)/*.h)
+OBJ_FILES = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES))
+
+all: $(TARGET)
+
+$(TARGET): $(OBJ_FILES)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/%.h
+ $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<
+
+clean:
+ rm -f $(OBJ_DIR)/*.o $(TARGET)
+
+.PHONY: all clean
+++ /dev/null
-CC = gcc
-CFLAGS = -g -std=gnu99 -fPIC
-LDFLAGS = -shared
-INCLUDES = -I..
-TARGET = libcgds.so
-
-all: obj/$(TARGET)
-
-clean:
- rm -f obj/*.o
- rm -f obj/$(TARGET)
-
-.PHONY: all clean
+++ /dev/null
-obj/
-Makefile
--- /dev/null
+CC = gcc
+CFLAGS = -g -std=gnu99 -Wno-implicit-function-declaration
+LDFLAGS = -L../src/obj -lcgds -Wl,-rpath=../src/obj
+INCLUDES = -I..
+
+SRC_DIR = ./
+OBJ_DIR = ./obj
+
+TARGET = test
+
+SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
+H_FILES = lut.h helpers.h
+OBJ_FILES = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES))
+
+all: $(TARGET)
+
+$(TARGET): $(OBJ_FILES)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(H_FILES)
+ $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<
+
+clean:
+ rm -f $(OBJ_DIR)/*.o $(TARGET)
+
+.PHONY: all clean
+++ /dev/null
-CC = gcc
-CFLAGS = -g -std=gnu99 -Wno-implicit-function-declaration
-LDFLAGS = -L../src/obj -lcgds
-INCLUDES = -I.. -I../src
-TARGET = testcgds
-
-all: obj/$(TARGET)
-
-clean:
- rm -f obj/*.o
- rm -f obj/$(TARGET)
-
-.PHONY: all clean
--- /dev/null
+Testing procedure (assuming src/Makefile already run):
+ 1) ./makeMain.sh
+ 2) make
+ 3) ./test
int main(int argc, char** argv)
{
- //file ./t.Vector.c :
- t_vector_clear();
- t_vector_size();
- t_vector_push_pop_basic();
- t_vector_push_pop_evolved();
- t_vector_copy();
+ //file ./t.Stack.c :
+ t_stack_clear();
+ t_stack_size();
+ t_stack_push_pop_basic();
+ t_stack_push_pop_evolved();
+ t_stack_copy();
- //file ./t.BufferTop.c :
- t_buffertop_clear();
- t_buffertop_size();
- t_buffertop_push_pop_basic();
- t_buffertop_push_pop_evolved();
- t_buffertop_copy();
+ //file ./t.List.c :
+ t_list_clear();
+ t_list_size();
+ t_list_push_pop_basic();
+ t_list_push_pop_evolved();
+ t_list_copy();
//file ./t.Tree.c :
t_tree_clear();
t_tree_iterate();
t_tree_copy();
- //file ./t.Heap.c :
- t_heap_clear();
- t_heap_size();
- t_heap_push_pop_basic();
- t_heap_push_pop_evolved();
- t_heap_copy();
-
- //file ./t.List.c :
- t_list_clear();
- t_list_size();
- t_list_push_pop_basic();
- t_list_push_pop_evolved();
- t_list_copy();
+ //file ./t.Vector.c :
+ t_vector_clear();
+ t_vector_size();
+ t_vector_push_pop_basic();
+ t_vector_push_pop_evolved();
+ t_vector_copy();
//file ./t.Queue.c :
t_queue_clear();
t_queue_push_pop_evolved();
t_queue_copy();
- //file ./t.Stack.c :
- t_stack_clear();
- t_stack_size();
- t_stack_push_pop_basic();
- t_stack_push_pop_evolved();
- t_stack_copy();
+ //file ./t.Heap.c :
+ t_heap_clear();
+ t_heap_size();
+ t_heap_push_pop_basic();
+ t_heap_push_pop_evolved();
+ t_heap_copy();
+
+ //file ./t.BufferTop.c :
+ t_buffertop_clear();
+ t_buffertop_size();
+ t_buffertop_push_pop_basic();
+ t_buffertop_push_pop_evolved();
+ t_buffertop_copy();
//file ./t.PriorityQueue.c :
t_priorityqueue_clear();
#include <stdlib.h>
#include "cgds/BufferTop.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_buffertop_clear()
{
#include <stdlib.h>
#include "cgds/Heap.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_heap_clear()
{
#include <stdlib.h>
#include "cgds/List.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_list_clear()
{
#include <stdlib.h>
#include "cgds/PriorityQueue.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_priorityqueue_clear()
{
#include <stdlib.h>
#include "cgds/Queue.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_queue_clear()
{
#include <stdlib.h>
#include "cgds/Stack.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_stack_clear()
{
#include <stdlib.h>
#include "cgds/Tree.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_tree_clear()
{
#include <stdlib.h>
#include "cgds/Vector.h"
-#include "test/helpers.h"
-#include "test/lut.h"
+#include "helpers.h"
+#include "lut.h"
void t_vector_clear()
{