| www.delorie.com/gnu/docs/gnugo/gnugo_173.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following functions are defined in `hash.c':
void hash_init()
Initialize the entire hash system.
int hashdata_compare(Hash_data *key1, Hash_data *key2)
Returns 0 if *key1 == *key2, 2 if the hashvalues differ, or 1 if
only the hashpositions differ.
This adheres (almost) to the standard compare function semantics
which are used e.g. by the comparison functions used in qsort().
void hashposition_dump(Hashposition *pos, FILE *outfile)
Dump an ASCII representation of the contents of a Hashposition onto the FILE outfile.
int hashdata_diff_dump(Hash_data *key1,Hash_data *key2 )
Compare two Hashdata structs. If equal: return zero. If not: dump a human readable summary of any differences to stderr. The return value is the same as for hashdata_compare. This function is primarily intended to be used in assert statements.
void hashdata_recalc(Hash_data *target, Intersection *p, int kopos)
Calculate the compactboard and the hashvalue in one function. They are always used together and it saves us a loop and a function call.
void hashdata_set_ko(Hash_data *hd, int pos)
Set or remove a ko at pos.
void hashdata_remove_ko(Hash_data *hd)
Remove any ko from the hash value and hash position.
void hashdata_invert_stone(Hash_data *hd, int pos, int color)
Set or remove a stone ofcoloratposin a Hash_data.
void read_result_dump(Read_result *result, FILE *outfile)
Dump an ASCII representation of the contents of a Read_result onto the FILE outfile.
void hashnode_dump(Hashnode *node, FILE *outfile)
Dump an ASCII representation of the contents of a Hashnode onto the FILE outfile.
int hashtable_init(Hashtable *table, int tablesize, int num_nodes, int num_results)
Initialize a hash table for a given total size and size of the hash table. Returns 0 if something went wrong. Just now this means that there wasn't enough memory available.
Hashtable * hashtable_new(int tablesize, int num_nodes, int num_results)
Allocate a new hash table and return a pointer to it. Return NULL if there is insufficient memory.
void hashtable_clear(Hashtable *table)
Clear an existing hash table.
void hashtable_clear_if_full(Hashtable *table)
Clear an existing hash table only if it happens to be full. By full we mean that we are either out of positions or read results.
Hashnode * hashtable_enter_position(Hashtable *table, Hash_data *hd)
Enter a position with a given hash value into the table. Return a pointer to the hash node where it was stored. If it is already there, don't enter it again, but return a pointer to the old one.
Hashnode * hashtable_search(Hashtable *table, Hash_data *hd)
Given a Hashposition and a Hash value, find the hashnode which contains this position with the given hash value.
void hashtable_dump(Hashtable *table, FILE *outfile)
Dump an ASCII representation of the contents of a Hashtable onto the FILE outfile.
The following macros are defined in `hash.h'
rr_get_komaster(rr)
rr_get_kom_pos(rr)
rr_get_routine(rr)
rr_get_str1(rr)
rr_get_stackp(rr)
rr_get_str2(rr)
rr_get_str(rr)
rr_get_status(rr)
rr_get_result1(rr)
rr_get_result2(rr)
rr_get_move(rr)
rr_get_result(rr)
Get the constituent parts of a Read_result.
The following macros and functions are defined in `engine/reading.c':
static int get_read_result(int routine, int *si, int *sj, Read_result **read_result)
Return a Read_result for the current position, routine and location. For performance, the location is changed to the origin of the string.
READ_RETURN0(Read_result *read_result)
Cache a negative read result.
READ_RETURN(Read_result *read_result, int *pointi, int *pointj, int resulti, int resultj, int value)
Ifpointiandpointjare not null pointers, then give(*pointi, *pointj)the values(resulti, resultj). Then cache theread_result. Clear the hashtable if full and returnvalue.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |