blob: c443430220aeb5535c645ecfecdd2d4b262d88da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#ifndef __LIBADT_SLIST_H
#define __LIBADT_SLIST_H
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "debug.h"
#include "mmm.h"
//use stack memallocation features. need to make some changes in api
typedef struct ListNode
{
struct ListNode *next;
void *val;
} ListNode;
typedef struct List
{
int count;
ListNode *first;
ListNode *last;
} List;
struct List* llist_new();
struct ListNode* llist_newn( void* );
//#define __LLIST_NEW()
//#define __LLIST_NEWN()
int llist_length( struct List* );
int llist_index( struct List*, void* );
//llist_find( struct List );
//find by pointer
//find by value
void llist_reverse( struct List** );
void llist_append( struct List*, void* );
void llist_appendn( struct List**, void*, struct ListNode* );
//#define __LIST_APPEND()
void* llist_pop( struct List* );
void llist_push( struct List*, void* );
void llist_free( struct List* );
void llist_freen( struct ListNode* );
//void llist_merge( struct List**, struct List* );
//void llist_compare( struct List
//void llist_split( struct List*,
//void llist_splitn( struct List*, struct ListNode*
//void llist_splitp( struct List*, void*
//void llist_splitc( struct List*, void (*)(void*)
//void llist_sort(
//sort by pointer
//sort by value
#define llist_first(A) ((A)->first)
#define llist_last(A) ((A)->last)
//#define LLIST_FOREACH()
//#define LLIST_FOREACH_PREV()
//#define llist_islastn(A) ()
//#define llist_isfirstn(A) ()
//#define llist_getfirstn(A) ((A))
//#define llist_getlastn(A) ()
#endif
|