2 stringlist.h - MaLa stringlists
4 Copyright (C) 2004, 2005, Christian Thaeter <chth@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact me.
20 #ifndef MALA_STRINGLIST_H
21 #define MALA_STRINGLIST_H
23 #include "mala_types.h"
39 struct mala_stringlistnode_struct
41 CIRCLEQ_ENTRY(mala_stringlistnode_struct
) node
;
47 mala_stringlist_new ();
50 mala_stringlist_new_cstrs_bucket (const char **cstrs
,
52 MalaStringBucket bucket
);
55 mala_stringlist_erase (MalaStringList head
);
58 mala_stringlist_free (MalaStringList head
);
61 mala_stringlist_head_new (MalaStringList head
, MalaString str
);
64 mala_stringlist_tail_new (MalaStringList head
, MalaString str
);
67 mala_stringlist_after_new (MalaStringList head
,
68 MalaStringListNode pred
,
72 mala_stringlist_elem_remove (MalaStringList head
,
73 MalaStringListNode elem
);
76 mala_stringlist_elem_delete (MalaStringList head
, MalaStringListNode_ref elem
);
81 static inline int mala_stringlist_insert_before (MalaStringList head,
82 MalaStringListNode succ,
83 MalaStringListNode elem);
84 static inline int mala_stringlist_insert_head (MalaStringList head, MalaStringListNode elem);
85 static inline int mala_stringlist_insert_tail (MalaStringList head, MalaStringListNode elem);
88 static inline int mala_stringlist_new_after (MalaStringList head,
89 MalaStringListNode pred,
91 static inline int mala_stringlist_new_before (MalaStringList head,
92 MalaStringListNode succ,
97 static inline MalaStringListNode mala_stringlist_head_new_cstr (MalaStringList head,
99 static inline MalaStringListNode mala_stringlist_tail_new_cstr (MalaStringList head,
109 mala_stringlist_insert_after (MalaStringList head
,
110 MalaStringListNode pred
,
114 CIRCLEQ_INSERT_AFTER(head
, TYPE
*listelm
, TYPE
*elm
, CIRCLEQ_ENTRY NAME
);
118 mala_stringlist_insert_before (MalaStringList head
,
119 MalaStringListNode succ
,
122 CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD
*head
, TYPE
*listelm
, TYPE
*elm
, CIRCLEQ_ENTRY NAME
);
125 mala_stringlist_insert_head (MalaStringList head
, MalaString str
)
126 CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD
*head
, TYPE
*elm
, CIRCLEQ_ENTRY NAME
);
129 mala_stringlist_insert_tail (MalaStringList head
, MalaString str
)
130 CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD
*head
, TYPE
*elm
, CIRCLEQ_ENTRY NAME
);
136 #endif /* MALA_STRINGLIST_H */
141 // c-file-style: "gnu"
143 // arch-tag: 44b2b6d9-80b8-43fa-938a-a492bd52cea2