/* book.c -- the text keeper module */ #define HALF_SIZE 50000 static char BOOK [HALF_SIZE]; int fromBOOK ( long int n ); void toBOOK ( long int n, int i ); long int searchBOOK ( long int start, long int end, int desired ); int fromBOOK ( long int n ) { long int m; int x; m = n; if ( n >= HALF_SIZE ) m = n - HALF_SIZE; x = (unsigned char) BOOK [m]; if ( n < HALF_SIZE ) return ( (unsigned char) (x & 0xF ) ); return ( x >> 4 ); } void toBOOK ( long int n, int i ) { long int m; int x; m = n; if ( n >= HALF_SIZE ) m = n - HALF_SIZE; x = BOOK [m]; if ( n < HALF_SIZE ) { x = x & 0xF0; x = x | i; } else { x = x & 0x0F; x = x | ( i << 4 ); } BOOK [m] = (char) x; } long int searchBOOK ( long int start, long int end, int desired ) { long int from, to, n; from = start; to = end; if ( from < HALF_SIZE ) { if ( to > HALF_SIZE ) to = HALF_SIZE; for ( n=from; n