GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#ifdef __cplusplus1extern "C" {2#endif345#ifndef _LINUX_LIST_H6#define _LINUX_LIST_H78/*9* Simple doubly linked list implementation.10*11* Some of the internal functions ("__xxx") are useful when12* manipulating whole lists rather than single entries, as13* sometimes we already know the next/prev entries and we can14* generate better code by using them directly rather than15* using the generic single-entry routines.16*/1718struct list_head {19struct list_head *next, *prev;20};2122#define LIST_HEAD(name) \23struct list_head name = { &name, &name }2425#define INIT_LIST_HEAD(ptr) do { \26(ptr)->next = (ptr); (ptr)->prev = (ptr); \27} while (0)2829#ifdef GCC3031/*32* Insert a new entry between two known consecutive entries.33*34* This is only for internal list manipulation where we know35* the prev/next entries already!36*/37static __inline__ void __list_add(struct list_head * new,38struct list_head * prev,39struct list_head * next)40{41next->prev = new;42new->next = next;43new->prev = prev;44prev->next = new;45}4647/*48* Insert a new entry after the specified head..49*/50static __inline__ void list_add(struct list_head *new, struct list_head *head)51{52__list_add(new, head, head->next);53}5455/*56* Delete a list entry by making the prev/next entries57* point to each other.58*59* This is only for internal list manipulation where we know60* the prev/next entries already!61*/62static __inline__ void __list_del(struct list_head * prev,63struct list_head * next)64{65next->prev = prev;66prev->next = next;67}6869static __inline__ void list_del(struct list_head *entry)70{71__list_del(entry->prev, entry->next);72}7374static __inline__ int list_empty(struct list_head *head)75{76return head->next == head;77}7879/*80* Splice in "list" into "head"81*/82static __inline__ void list_splice(struct list_head *list, struct list_head *head)83{84struct list_head *first = list->next;8586if (first != list) {87struct list_head *last = list->prev;88struct list_head *at = head->next;8990first->prev = head;91head->next = first;9293last->next = at;94at->prev = last;95}96}9798#define list_entry(ptr, type, member) \99((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))100101#endif102#endif103104105#ifdef __cplusplus106}107#endif108109110111