tree debug: create library for easy indent/dedent

This commit is contained in:
Khaïs COLIN 2025-03-18 15:11:23 +01:00
parent 47a61699ab
commit 40c5164eef
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
7 changed files with 84 additions and 35 deletions

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 17:49:46 by khais #+# #+# */
/* Updated: 2025/03/18 15:08:30 by khais ### ########.fr */
/* Updated: 2025/03/18 15:31:31 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -118,19 +118,10 @@ void cmdlist_destroy(t_cmdlist *cmd)
free(cmd);
}
void cmdlist_debug(t_cmdlist *cmd, t_buffer **indent, bool is_last)
void cmdlist_debug(t_cmdlist *cmd, t_buffer **leader, bool is_last)
{
ft_printf("%s", (*indent)->buffer);
if (is_last)
{
ft_printf("%s", CORNER);
*indent = ft_buffer_push_buf(*indent, SPACE, TREEDRAW_LENGTH);
}
else
{
ft_printf("%s", CROSS);
*indent = ft_buffer_push_buf(*indent, VERTICAL, TREEDRAW_LENGTH);
}
indent(leader, is_last);
ft_printf("%s\n", "t_cmdlist");
(void)cmd; // TODO
dedent(leader, is_last);
}