Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563520 views
1
#ifdef __cplusplus
2
extern "C" {
3
#endif
4
5
6
#ifndef _LINUX_LIST_H
7
#define _LINUX_LIST_H
8
9
/*
10
* Simple doubly linked list implementation.
11
*
12
* Some of the internal functions ("__xxx") are useful when
13
* manipulating whole lists rather than single entries, as
14
* sometimes we already know the next/prev entries and we can
15
* generate better code by using them directly rather than
16
* using the generic single-entry routines.
17
*/
18
19
struct list_head {
20
struct list_head *next, *prev;
21
};
22
23
#define LIST_HEAD(name) \
24
struct list_head name = { &name, &name }
25
26
#define INIT_LIST_HEAD(ptr) do { \
27
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
28
} while (0)
29
30
#ifdef GCC
31
32
/*
33
* Insert a new entry between two known consecutive entries.
34
*
35
* This is only for internal list manipulation where we know
36
* the prev/next entries already!
37
*/
38
static __inline__ void __list_add(struct list_head * new,
39
struct list_head * prev,
40
struct list_head * next)
41
{
42
next->prev = new;
43
new->next = next;
44
new->prev = prev;
45
prev->next = new;
46
}
47
48
/*
49
* Insert a new entry after the specified head..
50
*/
51
static __inline__ void list_add(struct list_head *new, struct list_head *head)
52
{
53
__list_add(new, head, head->next);
54
}
55
56
/*
57
* Delete a list entry by making the prev/next entries
58
* point to each other.
59
*
60
* This is only for internal list manipulation where we know
61
* the prev/next entries already!
62
*/
63
static __inline__ void __list_del(struct list_head * prev,
64
struct list_head * next)
65
{
66
next->prev = prev;
67
prev->next = next;
68
}
69
70
static __inline__ void list_del(struct list_head *entry)
71
{
72
__list_del(entry->prev, entry->next);
73
}
74
75
static __inline__ int list_empty(struct list_head *head)
76
{
77
return head->next == head;
78
}
79
80
/*
81
* Splice in "list" into "head"
82
*/
83
static __inline__ void list_splice(struct list_head *list, struct list_head *head)
84
{
85
struct list_head *first = list->next;
86
87
if (first != list) {
88
struct list_head *last = list->prev;
89
struct list_head *at = head->next;
90
91
first->prev = head;
92
head->next = first;
93
94
last->next = at;
95
at->prev = last;
96
}
97
}
98
99
#define list_entry(ptr, type, member) \
100
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
101
102
#endif
103
#endif
104
105
106
#ifdef __cplusplus
107
}
108
#endif
109
110
111