From dba704e4e7fc2e6a46ad828b65ef119c5fa05bbb Mon Sep 17 00:00:00 2001 From: Naej Date: Sun, 11 Dec 2016 04:01:27 +0100 Subject: [PATCH] Ajout doc --- LibAutomaton/CellElement.c | 1 + LibAutomaton/CellElement.h | 54 ++++++++++++++++++++++++++++++++++---- main.c | 2 ++ 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/LibAutomaton/CellElement.c b/LibAutomaton/CellElement.c index 0ab9d8b..6dc9f88 100644 --- a/LibAutomaton/CellElement.c +++ b/LibAutomaton/CellElement.c @@ -109,6 +109,7 @@ void removeNextRow(cellElement* tree){ } } + void recursivePrint(cellElement * tree){ if (tree != NULL){ printf("Elem : x: %d y: %d \n",tree->colIndex,tree->rowIndex); diff --git a/LibAutomaton/CellElement.h b/LibAutomaton/CellElement.h index 7be56d5..1a886bd 100644 --- a/LibAutomaton/CellElement.h +++ b/LibAutomaton/CellElement.h @@ -51,7 +51,9 @@ cellElement * CreateCellElem(); /*---AddNextCol--- *Allocates a cellElement and sets it as the NextCol of the tree * -*@tree : an allocated cellElement +*@tree : pointer on an allocated cellElement +* +*@return ; error codes * */ int AddNextCol(cellElement* tree); @@ -60,7 +62,9 @@ int AddNextCol(cellElement* tree); /*---AddNextRow--- *Allocates a cellElement and sets it as the NextRow of the tree * -*@tree : an allocated cellElement +*@tree : a pointer on an allocated cellElement +* +*@return : error codes * */ int AddNextRow(cellElement* tree); @@ -68,7 +72,7 @@ int AddNextRow(cellElement* tree); /*---removeNextCol--- *Free the nextCol cellElement of the tree * -*@tree : an allocated cellElement +*@tree : a pointer on an allocated cellElement * */ void removeNextCol(cellElement* tree); @@ -76,7 +80,7 @@ void removeNextCol(cellElement* tree); /*---removeNextRow--- *Free the nextRow cellElement of the tree * -*@tree : an allocated cellElement +*@tree : a pointer on an allocated cellElement * */ void removeNextRow(cellElement* tree); @@ -85,15 +89,55 @@ void removeNextRow(cellElement* tree); /*---FreeCellElem--- *Allocates a cellElement and returns it * -*@return : pointer on the allocated cellElement +*@element : pointer on the allocated cellElement * */ void FreeCellElement(cellElement* element); +/*---is_leaf--- +*Checks is the tree is a leaf +* +*@tree : a pointer on an allocated cellElement +* +*@return : a bool +* +*/ bool is_leaf(cellElement* tree); + + +/*---SetPositionIndex--- +*Allows you to set the colIndex and the rowIndex of the cellElement elem +* +*@elem : a pointer on an allocated cellElement +*@Col : the value for colIndex +*@Row : the value for rowIndex +* +*@return : error codes +* +*/ int SetPositionIndex(cellElement* elem,int Col,int Row); + +/*---SetNextCol--- +*Allows you to set the nextCol of the cellElement tree +* +*@tree : a pointer on the element you want to set +*@elem : a pointer on a cellElement +* +*@return : error codes +* +*/ int SetNextCol(cellElement* tree,cellElement* elem); + +/*---SetNextRow--- +*Allows you to set the nextRow of the cellElement elem +* +*@tree : a pointer on the element you want to set +*@elem : a pointer on a cellElement +* +*@return : error codes +* +*/ int SetNextRow(cellElement* tree,cellElement* elem); diff --git a/main.c b/main.c index d7a55f9..9ff9404 100644 --- a/main.c +++ b/main.c @@ -24,6 +24,8 @@ int main(int argc, char **argv){ AddNextCol(tree); SetPositionIndex(tree->nextCol,1,3); + SetNextRow(tree->nextCol,tree->nextRow); + recursivePrint(tree);