Skip to content

Commit

Permalink
wip printf
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixailz committed Dec 3, 2023
1 parent a1c0a72 commit c8dba5f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 19 deletions.
26 changes: 25 additions & 1 deletion src/print/ft_printf/ft_printf_padding.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: brda-sil <brda-sil@students.42angouleme +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/01 11:15:45 by brda-sil #+# #+# */
/* Updated: 2023/12/01 11:38:03 by brda-sil ### ########.fr */
/* Updated: 2023/12/03 01:40:10 by brda-sil ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -33,23 +33,47 @@
conf->cur_type[ft_strlen(conf->cur_type)] = sign;
0x10
%-6x '10 '
%-#6x '0x10 '
%-06x '10 '
%-#06x '0x10 '
%6x ' 10'
%#6x ' 0x10'
%06x '000010'
%#06x '0x0010'
%6d ' 10'
%06d '000010'
%-6d '10 '
%-06d '10 '
%6s ' 0x10'
%-6s '0x10 '
*/

void ft_printf_type_padding_hex(t_fmt_conf *conf)
{
(void)conf;
}

void ft_printf_type_padding_integer(t_fmt_conf *conf)
{
(void)conf;
}

void ft_printf_type_padding_string(t_fmt_conf *conf)
{
(void)conf;
}

void ft_printf_type_padding(t_fmt_conf *conf)
{
if (conf->fmt_type & (FMT_HEX | FMT_HEXA))
ft_printf_type_padding_hex(conf);
else if (conf->fmt_type & (FMT_DIGI | FMT_INTE))
ft_printf_type_padding_integer(conf);
else if (conf->fmt_type & FMT_STRI)
ft_printf_type_padding_string(conf);
}
36 changes: 18 additions & 18 deletions test/src/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: brda-sil <brda-sil@students.42angouleme +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/07 03:09:08 by brda-sil #+# #+# */
/* Updated: 2023/12/01 12:46:59 by brda-sil ### ########.fr */
/* Updated: 2023/12/03 01:40:36 by brda-sil ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -170,23 +170,23 @@ int ci_flags(void)
int retv;

retv = 0;
retv |= test_printf_integer("%6x", 0x10);
retv |= test_printf_integer("%-6x", 0x10);
retv |= test_printf_integer("%#6x", 0x10);
retv |= test_printf_integer("%-#6x", 0x10);
retv |= test_printf_integer("%06x", 0x10);
retv |= test_printf_integer("%-06x", 0x10);
retv |= test_printf_integer("%#06x", 0x10);
retv |= test_printf_integer("%-#06x", 0x10);
// retv |= test_printf_integer("% d", 1000);
// retv |= test_printf_integer("% 6d", 1000);
// retv |= test_printf_integer("%+18d", 1000);
// retv |= test_printf_integer("%+-18d", 1000);
// retv |= test_printf_integer("%#x", 0x1234);
// retv |= test_printf_integer("%#X", 0x1234);
// retv |= test_printf_integer("%04d", 12);
// retv |= test_printf_integer("%04d", -12);
// retv |= test_printf_integer("%01.3d", 0);

// retv |= test_printf_integer("%6x", 0x10);
// retv |= test_printf_integer("%#6x", 0x10);
// retv |= test_printf_integer("%06x", 0x10);
// retv |= test_printf_integer("%#06x", 0x10);
// retv |= test_printf_integer("%-6x", 0x10);
// retv |= test_printf_integer("%-#6x", 0x10);
// retv |= test_printf_integer("%-06x", 0x10);
// retv |= test_printf_integer("%-#06x", 0x10);

// retv |= test_printf_integer("%6d", 0x10);
// retv |= test_printf_integer("%06d", 0x10);
// retv |= test_printf_integer("%-6d", 0x10);
// retv |= test_printf_integer("%-06d", 0x10);

// retv |= test_printf_string("%6s", "0x10");
// retv |= test_printf_string("%-6s", "0x10");
return (retv);
}

Expand Down

0 comments on commit c8dba5f

Please sign in to comment.