Main Page   Compound List   File List   Compound Members   File Members  

rr_libs/sih.h

Go to the documentation of this file.
00001 /* SIH.H : String-to-Integer Hashing */
00002 /*=====================================================================
00003                 =======   COPYRIGHT NOTICE   =======
00004 Copyright (C) 1994, Carnegie Mellon University and Ronald Rosenfeld.
00005 All rights reserved.
00006 
00007 This software is made available for research purposes only.  It may be
00008 redistributed freely for this purpose, in full or in part, provided
00009 that this entire copyright notice is included on any copies of this
00010 software and applications and derivations thereof.
00011 
00012 This software is provided on an "as is" basis, without warranty of any
00013 kind, either expressed or implied, as to any matter including, but not
00014 limited to warranty of fitness of purpose, or merchantability, or
00015 results obtained from use of this software.
00016 ======================================================================*/
00017 
00018 #ifndef _SIH_H_
00019 #define _SIH_H_
00020 
00021 #include <sys/types.h>
00022 #include <stdio.h>
00023 #include "general.h"
00024 
00033 typedef struct {
00034         char *string;      
00035         int32 intval;      
00036 } sih_slot_t;
00037 
00038 
00043 typedef struct {
00044         double  max_occupancy;  
00045         double  growth_ratio;   
00046         int     warn_on_update; 
00047         int     nslots;         
00048         int     nentries;       
00049         sih_slot_t *slots;      
00050 } sih_t;
00051 
00055 sih_t *sih_create(int initial_size, 
00056                   double max_occupancy,  
00057                   double growth_ratio, 
00058                   int warn_on_update 
00059                   );
00060 
00064 void    sih_add(sih_t *ht,  
00065                 char *string, 
00066                 int32 intval 
00067                 );
00068 
00072 char sih_lookup(sih_t *ht,  
00073                 char *string, 
00074                 int32 *p_intval 
00075                 );
00076 
00080 void *sih_val_write_to_file(sih_t *ht,  
00081                             FILE *fp,   
00082                             char *filename, 
00083                             int verbosity 
00084                             );
00085 
00089 void *sih_val_read_from_file(sih_t *ht, 
00090                              FILE *fp,  
00091                              char *filename, 
00092                              int verbosity  
00093                              );
00094 
00095 /* Moved to here from read_voc.c by Philip Clarkson March 4, 1997 */
00096 
00097 void get_vocab_from_vocab_ht(sih_t *ht, int vocab_size, int verbosity, char ***p_vocab);
00098 
00099 /* Added by Philip Clarkson March 4, 1997 */
00100 
00103 void read_wlist_into_siht(char *wlist_filename,  
00104                           int verbosity,   
00105                           sih_t *p_word_id_ht, 
00106                           int *p_n_wlist 
00107                           );
00108 
00109 void read_wlist_into_array(char *wlist_filename, int verbosity, 
00110                            char ***p_wlist, int *p_n_wlist);
00111 
00112 #endif 

Generated on Tue Dec 21 13:54:46 2004 by doxygen1.2.18