Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tesh version 2
[simgrid.git] / tools / tesh2 / include / lstrings.h
1 #ifndef __lstrings_H
2 #define __lstrings_H
3
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #ifndef SEEK_SET
10 #define SEEK_SET                                0
11 #endif 
12
13 #ifndef SEEK_CUR
14 #define SEEK_CUR                                1
15 #endif
16
17 #ifndef SEEK_END
18 #define SEEK_END                                2
19 #endif
20
21 #ifndef __LINK_T_DEFINED
22 typedef struct s_link_t
23 {
24         void* item;                                             /* the item associated with the link                                                            */
25         struct s_link_t* next;                  /* address to the next link                                                                                     */
26         struct s_link_t* prev;                  /* address to the prev link                                                                                     */
27 }s_link_t,* link_t;
28 #define __LINK_T_DEFINED
29 #endif
30
31 typedef struct s_lstrings
32 {
33         const char* item;                               /* not used                                                                                                                     */      
34         link_t next;                                    /* point to the last node of the lstrings                                               */
35         link_t prev;                                    /* point to the first node of the lstrings                                              */
36         int size;                                               /* the number of node contained by the lstrings                                 */
37         link_t cur;
38         int pos;
39 }s_lstrings_t,* lstrings_t;
40
41 lstrings_t
42 lstrings_new(void);
43
44 int
45 lstrings_rewind(lstrings_t lstrings);
46
47 int
48 lstrings_unwind(lstrings_t lstrings);
49
50 int
51 lstrings_clear(lstrings_t lstrings);
52
53 int
54 lstrings_free(lstrings_t* lstrings_ptr);
55
56 int
57 lstrings_push_front(lstrings_t lstrings, const char* string);
58
59 int
60 lstrings_push_back(lstrings_t lstrings, const char* string);
61
62 const char*
63 lstrings_pop_back(lstrings_t lstrings);
64
65 const char*
66 lstrings_pop_front(lstrings_t lstrings);
67
68 int
69 lstrings_remove(lstrings_t lstrings, const char* string);
70
71 int
72 lstrings_get_size(lstrings_t lstrings);
73 int
74 lstrings_contains(lstrings_t lstrings, const char* string);
75
76 int
77 lstrings_is_empty(lstrings_t lstrings);
78
79 int
80 lstrings_move_next(lstrings_t lstrings);
81
82 const char*
83 lstrings_get(lstrings_t lstrings);
84
85 const char*
86 lstrings_set(lstrings_t lstrings, const char* string);
87
88 const char*
89 lstrings_get_at(lstrings_t lstrings, int pos);
90
91 const char*
92 lstrings_set_at(lstrings_t lstrings, int pos, const char* string);
93
94 int
95 lstrings_move_prev(lstrings_t lstrings);
96
97 int
98 lstrings_seek(lstrings_t lstrings, int offset, int whence);
99
100 int
101 lstrings_tell(lstrings_t lstrings);
102
103 int
104 lstrings_getpos(lstrings_t lstrings, int* pos);
105
106 int
107 lstrings_setpos(lstrings_t lstrings, int pos);
108
109 const char*
110 lstrings_get_front(lstrings_t lstrings);
111
112 const char*
113 lstrings_get_back(lstrings_t lstrings);
114
115 int 
116 lstrings_insert_after(lstrings_t lstrings, const char* what, const char* where);
117
118 int 
119 lstrings_insert_before(lstrings_t lstrings, const char* what, const char* where);
120
121 char**
122 lstrings_to_cstr(lstrings_t lstrings);
123
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129
130 #endif /* !__lstrings_H */