This commit is contained in:
Jack Halford 2016-11-25 18:35:19 +01:00
parent e21981ca60
commit 12d3d9fbdc
3 changed files with 15 additions and 13 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/16 11:13:15 by jhalford #+# #+# */ /* Created: 2016/11/16 11:13:15 by jhalford #+# #+# */
/* Updated: 2016/11/16 11:14:02 by jhalford ### ########.fr */ /* Updated: 2016/11/25 18:33:24 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -25,6 +25,14 @@ struct s_btree
struct s_btree *right; struct s_btree *right;
}; };
enum e_printdata
{
is_left,
offset,
depth,
};
t_btree *btree_create_node(void const *item, size_t content_size); t_btree *btree_create_node(void const *item, size_t content_size);
void btree_insert_data( void btree_insert_data(

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/25 11:43:12 by jhalford #+# #+# */ /* Created: 2016/11/25 11:43:12 by jhalford #+# #+# */
/* Updated: 2016/11/25 18:28:27 by jhalford ### ########.fr */ /* Updated: 2016/11/25 18:33:09 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,6 +14,8 @@
# define MYTIME_H # define MYTIME_H
# include "libft.h" # include "libft.h"
typedef struct s_mytime t_mytime;
struct s_mytime struct s_mytime
{ {
char *year; char *year;
@ -24,7 +26,6 @@ struct s_mytime
char *sec; char *sec;
}; };
typedef struct s_mytime t_mytime;
int ft_time_isrecent(time_t event); int ft_time_isrecent(time_t event);

View file

@ -6,19 +6,12 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 18:06:24 by jhalford #+# #+# */ /* Created: 2016/11/14 18:06:24 by jhalford #+# #+# */
/* Updated: 2016/11/25 18:28:42 by jhalford ### ########.fr */ /* Updated: 2016/11/25 18:33:47 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "btree.h" #include "btree.h"
enum e_data
{
is_left,
offset,
depth,
};
static int print_t(t_btree *tree, static int print_t(t_btree *tree,
int data[3], char s[20][255], char *(*printer)(void *)) int data[3], char s[20][255], char *(*printer)(void *))
{ {
@ -45,8 +38,8 @@ static int print_t(t_btree *tree,
while (++i < width + right) while (++i < width + right)
s[2 * data[depth] - 1][data[offset] + left + width / 2 + i] = '-'; s[2 * data[depth] - 1][data[offset] + left + width / 2 + i] = '-';
s[2 * data[depth] - 1][data[offset] + left + width / 2] = '+'; s[2 * data[depth] - 1][data[offset] + left + width / 2] = '+';
s[2 * data[depth] - 1][ s[2 * data[depth] - 1][ data[offset] + left + right + 3 * width / 2]
data[offset] + left + right + 3 * width / 2] = '+'; = '+';
} }
else if (data[depth] && !data[is_left]) else if (data[depth] && !data[is_left])
{ {