/*
   "ragmaan.h" - part of "RAGMAAN, een anagrammengenerator" 

   Copyright (C) 1999 Raymond Zandbergen

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   The maintainer of this program is Raymond Zandbergen (ray@wirehub.nl)
 */

#ifndef	RAGMAAN_H
#define	RAGMAAN_H
#define MAX_WORD_LENGTH (1000)	/* used for various temporary strings */
#define BLOCK_SIZE   (10240)	/* used when reading the database     */
#define NOF_HASH2_WORDS (1)	/* used for tuning the hash2-algo     */
#define NOF_HASH2_BITS  (32)	/* this should match HASH2_KEY_T size */
#define MAX_WORKING_SET (5000)	/* max # of anagrams to be shown      */
				/* (keep an eye on the cache size if  */
				/*  you increase this)                */

struct anagram_set_s
  {
    char target[MAX_WORD_LENGTH];
    char regexp[MAX_WORD_LENGTH];
    int nof_anagrams;
    int nof_filtered_anagrams;

    int seq;			

/* sequence number of search, used by cache */

    int cache_hit;		

/* if != 0 this set was the result of a cache hit   */

    int use_filter;
    int filtered_idx[MAX_WORKING_SET]; 

/* xlat table: incoming filtered idx to internal idx   */

    int use_reverse;
    int use_sort;
    int sort_valid;
    int sorted_idx[MAX_WORKING_SET];   

/* xlat table: incoming sorted idx to internal idx     */

    int use_filter_sort;
    int filter_sort_valid;
    int filtered_sorted_idx[MAX_WORKING_SET]; 

/* xlat table: ...            */

    char *anagram[MAX_WORKING_SET];    

/* all sub-anagrams of target         */

    char expansion[MAX_WORKING_SET];

/* contains '?', '+' , '-' or 'X'     */

    char regexp_match[MAX_WORKING_SET]; 

/* boolean array                    */

  };

typedef struct anagram_set_s anagram_set_t;

typedef void progress_callback_t (int progress);

  /*  used by time-consuming procs */

#endif
