Main Page   Compound List   File List   Compound Members   File Members  

text2wfreq.c File Reference

driver of counting word frequency in a particular text file. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "toolkit.h"
#include "rr_libs/general.h"
#include "pc_libs/pc_general.h"

Go to the source code of this file.

Compounds

struct  hash_table
 A hash table. More...

struct  node
 Node in a hash. More...


Defines

#define MAX_STRING_LENGTH   501
#define DEFAULT_HASH   1000000

Functions

nodenew_node (char *key)
void new_hashtable (struct hash_table *table, int M)
int update_chain (struct node *t, char *key)
void print_chain (struct node *t)
int hash (char *key, int M)
void print (struct hash_table *table)
void update (struct hash_table *table, char *key, int verbosity)
int nearest_prime (int num)
int main (int argc, char **argv)


Detailed Description

driver of counting word frequency in a particular text file.

Definition in file text2wfreq.c.


Define Documentation

#define DEFAULT_HASH   1000000
 

Definition at line 37 of file text2wfreq.c.

Referenced by main().

#define MAX_STRING_LENGTH   501
 

Definition at line 36 of file text2wfreq.c.

Referenced by main().


Function Documentation

int hash char *    key,
int    M
 

Definition at line 128 of file text2wfreq.c.

Referenced by index2(), main(), and update().

int main int    argc,
char **    argv
 

Definition at line 180 of file text2wfreq.c.

References DEFAULT_HASH, DEFAULT_VERBOSITY, fprintf(), MAX_STRING_LENGTH, nearest_prime(), new_hashtable(), pc_flagarg(), pc_intarg(), pc_message(), pc_report_unk_args(), print(), quit(), report_version(), update(), and verbosity.

int nearest_prime int    num
 

Definition at line 161 of file text2wfreq.c.

Referenced by main().

void new_hashtable struct hash_table   table,
int    M
 

Definition at line 74 of file text2wfreq.c.

References hash_table::chain, i, new_node(), and hash_table::size.

Referenced by main().

struct node* new_node char *    key
 

Definition at line 62 of file text2wfreq.c.

References node::count, rr_malloc(), and node::word.

Referenced by new_hashtable(), and update_chain().

void print struct hash_table   table
 

Definition at line 139 of file text2wfreq.c.

References hash_table::chain, i, print_chain(), and hash_table::size.

Referenced by main().

void print_chain struct node   t
 

Definition at line 117 of file text2wfreq.c.

References node::count, node::next, and node::word.

Referenced by print().

void update struct hash_table   table,
char *    key,
int    verbosity
 

Definition at line 147 of file text2wfreq.c.

References hash_table::chain, hash(), pc_message(), hash_table::size, update_chain(), and verbosity.

Referenced by main().

int update_chain struct node   t,
char *    key
 

Definition at line 87 of file text2wfreq.c.

References node::count, new_node(), node::next, and node::word.

Referenced by add_to_hashtable(), and update().


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