Mescal
Loading...
Searching...
No Matches
type_dlist.h
Go to the documentation of this file.
1
6
7#ifndef DLIST_H_
8#define DLIST_H_
9
10 /* ____ _ _ _ _ _ _ _ _ _ */
11 /* | _ \ ___ _ _| |__ | |_ _ | (_)_ __ | | _____ __| | | (_)___| |_ ___ */
12 /* | | | |/ _ \| | | | '_ \| | | | | | | | '_ \| |/ / _ \/ _` | | | / __| __/__| */
13 /* | |_| | (_) | |_| | |_) | | |_| | | | | | | | < __/ (_| | | | \__ \ |_\__\ */
14 /* |____/ \___/ \__,_|_.__/|_|\__, | |_|_|_| |_|_|\_\___|\__,_| |_|_|___/\__|___/*/
15 /* |___/ */
16
17#include "alloc.h"
18#include "type_basic.h"
19#include <stdbool.h>
20#include <stdio.h>
21#include <stdlib.h>
22
27typedef struct dcell {
28 uint val;
30 struct dcell* next;
32 struct dcell* previous;
35
40typedef struct {
41 uint size;
44} dlist;
45
53dlist* create_dlist(void);
54
60);
61
67 dcell*,
68 int
69);
70
76 dcell*,
77 int
78);
79
85 dcell*
86);
87
95void concat_dlist(dlist*,
96 dlist*
97);
98
99#endif // DLIST_H_
Macros and functions to help memory allocation.
Type used to represent a single cell inside a doubly linked list.
Definition type_dlist.h:27
struct dcell * previous
Pointer to the previous cell (NULL if this is the left sentinel).
Definition type_dlist.h:32
struct dcell * next
Pointer to the next cell (NULL if this is the right sentinel).
Definition type_dlist.h:30
uint val
The value of the cell (not meaningful if the cell is a sentinel).
Definition type_dlist.h:28
Type used to represent a doubly linked list.
Definition type_dlist.h:40
uint size
Size of the list.
Definition type_dlist.h:41
dcell * lsent
A pointer to the left sentinel.
Definition type_dlist.h:42
dcell * rsent
A pointer to the right sentinel.
Definition type_dlist.h:43
Basic types.
void insertprevious_dlist(dlist *, dcell *, int)
Insertion of a new cell before a given one.
Definition type_dlist.c:58
void delete_dlist(dlist *)
Release of a list.
Definition type_dlist.c:23
void concat_dlist(dlist *, dlist *)
Merging of two lists.
Definition type_dlist.c:93
void insertnext_dlist(dlist *, dcell *, int)
Insertion of a new cell after a given one.
Definition type_dlist.c:41
void deletecell_dlist(dlist *, dcell *)
Release of a single cell.
Definition type_dlist.c:76
dlist * create_dlist(void)
Creation of an empty list.
Definition type_dlist.c:8