diff --git a/LibAutomaton/CellElement.c b/LibAutomaton/CellElement.c index 480513f..0ab9d8b 100644 --- a/LibAutomaton/CellElement.c +++ b/LibAutomaton/CellElement.c @@ -62,31 +62,32 @@ int SetNextRow(cellElement* tree,cellElement* elem){ int AddNextCol(cellElement* tree){ cellElement * elem = NULL; + + printf("---insertNextCol---\n"); + elem = CreateCellElem(); if (elem == NULL){ return -1; } - - printf("---insertNextCol---\n"); - - return(SetNextCol(tree,elem)); + } int AddNextRow(cellElement* tree){ cellElement * elem = NULL; + + printf("---insertNextRow---\n"); + elem = CreateCellElem(); if (elem == NULL){ return -1; } - - printf("---insertNextRow---\n"); - return(SetNextRow(tree,elem)); + } void removeNextCol(cellElement* tree){ diff --git a/LibAutomaton/CellElement.h b/LibAutomaton/CellElement.h index 3efe146..7be56d5 100644 --- a/LibAutomaton/CellElement.h +++ b/LibAutomaton/CellElement.h @@ -81,8 +81,6 @@ void removeNextCol(cellElement* tree); */ void removeNextRow(cellElement* tree); -void recursivePrint(cellElement * tree); - /*---FreeCellElem--- *Allocates a cellElement and returns it @@ -92,4 +90,15 @@ void recursivePrint(cellElement * tree); */ void FreeCellElement(cellElement* element); + +bool is_leaf(cellElement* tree); +int SetPositionIndex(cellElement* elem,int Col,int Row); +int SetNextCol(cellElement* tree,cellElement* elem); +int SetNextRow(cellElement* tree,cellElement* elem); + + + + +void recursivePrint(cellElement * tree); + #endif diff --git a/main.c b/main.c index 346236c..d7a55f9 100644 --- a/main.c +++ b/main.c @@ -14,19 +14,23 @@ int main(int argc, char **argv){ cellElement * tree = NULL; + tree = CreateCellElem(); - tree->colIndex = 1; - tree->rowIndex = 1; + SetPositionIndex(tree,1,1); + AddNextRow(tree); - tree->nextRow->colIndex = 2; - tree->nextRow->rowIndex = 2; + SetPositionIndex(tree->nextRow,1,2); + AddNextCol(tree); - tree->nextCol->colIndex = 3; - tree->nextCol->rowIndex = 2; + SetPositionIndex(tree->nextCol,1,3); + recursivePrint(tree); + + removeNextRow(tree); removeNextCol(tree); + recursivePrint(tree); return 0;