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 */
59 typedef struct _lol LOL
;
65 LIST
*list
[ LOL_MAX
];
68 LIST
* list_append( LIST
*l
, LIST
*nl
);
69 LIST
* list_copy( LIST
*l
, LIST
*nl
);
70 void list_free( LIST
*head
);
71 LIST
* list_new( LIST
*head
, const char *string
, int copy
);
72 void list_print( LIST
*l
);
73 int list_length( LIST
*l
);
74 LIST
* list_sublist( LIST
*l
, int start
, int count
);
76 # define list_next( l ) ((l)->next)
78 # define L0 ((LIST *)0)
80 void lol_add( LOL
*lol
, LIST
*l
);
81 void lol_init( LOL
*lol
);
82 void lol_free( LOL
*lol
);
83 LIST
* lol_get( LOL
*lol
, int i
);
84 void lol_print( LOL
*lol
);