tgrekov-pipex
HIVE pipex May 2024
Loading...
Searching...
No Matches
int.c File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* int.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/01 05:18:23 by tgrekov #+# #+# */
/* Updated: 2024/02/13 08:37:14 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file int.c.

#include <stdarg.h>
#include <unistd.h>
#include <stdlib.h>
#include "../sequence.h"
#include "../../utils/utils.h"
#include "../../utils/internal_types.h"
Include dependency graph for int.c:

Go to the source code of this file.

Functions

int process_uint (t_sequence seq, int *fd, int total)
 Processes the unsigned integer specifier by printing the number in base 10.
 
static t_biggest signed_arg (va_list args, t_lenmod lenmod)
 Retrieves the next signed variable argument in the appropriate size dependent on the length modifier.
 
static t_ubiggest lltull (t_biggest n)
 Safely converts a signed integer to an unsigned one.
 
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.
 

Function Documentation

◆ lltull()

static t_ubiggest lltull ( t_biggest  n)
static

Safely converts a signed integer to an unsigned one.

Parameters
[in]n
Return values
t_ubiggestConverted integer

Definition at line 64 of file int.c.

References T_BIGGEST_MAX.

Here is the caller graph for this function:

◆ 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.

◆ process_uint()

int process_uint ( t_sequence  seq,
int *  fd,
int  total 
)

Processes the unsigned integer specifier by printing the number in base 10.

Parameters
[in]seq
[in]fd
[in]total(Unused)
Return values
intReturn value of u_print_base

Definition at line 36 of file uint.c.

References u_print_base().

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

◆ signed_arg()

static t_biggest signed_arg ( va_list  args,
t_lenmod  lenmod 
)
static

Retrieves the next signed variable argument in the appropriate size dependent on the length modifier.

For more info on the length modifiers, see ft_printf.c

Parameters
[in,out]args
[in]lenmod
Return values
t_biggestRetrieved value

Definition at line 39 of file int.c.

Here is the caller graph for this function: