Main Page | File List

hashing.h

00001 /* '='='=' '@' '='='='='='='='='=' '@' '='='='='='='='='=' '@' '='='='| */
00002 /* ='='=' '@'@' '='='='='='='='=' '@'@' '='='='='='='='=' '@'@' '='='=| */
00003 /* '='=' '@':'@' '='='='='='='=' '@':'@' '='='='='='='=' '@':'@' '='='| */
00004 /* ='=' '@':':'@' '='='='='='=' '@':':'@' '='='='='='=' '@':':'@' '='=| */
00005 /* '=' '@':':':'@' '='='='='=' '@':':':'@' '='='='='=' '@':':':'@' '='| */
00006 /* =' '@':':':':'@' '='='='=' '@':':':':'@' '='='='=' '@':':':':'@' '=| */
00007 /* ' '@':'                                                       '@' '| */
00008 /*  '@'         3rd Year Project - ROY SCHESTOWITZ - 2002          @' | */
00009 /* '@                                                               @'| */
00010 /* @':':':':':':':':'@' ' '@':':':':':':':':'@' ' '@':':':':':':':':'@| */
00011 /* ':':':':':':':':':'@' '@':':':':':':':':':'@' '@':':':':':':':':':'| */
00012 /* :':':':':':':':':':'@'@':':':':':':':':':':'@'@':':':':':':':':':':| */
00013 /* ':':':': : :':':':':'@':':':':': : :':':':':'@':':':':': : :':':':'| */
00014 /*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
00015 /*              Name:           hashing.h                               */
00016 /*              Version:        0.6.6                                   */
00017 /*              Date:           12/2/2003                               */
00018 /*                                                                      */
00019 /*              Datastructures for the hashtable procedures             */
00020 /*                                                                      */
00021 /*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
00022 /*         Original implementation courtesy of Graham Gough             */
00023 
00024 /************************************************************************/
00025 /**********************  INCLUDES  **************************************/
00026 /************************************************************************/
00027 
00028 
00029 /************************************************************************/
00030 /**********************  DEFINES  ***************************************/
00031 /************************************************************************/
00032 
00033 #ifndef TABLE_HASH_H
00034 #define TABLE_HASH_H
00035 
00036 /************************************************************************/
00037 /**********************  DATA STRUCTURES  *******************************/
00038 /************************************************************************/
00039 
00040 typedef int Boolean;
00041 
00042 /* The type for keys */
00043 typedef char *Key_Type;
00044 
00045 /* Type for size of hash table */
00046 typedef unsigned int Table_size;
00047 
00048 /* Type for index into hash table */
00049 typedef unsigned int Index;
00050 
00051 /* Type for state of hash table entry */
00052 enum kind_of_entry
00053 { legitimate, empty, deleted };
00054 
00055 /* Type for hash table entry */
00056 struct hash_entry
00057 {
00058   Key_Type element;
00059   int x;                        /* Horizontal coordinate on board */
00060   int y;                        /* Vertical coordinate on board   */
00061   enum kind_of_entry state;
00062 };
00063 
00064 typedef struct hash_entry cell;
00065 
00066 /* The underlying hash table stucture */
00067 struct hash_tbl
00068 {
00069   Table_size table_size;
00070   Table_size num_entries;
00071   cell *the_cells;              /* an array of hash_entry cells,
00072                                  * allocated during initialisation */
00073 };
00074 
00075 /* The hash table */
00076 /* - a pointer to the hash table stucture */
00077 typedef struct hash_tbl *Table;
00078 
00079 /************************************************************************/
00080 /**********************  PROTOTYPES  ************************************/
00081 /************************************************************************/
00082 
00083 Table initialize_table ( Table_size );
00084 
00085 Table insert ( Key_Type, Table, int, int );
00086 
00087 Boolean find ( Key_Type, Table );
00088 
00089 int getX ( Key_Type, Table );
00090 
00091 int getY ( Key_Type, Table );
00092 
00093 void print_table ( Table );
00094 
00095 /************************************************************************/
00096 /*************************** VARIABLES **********************************/
00097 /************************************************************************/
00098 
00099 Table movesHashTable;           /* The table of opening moves */
00100 
00101 #endif
00102 
00103 /*                                                                      */
00104 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
00105 /*                     end of hashing.h                             */
00106 /************************************************************************/

Generated on Mon May 23 01:16:01 2005 by doxygen 1.3.2