-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
101 lines (81 loc) · 4.23 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef MAIN_H
#define MAIN_H
/* Standard libreries */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
/* '_printf.c' function */
int _printf(const char *format, ...);
/* Task 0: Functions to print characters, strings and percent */
int print_character(va_list arg_list, char *buffer, unsigned int index);
int print_string(va_list arg_list, char *buffer, unsigned int index);
int print_percent(va_list __attribute__((unused)), char *, unsigned int);
/* Task 1: Functions to print integers and digits */
int print_integer(va_list arg_list, char *buffer, unsigned int index);
int print_digit(va_list arg_list, char *buffer, unsigned int index);
/* Task 2: Functions to convertes and prints integers to binary */
int print_binary(va_list arg_list, char *buffer, unsigned int index);
char *input_to_binary(char *binary, long int number,
int check_negative, int max_size);
/* Task 3: Functions to convertes and prints int to oct and unsigned int */
int print_octal(va_list arg_list, char *buffer, unsigned int index);
char *input_to_octal(char *bin, char *oct);
int print_unsigned(va_list arg_list, char *buffer, unsigned int index);
/* Task 3: Functions to convertes and prints integer to upper and lower hexa */
int print_lower_hexa(va_list arg_list, char *buffer, unsigned int index);
int print_upper_hexa(va_list arg_list, char *buffer, unsigned int index);
char *input_to_hexa(char *bin, char *hex, int check_upper, int max_size);
/* Task 4: Functions to minimises the use of 'write()' and prints the 'char' */
unsigned int _puts(char *buffer, char c, unsigned int index);
int _putchar(char *buffer, unsigned int index);
/* Task 5: Function to prints non printable values */
int print_unsigned_str(va_list arg_list, char *buffer, unsigned int index);
/* Task 6: Function to prints an andress */
int print_address(va_list a, char *buf, unsigned int index);
/* Task 7: Functions to prints an integers or digits with flag */
int print_plus_int(va_list arg_list, char *buffer, unsigned int index);
int print_plus_dig(va_list arg_list, char *buffer, unsigned int index);
int print_space_int(va_list arg_list, char *buffer, unsigned int index);
int print_space_dig(va_list arg_list, char *buffer, unsigned int index);
int print_zero_oct(va_list arg_list, char *buffer, unsigned int index);
int print_zero_hexa(va_list arg_list, char *buffer, unsigned int index);
int print_zero_uhexa(va_list arg_list, char *buffer, unsigned int index);
/* Task 8: Functions to prints data with length*/
int print_long_int(va_list arg_list, char *buffer, unsigned int index);
int print_long_dig(va_list arg_list, char *buffer, unsigned int index);
int print_long_uns(va_list arg_list, char *buffer, unsigned int index);
int print_long_oct(va_list arg_list, char *buffer, unsigned int index);
char *input_long_oct(char *bin, char *oct);
int print_long_hexa(va_list arg_list, char *buffer, unsigned int index);
int print_long_uhexa(va_list arg_list, char *buffer, unsigned int index);
int print_short_int(va_list arg_list, char *buffer, unsigned int index);
int print_short_dig(va_list arg_list, char *buffer, unsigned int index);
int print_short_uns(va_list arg_list, char *buffer, unsigned int index);
int print_short_oct(va_list arg_list, char *buffer, unsigned int index);
char *input_short_oct(char *bin, char *oct);
int print_short_hexa(va_list arg_list, char *buffer, unsigned int index);
int print_short_uhexa(va_list arg_list, char *buffer, unsigned int index);
/* Task 13: Function to prints the reversed input */
int print_reverse(va_list arg_list, char *buffer, unsigned int index);
/* Task 14: Function to prints rot13 encode */
int print_rot(va_list arg_list, char *buffer, unsigned int index);
/**
* struct specif - struct specifier format
*
* @type_format: Input type format
* @f: Input function pointer
*/
struct specif
{
char *type_format;
int (*f)(va_list, char *, unsigned int);
};
typedef struct specif specif_t;
/* '_putchar function' */
unsigned int _puts(char *buffer, char c, unsigned int index);
int _putchar(char *buffer, unsigned int index);
/* Functions to determine end send the function for a specifier */
int (*specifier_func(const char *s, int index))(va_list, char *, unsigned int);
int specifiers_counter(const char *s, int index);
#endif /* MAIN_H */