From 30e9c36b2d20eae71658067ae28bdba9be42905e Mon Sep 17 00:00:00 2001 From: Naej <0mindstorming@gmail.com> Date: Sat, 10 Dec 2016 03:55:07 +0100 Subject: [PATCH] =?UTF-8?q?tests=20et=20compl=C3=A8tion=20des=20fx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CellElemFunc.c | 67 +++++++++++++++++++++++++++++++++++++++---------- CellElemFunc.o | Bin 0 -> 8752 bytes CellElement.h | 7 ++++-- Exe | Bin 0 -> 12184 bytes Makefile | 36 ++++++++------------------ 5 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 CellElemFunc.o create mode 100755 Exe diff --git a/CellElemFunc.c b/CellElemFunc.c index 9032683..39105d0 100644 --- a/CellElemFunc.c +++ b/CellElemFunc.c @@ -8,14 +8,50 @@ #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; + cellElement * elem = NULL; elem = (cellElement*) malloc(sizeof(cellElement)); if (elem == NULL){ @@ -27,19 +63,20 @@ int AddNextCol(cellElement* tree){ elem->value = true; elem->nextCol = NULL; elem->nextRow = NULL; + if (tree->nextCol == NULL){ tree->nextCol = elem; - return 1; }else{ return -2; } - + + return 1; } int AddNextRow(cellElement* tree){ - cellElement elem = NULL; + cellElement * elem = NULL; elem = (cellElement*) malloc(sizeof(cellElement)); if (elem == NULL){ @@ -53,19 +90,20 @@ int AddNextRow(cellElement* tree){ elem->nextRow = NULL; if (tree->nextRow == NULL){ tree->nextRow = elem; - return 1; }else{ return -2; } + return 1; } void removeNextCol(cellElement* tree){ printf("---removeNextCol---\n"); if (tree->nextCol != NULL){ - DLinkedListElement* elem = tree->nextCol; + cellElement * elem = tree->nextCol; free(elem); - elem =NULL; + elem = NULL; + tree->nextCol = NULL; } @@ -75,9 +113,10 @@ void removeNextRow(cellElement* tree){ printf("---removeNextRow---\n"); if (tree->nextRow != NULL){ - DLinkedListElement* elem = tree->nextRow; + cellElement* elem = tree->nextRow; free(elem); elem =NULL; + tree->nextRow = NULL; } @@ -85,11 +124,13 @@ void removeNextRow(cellElement* tree){ void recursivePrint(cellElement * tree){ if (tree != NULL){ printf("Elem : x: %d y: %d \n",tree->colIndex,tree->rowIndex); - if (tree->nextCol != NUll){ + if (tree->nextCol != NULL){ recursivePrint(tree->nextCol); - }else if (tree->nextRow != NUll){ + } + if (tree->nextRow != NULL){ recursivePrint(tree->nextRow); - }else{ + } + if (tree->nextCol == NULL && tree->nextCol == NULL){ printf("leaf\n"); } diff --git a/CellElemFunc.o b/CellElemFunc.o new file mode 100644 index 0000000000000000000000000000000000000000..96608af0cbafdb81c8bf19173a8df0fe65391999 GIT binary patch literal 8752 zcmb`M3tWs@8^GThDN3cVA$C}a)aXL!W|C?m3K3yzswruj+Gce5NUL1RWu=5IL**m4TsL$hEM*ni^_}z1bH>}z?tb6*`_Aw8zUMsu=Q+>woXdNgNp|=4 z(A3aiNYP+im=6-64D-VDLtDr;g-l<@h?y-)uNS30<)={>CRemJdEr3TRpJE-_g7C7MmV{_A|Z zu@#g4GptlG(tOx9uoenKY{d%P?Wvj~wG!pi={jInvA?<}T2ejkc0id~Sy{QoO2i6D zC_h9ZmAXqMQ4*N~Q3f3mGPxvHF_z4bt zvrs-ik*#_%Qi(WBeRG(sg@?|l<%GPX?5e5RuBPRUZBDJ;8%G!A1{7&WwrW*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d6# zA2?1MQfG;f;$$9zC{E`2ONx{A&8IloS4xVLeO^m(a^0~5LOPNsxvm+3JTXck4o0;i zR#h(|tyqavEKs0tJw^~JR)`rvuw2dvVxv_8s|}R|F9{EfkcCAf8@4SD4vv+?Av4?= zP^?%MF2P+tFlmHLLb{-Mj36XB3jZ6z2xQR;i2(hqWF=RKLn5J*WKm#PtT;*nqx;`0 zKI)3skh|vCn-HH+p?~6qZKP77^FVaqttmtYx75H-6Xbb>zb$ZI@&hutKMe;Cw;i>M zLK=XEj&BJ*Y4iWIzYWCa?o}L$^k0PqPNC!D?>&~0fq|_JT(9#e$8`S*$iA!j%YYA| z{XJ9;@%-U6B4Nnj^q~63~Y9rLhhW=cJ+oT`idx25gjM)bLO{fmkFqz$` ze^>MOB_ytdKzRP}vw-v`^NP1AeeK~cLQ{NZn8T_{eWuc3$3y4N_QQ*XN*XBfZ&LV{ VLdVB@s;l_p;r^44^xQ(n|2O)IG(!LY literal 0 HcmV?d00001 diff --git a/CellElement.h b/CellElement.h index d5581bb..67b0a9e 100644 --- a/CellElement.h +++ b/CellElement.h @@ -8,8 +8,8 @@ */ typedef enum Bool{ - true = 1; - false = 0; + true = 1, + false = 0 } bool; @@ -39,6 +39,9 @@ struct cellElement { }; typedef struct cellElement cellElement; +cellElement * CreateCellElem(); +void freeCellElem(cellElement * elem); + int AddNextCol(cellElement* tree); int AddNextRow(cellElement* tree); diff --git a/Exe b/Exe new file mode 100755 index 0000000000000000000000000000000000000000..c2c0af90e4d800864c326702d4afaa6a9533fa41 GIT binary patch literal 12184 zcmeHNe{dAneSdp*I^9X)bdmrIu+7?li+|`Ofly_z%;~33u>cthJ9U8NbhnZYPIvO% z9=~FyxFT*;f{h#7!z48IxM{{yJ2PaGxN0FF2F5a-W{PK;gqb=m&cq&J>;w|*%GgHz zeBZuzx3@Yup6N{bPv6b$_xJaG-;aI!zHj%>JGwg^io#@Zu=^QN7hOTlGOvtXxPy~| z*TlRm$d)jbxxp#IKgcBnO-#Zm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