2 * Copyright 1993, 1995 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
8 * Copyright 2001-2004 David Abrahams.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
14 * lists.h - the LIST structure and routines to manipulate them
16 * The whole of jam relies on lists of strings as a datatype. This
17 * module, in conjunction with newstr.c, handles these relatively
22 * LIST - list of strings
27 * list_append() - append a list onto another one, returning total
28 * list_new() - tack a string onto the end of a list of strings
29 * list_copy() - copy a whole list of strings
30 * list_sublist() - copy a subset of a list of strings
31 * list_free() - free a list of strings
32 * list_print() - print a list of strings to stdout
33 * list_length() - return the number of items in the list
35 * lol_init() - initialize a LOL (list of lists)
36 * lol_add() - append a LIST onto an LOL
37 * lol_free() - free the LOL and its LISTs
38 * lol_get() - return one of the LISTs in the LOL
39 * lol_print() - debug print LISTS separated by ":"
41 * 04/13/94 (seiwald) - added shorthand L0 for null list pointer
42 * 08/23/94 (seiwald) - new list_append()
45 #ifndef LISTS_DWA20011022_H
46 # define LISTS_DWA20011022_H
53 * LIST - list of strings
56 typedef struct _list LIST;
60 LIST *tail; /* only valid in head node */
61 char *string; /* private copy */
68 typedef struct _lol LOL;
74 LIST *list[ LOL_MAX ];
77 LIST * list_append( LIST *l, LIST *nl );
78 LIST * list_copy( LIST *l, LIST *nl );
79 void list_free( LIST *head );
80 LIST * list_new( LIST *head, char *string );
81 void list_print( LIST *l );
82 int list_length( LIST *l );
83 LIST * list_sublist( LIST *l, int start, int count );
84 LIST * list_pop_front( LIST *l );
85 LIST * list_sort( LIST *l);
86 LIST * list_unique( LIST *sorted_list);
87 int list_in(LIST* l, char* value);
89 # define list_next( l ) ((l)->next)
91 # define L0 ((LIST *)0)
93 void lol_add( LOL *lol, LIST *l );
94 void lol_init( LOL *lol );
95 void lol_free( LOL *lol );
96 LIST * lol_get( LOL *lol, int i );
97 void lol_print( LOL *lol );
98 void lol_build( LOL* lol, char** elements );
102 PyObject *list_to_python(LIST *l);
103 LIST *list_from_python(PyObject *l);