tgrekov-ft_printf
HIVE printf Feb 2024
Loading...
Searching...
No Matches
pointer.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* pointer.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/11/01 08:38:51 by tgrekov #+# #+# */
9/* Updated: 2024/02/13 07:35:14 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#include <stdarg.h>
21#include <unistd.h>
22#include "../sequence.h"
23#include "../../utils/utils.h"
24#include "../../utils/internal_types.h"
25
26int process_uhex(t_sequence seq, int *fd, int total);
27
38void pre_ptr(va_list args, t_sequence *seq)
39{
40 seq->data = (unsigned long long) va_arg(args, void *);
41 seq->total_len = u_len_base(seq->data, 16);
42 seq->sign = "0x";
43 seq->process = process_uhex;
44}
void pre_ptr(va_list args, t_sequence *seq)
Preprocess the pointer specifier by retrieving the address, setting the s_sequence::total_len with u_...
Definition pointer.c:38
int process_uhex(t_sequence seq, int *fd, int total)
Process the unsigned octal specifier by printing the number in uppercase or lowercase base 16 dependi...
Definition uhex.c:37
int u_len_base(t_ubiggest n, int base)
Determine the length of unsigned number n in base base.
Definition u_len_base.c:29
Holds information regarding the current format specifier sequence.
Definition sequence.h:49
int(* process)(struct s_sequence, int *, int)
Function to use for processing this sequence's value.
Definition sequence.h:56
t_ubiggest data
Retrieved variable argument.
Definition sequence.h:53
int total_len
Total number of characters after padding.
Definition sequence.h:54
char * sign
String containing the prefix for the value. Set during preprocessing for a format handler.
Definition sequence.h:52