--- /dev/null
+\r
+/* DYNAMIC END-TAGGED DENSE CODE. -- \r
+A dynamic word-based byte oriented compressor for text files based on \r
+dynamic End-Tagged Dense Code.\r
+\r
+Brisaboa, N. R., Fariña, A., Navarro, G., Paramá, J. R. \r
+Simple, Fast, and Efficient Natural Language Adaptive Compression. \r
+11th International Symposium on String Processing and Information Retrieval (SPIRE'04) - LNCS 3246. A. Apostolico, M. Melucci (Ed.), pp. 230-241. \r
+Padova (Italia), 2004. \r
+\r
+Copyright (C) 2005 Antonio Fariña.\r
+\r
+This program is free software; you can redistribute it and/or\r
+modify it under the terms of the GNU General Public License\r
+as published by the Free Software Foundation; either version 2\r
+of the License, or (at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+\r
+Author's contact: Antonio Fariña, Dept. of Computer Science, University of\r
+A Coruña. Campus de Elviña s/n. Spain fari@udc.es\r
+*/\r
+\r
+\r
+/*-----------------------------------------------------------------------\r
+ Hash: Definition of HashTable class (Linear Hash)\r
+ ------------------------------------------------------------------------*/\r
+#ifndef HASH_INCLUDED\r
+#define HASH_INCLUDED\r
+ \r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include <math.h>\r
+#include <malloc.h>\r
+\r
+#include "MemoryManager.h"\r
+\r
+#define JUMP 101 //jump done when a collision appears\r
+#define OCUP_HASH 1.5 //index of occupation of the hash table\r
+#define SMALL_PRIME 1009 // a small prime number, used to compute a hash function\r
+#define SEED 1159241\r
+/* Type definitions */\r
+\r
+#define MIN(a,b) (a < b) ? a : b\r
+\r
+struct hashNode {\r
+ unsigned char *word;\r
+ unsigned long len;\r
+ unsigned long posInVoc; //positon of the canonical word in vector posInHT\r
+};\r
+typedef struct hashNode t_hashNode;\r
+\r
+struct hashStr {\r
+ t_hashNode *hash; /* the slots in the hash table */\r
+ unsigned long SIZE_HASH; /* # entries in the hash table */\r
+ unsigned long NumElem; /* # elements already added to the hash table*/\r
+ MemoryManager _memMgr; /* Holds dynamic memory allocation for words. */ \r
+};\r
+\r
+typedef struct hashStr *t_hash;\r
+\r
+// private:\r
+\r
+ unsigned long NearestPrime (unsigned long n);\r
+ unsigned long hashFunction (const unsigned char *aWord, unsigned int len, unsigned long sizeHash);\r
+\r
+// public:\r
+ \r
+ t_hash initialize_hash (unsigned long sizeVoc);\r
+ \r
+ void insertElement (t_hash h, const unsigned char *aWord, register unsigned long len,\r
+ register unsigned long *addr);\r
+ unsigned long search (t_hash h, const unsigned char *aWord, register unsigned len,\r
+ unsigned long *returnedAddr);\r
+ unsigned long inHashTable (t_hash h, const unsigned char *aWord, register unsigned len,\r
+ unsigned long *returnedAddr);\r
+ void destroy_hash (t_hash hash);\r
+ \r
+ int strcomp(const unsigned char *s1, const unsigned char *s2, register unsigned long ws1, unsigned long ws2);\r
+\r
+ int strcompL(const byte *s1, const byte *s2, register ulong ws1, register ulong ws2);\r
+\r
+\r
+#endif\r