/ libft / src / ft_dprintf / src / dprintf_inner.h
dprintf_inner.h
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   dprintf_inner.h                                    :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: ll-hotel <ll-hotel@student.42lyon.fr>      +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2024/02/06 19:14:37 by ll-hotel          #+#    #+#             */
 9  /*   Updated: 2024/06/25 15:21:48 by ll-hotel         ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #ifndef DPRINTF_INNER_H
14  # define DPRINTF_INNER_H
15  # define DPRINTF_BUFFERSIZE 1024
16  # define FD_NUMBER 1024
17  # include <stdarg.h>
18  # include <stdint.h>
19  # include <stdlib.h>
20  # include <unistd.h>
21  
22  struct s_buffer
23  {
24  	char		string[FD_NUMBER][DPRINTF_BUFFERSIZE];
25  	int32_t		length[FD_NUMBER];
26  	int32_t		fd;
27  };
28  
29  typedef struct s_buffer	t_buffer;
30  
31  /* buffer.c */
32  int32_t		ft_buffer_flush(t_buffer *buffer, int32_t fd);
33  int32_t		ft_buffer_cat(t_buffer *buffer, int32_t fd, const char *s);
34  int32_t		ft_buffer_cat_perc(t_buffer *buffer, int32_t fd, const char *s);
35  /* specifier.c */
36  int32_t		ft_specifier(const char *format, va_list args, t_buffer *buffer);
37  /* ascii.c */
38  int32_t		ft_char(t_buffer *buffer, int fd, char c);
39  int32_t		ft_string(t_buffer *buffer, int fd, char *str);
40  int32_t		ft_pointer(char *out, t_buffer *buffer, int fd, uint64_t p);
41  /* atoi32.c */
42  void		ft_atoi32(char *out, int32_t n, const char *abase, uint8_t base);
43  void		ft_atoui32(char *out, uint32_t n, const char *abase, uint8_t base);
44  /* atoi64.c */
45  void		ft_atoi64(char *out, int64_t n, const char *abase, uint8_t base);
46  void		ft_atoui64(char *out, uint64_t n, const char *abase, uint8_t base);
47  /* utils.c */
48  uint8_t		ft_logb(int64_t n, uint8_t base);
49  uint8_t		ft_logbu(uint64_t n, uint8_t base);
50  void		*ft_bzero(void *s, unsigned long n);
51  
52  #endif