tgrekov-ft_printf
HIVE printf Feb 2024
|
Definition in file handle_sequence.c.
#include <stdarg.h>
#include "sequence.h"
#include "../utils/utils.h"
#include "../../../libft/libft.h"
Go to the source code of this file.
Functions | |
void | init_subspec (t_subspec *subspec) |
Sets initial values for a s_subspec that are not always set elsewhere. | |
void | identify_sequence (va_list args, t_sequence *seq) |
Initialize a s_sequence and determine which specifier it needs to handle, and runs the preprocessing function for that specifier. Sets s_sequence::specifier to 0 on failure. | |
void | parse_subspec (const char **format, t_subspec *subspec, va_list args) |
Parse flags, width, precision, and length. | |
static int | print (t_sequence seq, int *fd, int total) |
Print appropriate padding characters on either side, as well as the sign / prefix, and call the processing function for the given specifier. | |
int | handle_sequence (const char **format, va_list args, int *fd, int total) |
Prepares and executes a sequence. | |
int handle_sequence | ( | const char ** | format, |
va_list | args, | ||
int * | fd, | ||
int | total | ||
) |
Prepares and executes a sequence.
Initializes and parses any subspecifiers, identifies the sequence and executes the preprocessor for it, adds up the final predicted lengths, prints padding, prefixes, and executes the processor for the sequence.
[in,out] | format | |
[in,out] | args | |
[in,out] | fd | |
[in] | total |
int | Number of characters printed, or -1 on error. |
Definition at line 77 of file handle_sequence.c.
References ft_strlen(), identify_sequence(), init_subspec(), s_subspec::min_width, s_sequence::pad_len, parse_subspec(), print(), s_sequence::sign, s_sequence::specifier, s_sequence::subspec, and s_sequence::total_len.
void identify_sequence | ( | va_list | args, |
t_sequence * | seq | ||
) |
Initialize a s_sequence and determine which specifier it needs to handle, and runs the preprocessing function for that specifier. Sets s_sequence::specifier to 0
on failure.
[in,out] | args | |
[in,out] | seq |
Definition at line 44 of file identify_sequence.c.
References init_sequence(), pre_char(), pre_int(), pre_percent(), pre_ptr(), pre_set_fd(), pre_store(), pre_string(), pre_uhex(), pre_uint(), pre_uoct(), and s_sequence::specifier.
void init_subspec | ( | t_subspec * | subspec | ) |
Sets initial values for a s_subspec that are not always set elsewhere.
[in,out] | subspec |
Definition at line 31 of file parse_subspec.c.
References s_subspec::force_decimal, s_subspec::forced_sign, s_subspec::left_justify, s_subspec::lenmod, s_subspec::min_width, s_subspec::pad_str, and s_subspec::precision.
void parse_subspec | ( | const char ** | format, |
t_subspec * | subspec, | ||
va_list | args | ||
) |
Parse flags, width, precision, and length.
[in,out] | format | |
[in,out] | subspec | |
[in,out] | args |
Definition at line 99 of file parse_subspec.c.
References s_subspec::force_decimal, s_subspec::forced_sign, ft_isdigit(), ft_strchr(), s_subspec::left_justify, s_subspec::min_width, s_subspec::pad_str, parse_lenmod(), s_subspec::precision, and subspec_parse_width_or_precision().
|
static |
Print appropriate padding characters on either side, as well as the sign / prefix, and call the processing function for the given specifier.
[in] | seq | |
[in,out] | fd | |
[in] | total |
int | Number of characters printed, or -1 on error. |
Definition at line 39 of file handle_sequence.c.
References ft_strlen(), s_subspec::left_justify, s_sequence::pad_len, s_subspec::pad_str, s_sequence::process, repeat_str_n(), s_sequence::sign, s_sequence::subspec, and wrap_err().