Mescal
Loading...
Searching...
No Matches
type_dlist.h File Reference

Implementation of doubly linked lists. More...

#include "alloc.h"
#include "type_basic.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  dcell
 Type used to represent a single cell inside a doubly linked list. More...
 
struct  dlist
 Type used to represent a doubly linked list. More...
 

Typedefs

typedef struct dcell dcell
 Type used to represent a single cell inside a doubly linked list.
 

Functions

dlistcreate_dlist (void)
 Creation of an empty list.
 
void delete_dlist (dlist *)
 Release of a list.
 
void insertnext_dlist (dlist *, dcell *, int)
 Insertion of a new cell after a given one.
 
void insertprevious_dlist (dlist *, dcell *, int)
 Insertion of a new cell before a given one.
 
void deletecell_dlist (dlist *, dcell *)
 Release of a single cell.
 
void concat_dlist (dlist *, dlist *)
 Merging of two lists.
 

Detailed Description

Implementation of doubly linked lists.

Function Documentation

◆ concat_dlist()

void concat_dlist ( dlist * l1,
dlist * l2 )

Merging of two lists.

Remarks
The merge is done in the first list. The second list is released.
Parameters
l1The first list.
l2The second list.

◆ create_dlist()

dlist * create_dlist ( void )

Creation of an empty list.

Returns
The empty list.

◆ delete_dlist()

void delete_dlist ( dlist * p)

Release of a list.

Parameters
pThe list.

◆ deletecell_dlist()

void deletecell_dlist ( dlist * p,
dcell * c )

Release of a single cell.

Parameters
pThe list.
cThe cell.

◆ insertnext_dlist()

void insertnext_dlist ( dlist * p,
dcell * c,
int newval )

Insertion of a new cell after a given one.

Parameters
pThe list.
cThe cell.
newvalThe value of the new cell.

◆ insertprevious_dlist()

void insertprevious_dlist ( dlist * p,
dcell * c,
int newval )

Insertion of a new cell before a given one.

Parameters
pThe list.
cThe cell.
newvalThe value of the new cell.