Example #1
0
void	verbose_instructions(t_op *info, t_cmd *cmds)
{
	char	*ptr1;
	char	*ptr2;

	ft_printf("[0x%02s] ",
			ptr1 = ft_utoa_base(info->opcode, "0123456789abcdef"));
	ft_memdel((void**)&ptr1);
	if (info->info_params)
	{
		ft_printf("%s0b%08s%s - 0x%s", GREEN,
				ptr1 = ft_utoa_base(cmds->info, "01"),
				C_END,
				ptr2 = ft_utoa_base(cmds->info, "0123456789abcdef"));
		ft_memdel((void**)&ptr1);
		ft_memdel((void**)&ptr2);
	}
}
Example #2
0
void	process_xx(char conv, va_list ap, int *bytes, t_content *cont)
{
	unsigned int	n;
	char			*str;

	str = NULL;
	unset_flags_unsigned(cont->flags);
	if (!cont->lenmod)
	{
		n = va_arg(ap, unsigned int);
		if (conv == 'x')
			str = ft_utoa_base((long long)n, 16, "0123456789abcdef");
		else
			str = ft_utoa_base((long long)n, 16, "0123456789ABCDEF");
		str = do_hexa_diez(str, cont->flags->diez, conv, bytes);
		if (!(cont->flags->diez && cont->precision_value == -1 && \
			ft_strlen(str) == 1 && str[0] == '0'))
			print_signed_d(str, bytes, cont);
	}
Example #3
0
char	*type_o_std(unsigned long long d, t_arg *a)
{
	char	*s;

	s = a->p == 0 && d == 0 ? ft_strnew(0) : ft_utoa_base(d, 8);
	a->ret = ft_strlen(s);
	while (a->ret < a->p)
	{
		s = ft_cjoin(ft_strdup("0"), s);
		a->ret++;
	}
	a->ret += a->f_h && s[0] != 0 ? 1 : 0;
	a->f_h && s[0] != '0' ? s = ft_cjoin(ft_strdup("0"), s) : 0;
	while (a->ret < a->l)
	{
		s = a->f_m ? ft_cjoin(s, ft_strdup(" ")) : ft_cjoin(ft_strdup(" "), s);
		a->ret++;
	}
	return (s);
}