mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-26 10:04:15 +00:00
Add true makefile + lists
This commit is contained in:
parent
a99b593863
commit
43f32a485a
138
CellElemFunc.c
138
CellElemFunc.c
@ -1,138 +0,0 @@
|
|||||||
/***
|
|
||||||
--- CellElemFunc ---
|
|
||||||
---Created by : Naej Doree ---
|
|
||||||
***/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <CellElement.h>
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
BIN
CellElemFunc.o
BIN
CellElemFunc.o
Binary file not shown.
@ -1,14 +1,124 @@
|
|||||||
/*
|
/***
|
||||||
* @Author: klmp200
|
--- CellElemFunc ---
|
||||||
* @Date: 2016-12-10 01:32:50
|
---Created by : Naej Doree ---
|
||||||
* @Last Modified by: klmp200
|
***/
|
||||||
* @Last Modified time: 2016-12-10 04:29:48
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <CellElement.h>
|
#include <CellElement.h>
|
||||||
|
|
||||||
|
|
||||||
|
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) {
|
void FreeCellElement(cellElement* element) {
|
||||||
if (element != NULL){
|
if (element != NULL){
|
||||||
free(element);
|
free(element);
|
||||||
|
@ -7,11 +7,15 @@
|
|||||||
*@false : 0
|
*@false : 0
|
||||||
*/
|
*/
|
||||||
typedef enum Bool{
|
typedef enum Bool{
|
||||||
|
<<<<<<< a99b5938634fe0e05047ed6418191cdbc8cb683a:LibList/CellElement.h
|
||||||
<<<<<<< 0996ce834deca07fbf19d0b5de5f3c8b568185e6:LibList/CellElement.h
|
<<<<<<< 0996ce834deca07fbf19d0b5de5f3c8b568185e6:LibList/CellElement.h
|
||||||
|
|
||||||
=======
|
=======
|
||||||
|
|
||||||
>>>>>>> tests et complètion des fx:CellElement.h
|
>>>>>>> tests et complètion des fx:CellElement.h
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> Add true makefile + lists:LibList/CellElement.h
|
||||||
true = 1,
|
true = 1,
|
||||||
false = 0
|
false = 0
|
||||||
|
|
||||||
@ -31,7 +35,7 @@ typedef enum Bool{
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct cellElement {
|
struct cellElement {
|
||||||
|
|
||||||
int colIndex;
|
int colIndex;
|
||||||
int rowIndex;
|
int rowIndex;
|
||||||
|
|
||||||
@ -54,8 +58,12 @@ void FreeCellElement(cellElement* element);
|
|||||||
=======
|
=======
|
||||||
void removeNextCol(cellElement* list);
|
void removeNextCol(cellElement* list);
|
||||||
void removeNextRow(cellElement* list);
|
void removeNextRow(cellElement* list);
|
||||||
|
|
||||||
void recursivePrint(cellElement * tree);
|
void recursivePrint(cellElement * tree);
|
||||||
>>>>>>> Added funcs about CellElement:CellElement.h
|
>>>>>>> Added funcs about CellElement:CellElement.h
|
||||||
|
|
||||||
|
<<<<<<< a99b5938634fe0e05047ed6418191cdbc8cb683a:LibList/CellElement.h
|
||||||
|
=======
|
||||||
|
void FreeCellElement(cellElement* element);
|
||||||
|
|
||||||
|
>>>>>>> Add true makefile + lists:LibList/CellElement.h
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,7 +14,6 @@ LIBSOURCEOFILE=$(LIBSOURCE:=.o)
|
|||||||
#Generating the library binary
|
#Generating the library binary
|
||||||
$(LIBTARGET): $(LIBSOURCEOFILE)
|
$(LIBTARGET): $(LIBSOURCEOFILE)
|
||||||
@echo "\n Generating the library binary"
|
@echo "\n Generating the library binary"
|
||||||
mkdir -p ../Libs
|
|
||||||
$(CC) $(CFLAGS) -shared $(LIBSOURCEOFILE) -o ../Libs/$(LIBTARGET)
|
$(CC) $(CFLAGS) -shared $(LIBSOURCEOFILE) -o ../Libs/$(LIBTARGET)
|
||||||
|
|
||||||
#Generating object files
|
#Generating object files
|
||||||
|
1
Makefile
1
Makefile
@ -25,7 +25,6 @@ DEPENDENCENAMELIST=List
|
|||||||
|
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
#Generating the main.exe
|
#Generating the main.exe
|
||||||
$(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib
|
$(TARGET): $(SOURCEOFILE) $(DEPENDENCELIST) lib
|
||||||
@echo "\n Generating the " $(TARGET) " binary"
|
@echo "\n Generating the " $(TARGET) " binary"
|
||||||
|
18
main.c
18
main.c
@ -8,9 +8,21 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <CellElement.h>
|
||||||
|
|
||||||
|
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;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user