diff --git a/src/calibration.c b/src/calibration.c index caefa8b..e4f6b59 100644 --- a/src/calibration.c +++ b/src/calibration.c @@ -14,7 +14,6 @@ * caractère nul. * - La chaîne de caractère contient forcément des caractères non-nuls. */ -/* static char parse_digit(char *line, Node *digits_tree) { if (isdigit(line[0])) { return line[0]; @@ -22,7 +21,6 @@ static char parse_digit(char *line, Node *digits_tree) { return Node_stringToDigit(digits_tree, line); } } -*/ /** * Lire tous les caractères d'une ligne : @@ -30,12 +28,16 @@ static char parse_digit(char *line, Node *digits_tree) { * - Si aucun chiffre n'a été trouvé, retourner 0 */ static char first_digit(char *line) { - while (line[0] != '\0' && !isdigit(line[0])) { + char current_digit = '\0'; + Node *digits_tree = Node_new('\0'); + + while (line[0] != '\0' && !isdigit(current_digit)) { + current_digit = parse_digit(line, digits_tree); line++; } - if (*line != '\0') { - return *line; + if (current_digit != '\0') { + return current_digit; } else { return 0; } diff --git a/src/node.c b/src/node.c index d77808d..f2bd51f 100644 --- a/src/node.c +++ b/src/node.c @@ -86,3 +86,14 @@ void Node_printTree(Node *root_node) { print_node(root_node, 0); putchar('\n'); } + +/** + * Transformer une chaîne de caractères en un chiffre à l'aide d'un arbre + * n-aire + */ +char Node_stringToDigit(Node *root_node, char *string) { + (void) root_node; + (void) string; + + return '\0'; +}