/************************************************************************** * * mgpp_perf_hash_build.cpp -- Program to build a perfect hash function * Copyright (C) 1999 Rodger McNab * * 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. * **************************************************************************/ #define _XOPEN_SOURCE 1 // This was added for Solaris, but it makes things worse on Solaris for me... // #define _XOPEN_SOURCE_EXTENDED 1 // need this to avoid bizarre compiler problems under VC++ 6.0 #if defined (__WIN32__) && !defined (GSDL_USE_IOS_H) # include #endif /* getopt is in posix.2, so cygwin should have it in unistd, but doesn't */ #if defined (__WIN32__) || defined (__CYGWIN__) # include "getopt_old.h" #else # include #endif #include "sysfuncs.h" #include "memlib.h" #include "messages.h" #include "local_strings.h" #include "perf_hash.h" #include "netorder.h" #include "mg_files.h" #include "invf.h" #include "locallib.h" #include "words.h" #include "mg.h" #define POOL_SIZE 1024*1024 static void ProcessFiles (char *filename, int r) { FILE *dictFile, *hashFile; mg_u_long i; invf_dict_header idh; perf_hash_data *phd; u_char *pool; mg_u_long pool_left; u_char **starts; // read in the dictionary dictFile = open_file (filename, INVF_DICT_SUFFIX, "rb", MAGIC_STEM_BUILD, MG_ABORT); if (dictFile==NULL) { FatalError(1, "unable to open file"); } idh.Read (dictFile); //cerr << idh.lookback<<" "<