Corewar documentation 1.0.0
Loading...
Searching...
No Matches
mylist.h File Reference

The header file of the libmylist. More...

#include "my.h"

Go to the source code of this file.

Data Structures

struct  node_s
 

Typedefs

typedef enum type type_t
 
typedef struct node_s node_t
 

Enumerations

enum  type {
  SHORT_SHORT , SHORT , INT , LONG ,
  LONG_LONG , UNSIGNED_SHORT , UNSIGNED_SHORT_SHORT , UNSIGNED_INT ,
  UNSIGNED_LONG , UNSIGNED_LONG_LONG , SIZE_T , FLOAT ,
  DOUBLE , CHAR , STRING , ARRAY_OF_STRING ,
  VOID , UNKNOWN
}
 

Functions

void my_push_front (node_t **begin, void *data, type_t type)
 Adds a node at the beginning of the list.
 
void my_push_back (node_t **begin, void *data, type_t type)
 Adds a node at the end of the list.
 
int my_delete_nodes (node_t **begin, void const *data_ref, int(*cmp)())
 Deletes nodes from a linked list.
 
void my_delete_list (node_t **begin)
 Deletes the linked list.
 
node_tmy_pop_front (node_t **begin)
 Removes the first node of the list.
 
node_tmy_pop_back (node_t **begin)
 Removes the last node of the list.
 
node_tmy_pop_node (node_t **begin, void const *data_ref, int(*cmp)())
 Removes a node from the list.
 
void my_push_back_circled (node_t **begin, void *data, type_t type)
 Adds a node at the beginning of the circular linked list.
 
int my_list_size_circled (node_t const *begin)
 Adds a node at the end of the circular linked list.
 
void ** my_list_to_array_circled (node_t **list)
 Converts the circular linked list to an array.
 
void my_delete_circle_list (node_t **begin)
 Deletes a circular linked list.
 
void my_show_list (node_t *list)
 Displays the linked list.
 
int my_list_size (node_t const *begin)
 Returns the size of the linked list.
 
void my_rev_list (node_t **begin)
 Reverses the linked list.
 
node_tmy_find_node (node_t const *begin, void const *data, int(*cmp)())
 Finds a node in the linked list.
 
void my_concat_list (node_t **begin1, node_t *begin2)
 Concatenates two linked lists.
 
void my_sort_list (node_t **begin, int(*cmp)())
 Sorts the linked list.
 
void my_merge_list (node_t **begin1, node_t *begin2, int(*cmp)())
 Merges two linked lists.
 
void ** my_list_to_array (node_t *list)
 Converts the linked list to an array.
 
node_tmy_params_to_list (int ac, char *const *av)
 Creates a linked list from the arguments (argc and argv)
 
node_tmy_previous_to_next (node_t **head, node_t *to_delete)
 Skip a node in a linked list and change the previous node to the next node.
 

Detailed Description

The header file of the libmylist.

Author
Nicolas TORO

Function Documentation

◆ my_concat_list()

void my_concat_list ( node_t ** begin1,
node_t * begin2 )

Concatenates two linked lists.

Parameters
begin1The beginning of the first list
begin2The beginning of the second list
Returns
void
Author
Nicolas TORO

◆ my_delete_circle_list()

void my_delete_circle_list ( node_t ** begin)

Deletes a circular linked list.

Parameters
beginThe beginning of the list
Returns
void
Parameters
beginThe beginning of the list
Returns
void

◆ my_delete_list()

void my_delete_list ( node_t ** begin)

Deletes the linked list.

Parameters
beginThe beginning of the list
Returns
void
Author
Nicolas TORO

◆ my_delete_nodes()

int my_delete_nodes ( node_t ** begin,
void const * data_ref,
int(* cmp )() )

Deletes nodes from a linked list.

Parameters
beginThe beginning of the list
data_refThe data to delete
cmpThe comparison function
Returns
int The number of nodes deleted from the list
Author
Nicolas TORO

◆ my_find_node()

node_t * my_find_node ( node_t const * begin,
void const * data,
int(* cmp )() )

