dvitomp fix from Akira
[mplib] / src / texk / kpathsea / str-llist.h
1 /* str-llist.h: a linked list of strings,
2
3    It's pretty sad that both this and str-list exist; the reason is
4    that C cannot express iterators very well, and I don't want to change
5    all the for loops.
6
7    Copyright 1993, 1994, 2008 Karl Berry.
8
9    This library is free software; you can redistribute it and/or
10    modify it under the terms of the GNU Lesser General Public
11    License as published by the Free Software Foundation; either
12    version 2.1 of the License, or (at your option) any later version.
13
14    This library is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17    Lesser General Public License for more details.
18
19    You should have received a copy of the GNU Lesser General Public License
20    along with this library; if not, see <http://www.gnu.org/licenses/>.  */
21
22 #ifndef STR_LLIST_H
23 #define STR_LLIST_H
24
25 #include <kpathsea/c-proto.h>
26 #include <kpathsea/types.h>
27
28
29 /* It's a little bizarre to be using the same type for the list and the
30    elements of the list, but no reason not to in this case, I think --
31    we never need a NULL string in the middle of the list, and an extra
32    NULL/NULL element always at the end is inconsequential.  */
33
34 struct str_llist_elt
35 {
36   string str;
37   boolean moved;
38   struct str_llist_elt *next;
39 };
40 typedef struct str_llist_elt str_llist_elt_type;
41 typedef struct str_llist_elt *str_llist_type;
42
43 #define STR_LLIST(sl) ((sl).str)
44 #define STR_LLIST_MOVED(sl) ((sl).moved)
45 #define STR_LLIST_NEXT(sl) ((sl).next)
46
47
48 /* Add the new string E to the end of the list L.  */
49 extern void str_llist_add P2H(str_llist_type *l, string e);
50
51 /* Reorganize L so that E is below only other elements that have already
52    been moved.  Set `moved' member for E.  */
53 extern void str_llist_float P2H(str_llist_type *l, str_llist_elt_type *e);
54
55 #endif /* not STR_LLIST_H */