tgrekov-pipex
HIVE pipex May 2024
Loading...
Searching...
No Matches
handlers.h File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handlers.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/01 00:29:00 by tgrekov #+# #+# */
/* Updated: 2024/02/13 07:29:55 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file handlers.h.

#include <stdarg.h>
#include "../sequence.h"
#include "../subspec.h"
Include dependency graph for handlers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void pre_char (va_list args, t_sequence *seq)
 Preprocess the character specifier by retrieving the character, setting s_sequence::total_len to 1 and s_sequence::process to process_char.
 
void pre_int (va_list args, t_sequence *seq)
 Preprocess the signed integer specifier by retrieving the argument in the appropriate size, setting s_sequence::sign to - if the number was negative, converting it from signed to unsigned, setting the s_sequence::total_len with u_len_base(nbr, 10) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, setting s_sequence::sign to s_subspec::forced_sign if it was not already set to -, and setting the s_sequence::process to process_uint.
 
void pre_percent (va_list args, t_sequence *seq)
 Preprocess the percent specifier by setting s_sequence::data to %, s_sequence::total_len to 1, and s_sequence::process to process_char.
 
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_len_base(ptr, 16), setting the prefix to 0x, and setting the s_sequence::process to process_uhex.
 
void pre_set_fd (va_list args, t_sequence *seq)
 Preprocess the set file descriptor specifier by retrieving the argument, ensuring that s_subspec::min_width is 0, and setting s_sequence::process to process_set_fd.
 
void pre_store (va_list args, t_sequence *seq)
 Preprocess the store specifier by retrieving the address argument in the appropriate size dependent on the length modifier, ensuring that s_subspec::min_width is 0, and setting s_sequence::process to process_store.
 
void pre_string (va_list args, t_sequence *seq)
 Preprocess the string specifier by retrieving the address, setting s_sequence::data to the address, or to "(null)" if it is null, setting s_sequence::total_len to the length of the string or the s_subspec::precision, if it is specified and less than the length, and setting s_sequence::process to process_string.
 
void pre_uhex (va_list args, t_sequence *seq)
 Preprocess the unsigned hexadecimal specifier by retrieving the argument in the appropriate size, setting the s_sequence::total_len with u_len_base(nbr, 16) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, setting s_sequence::sign to 0x or 0X if s_subspec::force_decimal is set and the retrieved value is non-zero, and setting the s_sequence::process to process_uhex.
 
void pre_uint (va_list args, t_sequence *seq)
 Preprocess the unsigned integer specifier by retrieving the argument in the appropriate size, setting the s_sequence::total_len with u_len_base(nbr, 10) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, and setting the s_sequence::process to process_uint.
 
void pre_uoct (va_list args, t_sequence *seq)
 Preprocess the unsigned octal specifier by retrieving the argument in the appropriate size, setting the s_sequence::total_len with u_len_base(nbr, 8) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, setting s_sequence::sign to 0 if s_subspec::force_decimal is set and the retrieved value is non-zero, and setting the s_sequence::process to process_uoct.
 

Function Documentation

◆ pre_char()

void pre_char ( va_list  args,
t_sequence seq 
)

Preprocess the character specifier by retrieving the character, setting s_sequence::total_len to 1 and s_sequence::process to process_char.

Parameters
[in,out]args
[in,out]seq

Definition at line 47 of file char.c.

◆ pre_int()

void pre_int ( va_list  args,
t_sequence seq 
)

Preprocess the signed integer specifier by retrieving the argument in the appropriate size, setting s_sequence::sign to - if the number was negative, converting it from signed to unsigned, setting the s_sequence::total_len with u_len_base(nbr, 10) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, setting s_sequence::sign to s_subspec::forced_sign if it was not already set to -, and setting the s_sequence::process to process_uint.

Parameters
[in,out]args
[in,out]seq

Definition at line 88 of file int.c.

References s_sequence::data, s_subspec::forced_sign, s_subspec::lenmod, lltull(), s_subspec::pad_str, s_subspec::precision, s_sequence::process, process_uint(), s_sequence::sign, signed_arg(), s_sequence::subspec, s_sequence::total_len, and u_len_base().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_percent()

void pre_percent ( va_list  args,
t_sequence seq 
)

Preprocess the percent specifier by setting s_sequence::data to %, s_sequence::total_len to 1, and s_sequence::process to process_char.

Parameters
[in]args(Unused)
[in,out]seq

Definition at line 35 of file percent.c.

References s_sequence::data, s_sequence::process, process_char(), and s_sequence::total_len.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_ptr()

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_len_base(ptr, 16), setting the prefix to 0x, and setting the s_sequence::process to process_uhex.

Parameters
[in,out]args
[in,out]seq

Definition at line 38 of file pointer.c.

References s_sequence::data, s_sequence::process, process_uhex(), s_sequence::sign, s_sequence::total_len, and u_len_base().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_set_fd()

void pre_set_fd ( va_list  args,
t_sequence seq 
)

Preprocess the set file descriptor specifier by retrieving the argument, ensuring that s_subspec::min_width is 0, and setting s_sequence::process to process_set_fd.

Parameters
[in,out]args
[in,out]seq

Definition at line 49 of file set_fd.c.

References s_sequence::data, s_subspec::min_width, s_sequence::process, process_set_fd(), and s_sequence::subspec.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_store()

void pre_store ( va_list  args,
t_sequence seq 
)

Preprocess the store specifier by retrieving the address argument in the appropriate size dependent on the length modifier, ensuring that s_subspec::min_width is 0, and setting s_sequence::process to process_store.

Parameters
args
seq

Definition at line 69 of file store.c.

References s_sequence::data, s_subspec::lenmod, s_subspec::min_width, s_sequence::process, process_store(), and s_sequence::subspec.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_string()

void pre_string ( va_list  args,
t_sequence seq 
)

Preprocess the string specifier by retrieving the address, setting s_sequence::data to the address, or to "(null)" if it is null, setting s_sequence::total_len to the length of the string or the s_subspec::precision, if it is specified and less than the length, and setting s_sequence::process to process_string.

Parameters
[in,out]args
[in,out]seq

Definition at line 50 of file string.c.

References s_sequence::data, ft_strlen(), s_subspec::precision, s_sequence::process, process_string(), s_sequence::subspec, and s_sequence::total_len.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_uhex()

void pre_uhex ( va_list  args,
t_sequence seq 
)

Preprocess the unsigned hexadecimal specifier by retrieving the argument in the appropriate size, setting the s_sequence::total_len with u_len_base(nbr, 16) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, setting s_sequence::sign to 0x or 0X if s_subspec::force_decimal is set and the retrieved value is non-zero, and setting the s_sequence::process to process_uhex.

Parameters
[in,out]args
[in,out]seq

Definition at line 58 of file uhex.c.

References s_sequence::data, s_subspec::force_decimal, s_subspec::lenmod, s_subspec::pad_str, s_subspec::precision, s_sequence::process, process_uhex(), s_sequence::sign, s_sequence::specifier, s_sequence::subspec, s_sequence::total_len, u_len_base(), and unsigned_arg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_uint()

void pre_uint ( va_list  args,
t_sequence seq 
)

Preprocess the unsigned integer specifier by retrieving the argument in the appropriate size, setting the s_sequence::total_len with u_len_base(nbr, 10) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, and setting the s_sequence::process to process_uint.

Parameters
[in,out]args
[in,out]seq

Definition at line 54 of file uint.c.

References s_sequence::data, s_subspec::lenmod, s_subspec::pad_str, s_subspec::precision, s_sequence::process, process_uint(), s_sequence::subspec, s_sequence::total_len, u_len_base(), and unsigned_arg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_uoct()

void pre_uoct ( va_list  args,
t_sequence seq 
)

Preprocess the unsigned octal specifier by retrieving the argument in the appropriate size, setting the s_sequence::total_len with u_len_base(nbr, 8) and the s_subspec::precision, ensuring that s_subspec::pad_str is set to spaces if the s_subspec::precision is set, setting s_sequence::sign to 0 if s_subspec::force_decimal is set and the retrieved value is non-zero, and setting the s_sequence::process to process_uoct.

Parameters
[in,out]args
[in,out]seq

Definition at line 55 of file uoct.c.

References s_sequence::data, s_subspec::force_decimal, s_subspec::lenmod, s_subspec::pad_str, s_subspec::precision, s_sequence::process, process_uoct(), s_sequence::sign, s_sequence::subspec, s_sequence::total_len, u_len_base(), and unsigned_arg().

Here is the call graph for this function:
Here is the caller graph for this function: