diff --git a/CellElemFunc.c b/CellElemFunc.c deleted file mode 100644 index 39105d0..0000000 --- a/CellElemFunc.c +++ /dev/null @@ -1,138 +0,0 @@ -/*** ---- CellElemFunc --- ----Created by : Naej Doree --- -***/ - -#include -#include -#include - -int main(int argc, char **argv){ - cellElement * tree = NULL; - tree = CreateCellElem(); - tree->colIndex = 1; - AddNextRow(tree); - tree->nextRow->colIndex = 2; - AddNextCol(tree); - tree->nextCol->colIndex = 3; - recursivePrint(tree); - removeNextRow(tree); - removeNextCol(tree); - - recursivePrint(tree); - - - return 0; - -} - -cellElement * CreateCellElem(){ - cellElement * elem = NULL; - elem = (cellElement*) malloc(sizeof(cellElement)); - - if (elem == NULL){ - return NULL; - } - - printf("---Created cellElement---\n"); - - elem->value = true; - elem->nextCol = NULL; - elem->nextRow = NULL; - - - return elem; -} - -void freeCellElem(cellElement * elem){ - free(elem); - elem = NULL; -} - -int AddNextCol(cellElement* tree){ - - cellElement * elem = NULL; - elem = (cellElement*) malloc(sizeof(cellElement)); - - if (elem == NULL){ - return -1; - } - - printf("---insertNextCol---\n"); - - elem->value = true; - elem->nextCol = NULL; - elem->nextRow = NULL; - - if (tree->nextCol == NULL){ - tree->nextCol = elem; - }else{ - return -2; - } - - return 1; -} - - -int AddNextRow(cellElement* tree){ - - cellElement * elem = NULL; - elem = (cellElement*) malloc(sizeof(cellElement)); - - if (elem == NULL){ - return -1; - } - - printf("---insertNextRow---\n"); - - elem->value = true; - elem->nextRow = NULL; - elem->nextRow = NULL; - if (tree->nextRow == NULL){ - tree->nextRow = elem; - }else{ - return -2; - } - return 1; -} - -void removeNextCol(cellElement* tree){ - printf("---removeNextCol---\n"); - - if (tree->nextCol != NULL){ - cellElement * elem = tree->nextCol; - free(elem); - elem = NULL; - tree->nextCol = NULL; - - } - -} - -void removeNextRow(cellElement* tree){ - printf("---removeNextRow---\n"); - - if (tree->nextRow != NULL){ - cellElement* elem = tree->nextRow; - free(elem); - elem =NULL; - tree->nextRow = NULL; - - } - -} -void recursivePrint(cellElement * tree){ - if (tree != NULL){ - printf("Elem : x: %d y: %d \n",tree->colIndex,tree->rowIndex); - if (tree->nextCol != NULL){ - recursivePrint(tree->nextCol); - } - if (tree->nextRow != NULL){ - recursivePrint(tree->nextRow); - } - if (tree->nextCol == NULL && tree->nextCol == NULL){ - printf("leaf\n"); - } - - } -} \ No newline at end of file diff --git a/CellElemFunc.o b/CellElemFunc.o deleted file mode 100644 index 96608af..0000000 Binary files a/CellElemFunc.o and /dev/null differ diff --git a/Exe b/Exe deleted file mode 100755 index c2c0af9..0000000 Binary files a/Exe and /dev/null differ diff --git a/LibList/CellElement.c b/LibList/CellElement.c index 7e90729..a9ce164 100644 --- a/LibList/CellElement.c +++ b/LibList/CellElement.c @@ -1,14 +1,124 @@ -/* -* @Author: klmp200 -* @Date: 2016-12-10 01:32:50 -* @Last Modified by: klmp200 -* @Last Modified time: 2016-12-10 04:29:48 -*/ +/*** +--- CellElemFunc --- +---Created by : Naej Doree --- +***/ #include #include #include + +cellElement * CreateCellElem(){ + cellElement * elem = NULL; + elem = (cellElement*) malloc(sizeof(cellElement)); + + if (elem == NULL){ + return NULL; + } + + printf("---Created cellElement---\n"); + + elem->value = true; + elem->nextCol = NULL; + elem->nextRow = NULL; + + + return elem; +} + +void freeCellElem(cellElement * elem){ + free(elem); + elem = NULL; +} + +int AddNextCol(cellElement* tree){ + + cellElement * elem = NULL; + elem = (cellElement*) malloc(sizeof(cellElement)); + + if (elem == NULL){ + return -1; + } + + printf("---insertNextCol---\n"); + + elem->value = true; + elem->nextCol = NULL; + elem->nextRow = NULL; + + if (tree->nextCol == NULL){ + tree->nextCol = elem; + }else{ + return -2; + } + + return 1; +} + + +int AddNextRow(cellElement* tree){ + + cellElement * elem = NULL; + elem = (cellElement*) malloc(sizeof(cellElement)); + + if (elem == NULL){ + return -1; + } + + printf("---insertNextRow---\n"); + + elem->value = true; + elem->nextRow = NULL; + elem->nextRow = NULL; + if (tree->nextRow == NULL){ + tree->nextRow = elem; + }else{ + return -2; + } + return 1; +} + +void removeNextCol(cellElement* tree){ + printf("---removeNextCol---\n"); + + if (tree->nextCol != NULL){ + cellElement * elem = tree->nextCol; + free(elem); + elem = NULL; + tree->nextCol = NULL; + + } + +} + +void removeNextRow(cellElement* tree){ + printf("---removeNextRow---\n"); + + if (tree->nextRow != NULL){ + cellElement* elem = tree->nextRow; + free(elem); + elem =NULL; + tree->nextRow = NULL; + + } + +} +void recursivePrint(cellElement * tree){ + if (tree != NULL){ + printf("Elem : x: %d y: %d \n",tree->colIndex,tree->rowIndex); + if (tree->nextCol != NULL){ + recursivePrint(tree->nextCol); + } + if (tree->nextRow != NULL){ + recursivePrint(tree->nextRow); + } + if (tree->nextCol == NULL && tree->nextCol == NULL){ + printf("leaf\n"); + } + + } +} + void FreeCellElement(cellElement* element) { if (element != NULL){ free(element); diff --git a/LibList/CellElement.h b/LibList/CellElement.h index f0ae81f..51597bd 100644 --- a/LibList/CellElement.h +++ b/LibList/CellElement.h @@ -7,11 +7,15 @@ *@false : 0 */ typedef enum Bool{ +<<<<<<< a99b5938634fe0e05047ed6418191cdbc8cb683a:LibList/CellElement.h <<<<<<< 0996ce834deca07fbf19d0b5de5f3c8b568185e6:LibList/CellElement.h ======= >>>>>>> tests et complètion des fx:CellElement.h +======= + +>>>>>>> Add true makefile + lists:LibList/CellElement.h true = 1, false = 0 @@ -31,7 +35,7 @@ typedef enum Bool{ * */ struct cellElement { - + int colIndex; int rowIndex; @@ -54,8 +58,12 @@ void FreeCellElement(cellElement* element); ======= void removeNextCol(cellElement* list); void removeNextRow(cellElement* list); - void recursivePrint(cellElement * tree); >>>>>>> Added funcs about CellElement:CellElement.h +<<<<<<< a99b5938634fe0e05047ed6418191cdbc8cb683a:LibList/CellElement.h +======= +void FreeCellElement(cellElement* element); + +>>>>>>> Add true makefile + lists:LibList/CellElement.h #endif diff --git a/LibList/Makefile b/LibList/Makefile index ac206d5..5f92df2 100644 --- a/LibList/Makefile +++ b/LibList/Makefile @@ -14,7 +14,6 @@ LIBSOURCEOFILE=$(LIBSOURCE:=.o) #Generating the library binary $(LIBTARGET): $(LIBSOURCEOFILE) @echo "\n Generating the library binary" - mkdir -p ../Libs $(CC) $(CFLAGS) -shared $(LIBSOURCEOFILE) -o ../Libs/$(LIBTARGET) #Generating object files diff --git a/Makefile b/Makefile index 6c9e421..99edc06 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,6 @@ DEPENDENCENAMELIST=List all: $(TARGET) - #Generating the main.exe $(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib @echo "\n Generating the " $(TARGET) " binary" diff --git a/main.c b/main.c index 32d1521..b1efa8a 100644 --- a/main.c +++ b/main.c @@ -8,9 +8,21 @@ #include #include +#include + +int main(int argc, char **argv){ + cellElement * tree = NULL; + tree = CreateCellElem(); + tree->colIndex = 1; + AddNextRow(tree); + tree->nextRow->colIndex = 2; + AddNextCol(tree); + tree->nextCol->colIndex = 3; + recursivePrint(tree); + removeNextRow(tree); + removeNextCol(tree); + recursivePrint(tree); -int main(int argc, char *argv[]) -{ - printf("Hello World\n"); return 0; + }