Finds a node in the linked list.

Parameters
beginThe beginning of the list
dataThe data to find
cmpThe comparison function
Returns
node_t * The node found in the list
Author
Nicolas TORO

◆ my_list_size()

int my_list_size ( node_t const * begin)

Returns the size of the linked list.

Parameters
beginThe beginning of the list
Returns
int The size of the list
Author
Nicolas TORO

◆ my_list_size_circled()

int my_list_size_circled ( node_t const * begin)

Adds a node at the end of the circular linked list.

Parameters
beginThe beginning of the list
dataThe data to add
typeThe type of the data
Returns
void

◆ my_list_to_array()

void ** my_list_to_array ( node_t * list)

Converts the linked list to an array.

Parameters
listThe linked list to convert
Returns
void ** The array created from the linked list
Author
Nicolas TORO

◆ my_list_to_array_circled()

void ** my_list_to_array_circled ( node_t ** list)

Converts the circular linked list to an array.

Parameters
listThe circular linked list to convert
Returns
void ** The array created from the circular linked list

◆ my_merge_list()

void my_merge_list ( node_t ** begin1,
node_t * begin2,
int(* cmp )() )

Merges two linked lists.

Parameters
begin1The beginning of the first list
begin2The beginning of the second list
cmpThe comparison function
Returns
void
Author
Nicolas TORO

◆ my_params_to_list()

node_t * my_params_to_list ( int ac,
char *const * av )

Creates a linked list from the arguments (argc and argv)

Parameters
acThe number of arguments
avThe array of arguments
Returns
node_t * The linked list created from the array of strings
Author
Nicolas TORO

◆ my_pop_back()

node_t * my_pop_back ( node_t ** begin)

Removes the last node of the list.

Parameters
beginThe beginning of the list
Returns
node_t * The last node of the list
Author
Nicolas TORO

◆ my_pop_front()

node_t * my_pop_front ( node_t ** begin)

Removes the first node of the list.

Parameters
beginThe beginning of the list
Returns
node_t * The first node of the list
Author
Nicolas TORO

◆ my_pop_node()

node_t * my_pop_node ( node_t ** begin,
void const * data_ref,
int(* cmp )() )

Removes a node from the list.

Parameters
beginThe beginning of the list
data_refThe data to remove
cmpThe comparison function
Returns
node_t * The node removed from the list
Author
Nicolas TORO

◆ my_previous_to_next()

node_t * my_previous_to_next ( node_t ** head,
node_t * to_delete )

Skip a node in a linked list and change the previous node to the next node.

Parameters
headThe beginning of the list
to_deleteThe node to skip
Returns
node_t * The to_delete node
Author
Gianni TUERO

◆ my_push_back()

void my_push_back ( node_t ** begin,
void * data,
type_t type )

Adds a node at the end of the list.

Parameters
beginThe beginning of the list
dataThe data to add
typeThe type of the data
Returns
void
Author
Nicolas TORO

◆ my_push_back_circled()

void my_push_back_circled ( node_t ** begin,
void * data,
type_t type )

Adds a node at the beginning of the circular linked list.

Parameters
beginThe beginning of the list
dataThe data to add
typeThe type of the data
Returns
void

◆ my_push_front()

void my_push_front ( node_t ** begin,
void * data,
type_t type )

Adds a node at the beginning of the list.

Parameters
beginThe beginning of the list
dataThe data to add
typeThe type of the data
Returns
void
Author
Nicolas TORO

◆ my_rev_list()

void my_rev_list ( node_t ** begin)

Reverses the linked list.

Parameters
beginThe beginning of the list
Returns
void
Author
Nicolas TORO

◆ my_show_list()

void my_show_list ( node_t * list)

Displays the linked list.

Parameters
listThe linked list to display
Returns
void
Author
Nicolas TORO

◆ my_sort_list()

void my_sort_list ( node_t ** begin,
int(* cmp )() )

Sorts the linked list.

Parameters
beginThe beginning of the list
cmpThe comparison function
Returns
void
Author
Nicolas TORO