/* TESTING, REMOVE THIS!!!!

  #define HIST64 1

*/

#ifdef HIST64
typedef union {__int64 whole; unsigned int part[2];} h_both;
typedef __int64  h_type;
#define HWORDS 4
#else
typedef unsigned int h_type;
#define HWORDS 3
#endif




typedef struct HPNT {h_type pnt; int match; struct HPNT *next; int page;} Hpnt;
#define HSZ (sizeof(Hpnt)/4)
int hist_date_posted(char *rec);
void hist_delete(void);
void hist_reload(void);
void hist_catchup(void);
int mid_isok(char *s);
void hist_analyze(void);
char *hist_mid(char *line);
int hist_gotit2(char *msgid, int chan);
int hist_freechan(int chan);
void hist_check(char *s);
void hist_corrupt(void);
int hist_gotit(char *msgid);
void hist_set_test(int x);
int hist_hash(char *s, int max, int *match);
String *hist_status(void);
h_type hist_upto(void);
int hist_add(char *mid, char *s_posted, char *s_expires, char *grps);
int hist_add_fix(char *mid, char *s_posted, char *s_expires, char *grps);
void hist_flush(void);
char *hist_status_s(void);
int hist_diskspace(void);
void hist_append(char *s);
int hist_open(char *fname,int mode, int isread);
int hist_ispage(void);
int hist_open_read(char *fname);
int hist_open_write(char *fname);
int hist_init(void);
h_type hist_current_size(void);
void hist_setsize(int x);  /* Call this if we are taking a full feed */
void hist_addidx(char *msgid, h_type offset); 
int hist_addone(Hpnt **hptr, h_type offset, int match, int page);
int hist_find(char *msgid, int *grp, int *num);
char *hist_exists(char *msgid);
char *hist_line(h_type h); /* Ugly, reads until EOL */
char *hist_line_multi(Hpnt *h);
char *hist_next(void);  /*Read the next line, and return NULL on EOF */
char *hist_next_multi(int file);
char *hist_line2(h_type h); /* Ugly, reads until two EOL's so it's got a whole record*/
char * hist_after(int date);
int hist_date_expires(char *rec);  /*Second date, zero if is '-' */
int hist_date_arrived(char *rec);
char *hist_groupfirst(char *rec);
char *hist_groupnext(void);
int hist_groupnextnum(void);
char * hist_gname(char *rec, int g); /* Return group and num */
int hist_group(char *s,int n);
int hist_num(char *s,int g);
int hist_writenew(char *s);

void hist_close(void);
void hist_close_multi(int file);

int hnew_write(char *s);
void hnew_close(void);
void hnew_idx_add(int a, h_type b, int c);
void hist_idx_add(int a, h_type b, int c, int d);
void hnew_idx_flush(void);

int hist_idx_read(h_type sz);
void hist_switch(void);
void hist_idx_flush(void);
void hist_rebuild(void);
int hist_setfast(void);

int hist_guess_file_order(void);


/*RHP missing prototype*/
int hist_stress(void);

int hist_test_consist;