Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

CGrepLib.h

Go to the documentation of this file.
00001 
00013 #include <HuffwordLib.h>
00014 
00015 #define CGREP_MAX(a, b) (((a)>(b))?(a):(b))
00016 
00017 #define CGREP_MAX_AGREPOPTIONS (100)
00018 #define CGREP_INIT_VECSIZE  (100)
00019 
00020 #ifndef CGREP_AGREP_EXECUTABLE
00021 #define CGREP_AGREP_EXECUTABLE "agrep"
00022 #endif
00023 
00024 #ifndef CREP_HT_INITSIZE
00025 #define CGREP_HT_INITSIZE (1000)
00026 #endif
00027 
00028 #define CGREP_MAX_PATTERNS 10
00029 
00030 #define CGREP_MIN_PRINTABLE_CHAR 32
00031 #define CGREP_MAX_PRINTABLE_CHAR 126
00032 #define CGREP_NONPRINTABLE_CHARS "[]"
00033 
00036 typedef struct _proximity_hit_t {
00037   size_t byte_position;  
00038   size_t start_position; 
00039   size_t end_position;   
00040   int positions[CGREP_MAX_PATTERNS];   
00041   int ranks[CGREP_MAX_PATTERNS];       
00042 } proximity_hit_t;
00043 
00050 typedef struct MyHash_node {
00051   char str[4];         
00052   int len_str;         
00053   int npattern;        
00054   struct MyHash_node *next; 
00055 #ifdef DEBUG
00056   char word[100];
00057 #endif
00058   //  struct MyHash_node *next;    //!< pointer to the next item in the list
00059 } MyHash_node;
00060 
00061 typedef MyHash_node **MyHash_nodeptr_array; 
00062 
00067 typedef struct {
00068   int size;             
00069   int card;             
00070   MyHash_nodeptr_array table;   
00071 } MyHash_table;
00072 
00073 /* Hashtable Functions */
00074 void MyHashtable_init(MyHash_table *ht, int n);
00075 void MyHashtable_clear(MyHash_table *ht);
00076 int MyHashtable_func(const char *s, int len, const MyHash_table *ht);
00077 MyHash_node *MyHashtable_search(const char *s, int slen,
00078                                 const MyHash_table *ht);
00079 int MyHashtable_insert(const char *s, int slen, int npattern, MyHash_table *ht
00080 #ifdef DEBUG
00081                        , char *word, int len
00082 #endif
00083                        );
00084 
00085 MyHash_node *
00086 CGrep_CheckIfIsPattern(const char *cbody, int cw_len, const MyHash_table *ht,
00087                        MyHash_node *hn, const char filter[]);
00088 
00089 
00090 int CGrep_GetMatchingCW(MyHash_table *ht, char *filter, char **options,
00091                         int npattern, const Console *c);
00092 
00093 
00094 int * CGrep_GetCWOccurrences(int *, const MyHash_table *, const char *filter,
00095                              const char * cbody, size_t remaining);
00096 
00097 /*
00098 int CGrep_GetSeparators(MyHash_table *ht,
00099                         char *filter, Dictionary *d, Console *c);
00100 */
00101 
00102 proximity_hit_t *
00103 CGrep_GetOccurrencesProximitySpaceless(int *, int, int,
00104                                        const MyHash_table *,
00105                                        const char filter[],
00106                                        const MyHash_table *, const char *,
00107                                        const char *, size_t);
00108 
00109 proximity_hit_t *
00110 CGrep_GetOccurrencesProximity(int *nocc, int prox_window,
00111                               int npatterns, const MyHash_table *ht,
00112                               const char filter[],
00113                               const MyHash_table *separators,
00114                               const char *sepFilter,
00115                               const char *buf, size_t buf_len,
00116                               const Hash_node *nl);
00117 
00118 int * CGrep_SearchPattern(int *, const char *, size_t, const char *, char **);
00119 
00120 int * CGrep_SearchWord(int *nres, const char *word, const char *ctext,
00121                        size_t ctext_len, int errors);
00122 
00123 int * CGrep_SearchSubstring(int *nres, const char *pattern, const char *ctext,
00124                             size_t ctext_len, int errors);
00125 
00126 proximity_hit_t *
00127 CGrep_SearchProximity(int *nres, const char *ctext, size_t ctext_sz,
00128                       int prox_window, char **patterns, char ***options);
00129 
00130 const char *
00131 CGrep_GetNextCWOccurrence(int *len, MyHash_table *ht, const char *filter,
00132                           const char *cbody, size_t remaining);
00133 
00134 char * CGrep_escapeStringConfigurable(const char *s, size_t len, char min,
00135                                       char max, const char *exceptions);
00136 
00137 char * CGrep_escapeString(const char *s, size_t len);
00138 

Generated on Mon Mar 31 14:44:31 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002