1 #ifndef LIST_H_INCLUDED
2 #define LIST_H_INCLUDED
3 #define LIST_H_VERSION "$Id: list.h,v 1.5 2001/07/29 18:43:08 jongfoster Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/list.h,v $
8 * Purpose : Declares functions to handle lists.
9 * Functions declared include:
10 * `destroy_list', `enlist' and `list_to_text'
12 * Copyright : Written by and Copyright (C) 2001 the SourceForge
13 * IJBSWA team. http://ijbswa.sourceforge.net
15 * Based on the Internet Junkbuster originally written
16 * by and Copyright (C) 1997 Anonymous Coders and
17 * Junkbusters Corporation. http://www.junkbusters.com
19 * This program is free software; you can redistribute it
20 * and/or modify it under the terms of the GNU General
21 * Public License as published by the Free Software
22 * Foundation; either version 2 of the License, or (at
23 * your option) any later version.
25 * This program is distributed in the hope that it will
26 * be useful, but WITHOUT ANY WARRANTY; without even the
27 * implied warranty of MERCHANTABILITY or FITNESS FOR A
28 * PARTICULAR PURPOSE. See the GNU General Public
29 * License for more details.
31 * The GNU General Public License should be included with
32 * this file. If not, you can view it at
33 * http://www.gnu.org/copyleft/gpl.html
34 * or write to the Free Software Foundation, Inc., 59
35 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39 * Revision 1.5 2001/07/29 18:43:08 jongfoster
40 * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
43 * Revision 1.4 2001/06/29 13:30:37 oes
44 * - Introduced enlist_unique_header()
45 * - Removed logentry from cancelled commit
47 * Revision 1.3 2001/06/03 11:03:48 oes
48 * introduced functions for new list type "map": map(), lookup(),
49 * free_map(), and extended enlist_unique
51 * Revision 1.2 2001/06/01 18:49:17 jongfoster
52 * Replaced "list_share" with "list" - the tiny memory gain was not
53 * worth the extra complexity.
55 * Revision 1.1 2001/05/31 21:11:53 jongfoster
56 * - Moved linked list support to new "list.c" file.
57 * Structure definitions are still in project.h,
58 * function prototypes are now in "list.h".
59 * - Added support for "struct list_share", which is identical
60 * to "struct list" except it saves memory by not duplicating
61 * the strings. Obviously, this only works if there is some
62 * other way of managing the memory used by the strings.
63 * (These list_share lists are used for lists which last
64 * for only 1 request, and where all the list entries are
65 * just coming directly from entries in the actionsfile.)
66 * Note that you still need to destroy list_share lists
67 * properly to free the nodes - it's only the strings
71 *********************************************************************/
81 extern void enlist(struct list *h, const char *s);
82 extern void enlist_unique(struct list *header, const char *str, int n);
83 extern void enlist_unique_header(struct list *header, const char *name, const char *value);
84 extern void enlist_first(struct list *header, const char *str);
86 extern int list_remove_item(struct list *header, const char *str);
88 extern void list_append_list_unique(struct list *dest, const struct list *src);
89 extern void list_append_list_unique(struct list *dest, const struct list *src);
90 extern int list_remove_list(struct list *header, const struct list *to_remove);
92 extern void list_duplicate(struct list *dest, const struct list *src);
94 extern void destroy_list(struct list *h);
95 extern char *list_to_text(struct list *h);
97 extern struct map *new_map(void);
98 extern void free_map(struct map *list);
99 extern void map(struct map* map, const char *name, int nc, const char *value, int vc);
100 extern const char *lookup(const struct map *list, const char *name);
102 /* Revision control strings from this header and associated .c file */
103 extern const char list_rcs[];
104 extern const char list_h_rcs[];
110 #endif /* ndef LIST_H_INCLUDED */