1 /***************************************************************************** 2 3 NAME: 4 tunelist.h -- definitions and prototypes of list structures for bogotune. 5 includes msglist_t, filelist_t, and tunelist_t. 6 7 ******************************************************************************/ 8 9 #ifndef TUNELIST_H 10 #define TUNELIST_H 11 12 #include "wordhash.h" 13 14 /***** msglist *****/ 15 16 typedef struct mlitem_s mlitem_t; 17 typedef struct msglist_s mlhead_t; 18 typedef struct wordprops_s wordprops_t; 19 20 struct msglist_s { /* message list header */ 21 char *name; 22 uint count; 23 mlitem_t *head; 24 mlitem_t *tail; 25 }; 26 27 struct mlitem_s { /* message list item */ 28 mlitem_t *next; 29 wordhash_t *wh; 30 wordprops_t *wp; 31 }; 32 33 struct wordprops_s { 34 uint count; 35 wordprop_t *wp; 36 }; 37 38 extern mlhead_t *msglist_new(const char *label); 39 extern void msglist_add(mlhead_t *list, wordhash_t *wh); 40 extern void msglist_print(mlhead_t *list); 41 extern void msglist_free(mlhead_t *list); 42 43 /***** filelist *****/ 44 45 typedef struct flitem_s flitem_t; 46 typedef struct flhead_s flhead_t; 47 48 struct flhead_s { /* file list header */ 49 char *name; 50 uint count; 51 flitem_t *head; 52 flitem_t *tail; 53 }; 54 55 struct flitem_s { /* file list item */ 56 flitem_t *next; 57 char *name; 58 }; 59 60 extern flhead_t *filelist_new(const char *name); 61 extern void filelist_add(flhead_t *list, const char *name); 62 extern void filelist_free(flhead_t *list); 63 64 /***** tunelist *****/ 65 66 typedef struct tunelist_s tunelist_t; 67 68 struct tunelist_s { 69 const char *name; 70 uint count; 71 wordhash_t *train; /* training */ 72 mlhead_t *msgs; 73 union { 74 mlhead_t *sets[3]; 75 struct runs { 76 mlhead_t *r0; 77 mlhead_t *r1; 78 mlhead_t *r2; 79 } r; 80 } u; 81 }; 82 83 uint count_messages(tunelist_t *list); 84 tunelist_t *tunelist_new(const char *label); 85 void tunelist_print(tunelist_t *list); 86 void tunelist_free(tunelist_t *list); 87 #endif 88