2 * Copyright 1993, 1995 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
8 * lists.h - the LIST structure and routines to manipulate them
10 * The whole of jam relies on lists of strings as a datatype. This
11 * module, in conjunction with newstr.c, handles these relatively
16 * LIST - list of strings
21 * list_append() - append a list onto another one, returning total
22 * list_new() - tack a string onto the end of a list of strings
23 * list_copy() - copy a whole list of strings
24 * list_sublist() - copy a subset of a list of strings
25 * list_free() - free a list of strings
26 * list_print() - print a list of strings to stdout
27 * list_printq() - print a list of safely quoted strings to a file
28 * list_length() - return the number of items in the list
30 * lol_init() - initialize a LOL (list of lists)
31 * lol_add() - append a LIST onto an LOL
32 * lol_free() - free the LOL and its LISTs
33 * lol_get() - return one of the LISTs in the LOL
34 * lol_print() - debug print LISTS separated by ":"
36 * 04/13/94 (seiwald) - added shorthand L0 for null list pointer
37 * 08/23/94 (seiwald) - new list_append()
38 * 10/22/02 (seiwald) - list_new() now does its own newstr()/copystr()
39 * 11/04/02 (seiwald) - const-ing for string literals
40 * 12/09/02 (seiwald) - new list_printq() for writing lists to Jambase
44 * LIST - list of strings
47 typedef struct _list LIST
;
51 LIST
*tail
; /* only valid in head node */
52 const char *string
; /* private copy */
60 typedef struct _lol LOL
;
70 LIST
*list_append (LIST
*l
, LIST
*nl
);
71 LIST
*list_copy (LIST
*l
, LIST
*nl
);
72 void list_free (LIST
*head
);
73 LIST
*list_new (LIST
*head
, const char *string
, int copy
);
74 void list_print (LIST
*l
);
75 int list_length (LIST
*l
);
76 LIST
*list_sublist (LIST
*l
, int start
, int count
);
77 LIST
*list_sort (LIST
*l
);
79 # define list_next( l ) ((l)->next)
81 # define L0 ((LIST *)0)
83 void lol_add (LOL
*lol
, LIST
*l
);
84 void lol_init (LOL
*lol
);
85 void lol_free (LOL
*lol
);
86 LIST
*lol_get (LOL
*lol
, int i
);
87 void lol_print (LOL
*lol
);