underscore expansion
[mala.git] / engine / stringlist.h
blob99bbbcf65515996794a9c83c98a40b8ea628843d
1 /*
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"
24 #include "strings.h"
28 #include <string.h>
29 #include <stdint.h>
30 #include <search.h>
31 #include <stdlib.h>
33 //#include "engine.h"
36 * StringList
39 struct mala_stringlistnode_struct
41 CIRCLEQ_ENTRY(mala_stringlistnode_struct) node;
42 MalaString string;
46 MalaStringList
47 mala_stringlist_new ();
49 MalaStringList
50 mala_stringlist_new_cstrs_bucket (const char **cstrs,
51 ssize_t nelem,
52 MalaStringBucket bucket);
54 void
55 mala_stringlist_erase (MalaStringList head);
57 void
58 mala_stringlist_free (MalaStringList head);
60 MalaStringListNode
61 mala_stringlist_head_new (MalaStringList head, MalaString str);
63 MalaStringListNode
64 mala_stringlist_tail_new (MalaStringList head, MalaString str);
66 MalaStringListNode
67 mala_stringlist_after_new (MalaStringList head,
68 MalaStringListNode pred,
69 MalaString str);
71 MalaStringListNode
72 mala_stringlist_elem_remove (MalaStringList head,
73 MalaStringListNode elem);
75 void
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,
90 MalaString str);
91 static inline int mala_stringlist_new_before (MalaStringList head,
92 MalaStringListNode succ,
93 MalaString str);
97 static inline MalaStringListNode mala_stringlist_head_new_cstr (MalaStringList head,
98 const char * cstr);
99 static inline MalaStringListNode mala_stringlist_tail_new_cstr (MalaStringList head,
100 const char * cstr);
105 * Inlines
107 #if 0
108 static inline void
109 mala_stringlist_insert_after (MalaStringList head,
110 MalaStringListNode pred,
111 MalaString str)
114 CIRCLEQ_INSERT_AFTER(head, TYPE *listelm, TYPE *elm, CIRCLEQ_ENTRY NAME);
117 static inline void
118 mala_stringlist_insert_before (MalaStringList head,
119 MalaStringListNode succ,
120 MalaString str)
122 CIRCLEQ_INSERT_BEFORE(CIRCLEQ_HEAD *head, TYPE *listelm, TYPE *elm, CIRCLEQ_ENTRY NAME);
124 static inline void
125 mala_stringlist_insert_head (MalaStringList head, MalaString str)
126 CIRCLEQ_INSERT_HEAD(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);
128 static inline void
129 mala_stringlist_insert_tail (MalaStringList head, MalaString str)
130 CIRCLEQ_INSERT_TAIL(CIRCLEQ_HEAD *head, TYPE *elm, CIRCLEQ_ENTRY NAME);
133 #endif
136 #endif /* MALA_STRINGLIST_H */
139 // Local Variables:
140 // mode: C
141 // c-file-style: "gnu"
142 // End:
143 // arch-tag: 44b2b6d9-80b8-43fa-938a-a492bd52cea2
144 // end_of_file