[c5c522c] | 1 | /* $Id: list.h,v 1.10 2011/06/28 00:13:48 sbajic Exp $ */ |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | DSPAM |
---|
| 5 | COPYRIGHT (C) 2002-2012 DSPAM PROJECT |
---|
| 6 | |
---|
| 7 | This program is free software: you can redistribute it and/or modify |
---|
| 8 | it under the terms of the GNU Affero General Public License as |
---|
| 9 | published by the Free Software Foundation, either version 3 of the |
---|
| 10 | License, or (at your option) any later version. |
---|
| 11 | |
---|
| 12 | This program is distributed in the hope that it will be useful, |
---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | GNU Affero General Public License for more details. |
---|
| 16 | |
---|
| 17 | You should have received a copy of the GNU Affero General Public License |
---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #include <stdio.h> |
---|
| 23 | #include <string.h> |
---|
| 24 | #ifdef HAVE_UNISTD_H |
---|
| 25 | # include <unistd.h> |
---|
| 26 | #endif |
---|
| 27 | |
---|
| 28 | #ifndef _LIST_H |
---|
| 29 | #define _LIST_H |
---|
| 30 | |
---|
| 31 | struct bnr_list_node |
---|
| 32 | { |
---|
| 33 | void *ptr; /* Token name or pointer */ |
---|
| 34 | float value; /* Token value (probability) */ |
---|
| 35 | int eliminated; /* Token eliminated == 1 */ |
---|
| 36 | struct bnr_list_node *next; |
---|
| 37 | }; |
---|
| 38 | |
---|
| 39 | struct bnr_list |
---|
| 40 | { |
---|
| 41 | struct bnr_list_node *first; |
---|
| 42 | struct bnr_list_node *insert; /* Next insertion point */ |
---|
| 43 | int items; |
---|
| 44 | int nodetype; |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | struct bnr_list_c |
---|
| 48 | { |
---|
| 49 | struct bnr_list_node *iter_index; |
---|
| 50 | }; |
---|
| 51 | |
---|
| 52 | struct bnr_list_node *bnr_list_insert( |
---|
| 53 | struct bnr_list *list, |
---|
| 54 | void *data, float v); |
---|
| 55 | struct bnr_list_node *c_bnr_list_first( |
---|
| 56 | struct bnr_list *list, |
---|
| 57 | struct bnr_list_c *c); |
---|
| 58 | struct bnr_list_node *c_bnr_list_next( |
---|
| 59 | struct bnr_list *list, |
---|
| 60 | struct bnr_list_c *c); |
---|
| 61 | struct bnr_list * bnr_list_create (int node_type); |
---|
| 62 | void bnr_list_destroy(struct bnr_list *list); |
---|
| 63 | |
---|
| 64 | #endif /* _LIST_H */ |
---|
| 65 | |
---|