1
Fork 0

Fixed wingetopt.c

This commit is contained in:
davi 2005-01-21 21:14:55 +00:00
parent 8305f399aa
commit ae434fdc8d
4 changed files with 14 additions and 9 deletions

View File

@ -15,9 +15,10 @@ features of cmph:
- Fast - Fast
- Space-efficient with main memory usage carefully documented - Space-efficient with main memory usage carefully documented
- The best modern algorithms are available (or at least scheduled for implementation :-)) - The best modern algorithms are available (or at least scheduled for implementation :-))
- Object oriented implementation
- Works with in-disk key sets through use of adapter pattern - Works with in-disk key sets through use of adapter pattern
- Serialization of hash functions - Serialization of hash functions
- Portable C code (currently works on GNU/Linux and WIN32)
- Object oriented implementation
- Easily extensible - Easily extensible
- Well encapsulated API aiming binary compatibility through releases - Well encapsulated API aiming binary compatibility through releases
- Free Software - Free Software

View File

@ -23,22 +23,24 @@ typedef struct
void (*rewind)(void *); void (*rewind)(void *);
} cmph_key_source_t; } cmph_key_source_t;
/** Hash generation API **/ /** Hash configuration API **/
cmph_config_t *cmph_config_new(cmph_key_source_t *key_source); cmph_config_t *cmph_config_new(cmph_key_source_t *key_source);
void cmph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs); void cmph_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
void cmph_config_set_verbosity(cmph_config_t *mph, cmph_uint32 verbosity); void cmph_config_set_verbosity(cmph_config_t *mph, cmph_uint32 verbosity);
void cmph_config_set_graphsize(cmph_config_t *mph, float c); void cmph_config_set_graphsize(cmph_config_t *mph, float c);
void cmph_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo); void cmph_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo);
void cmph_config_destroy(cmph_config_t *mph); void cmph_config_destroy(cmph_config_t *mph);
cmph_t *cmph_new(cmph_config_t *mph);
/** Hash querying API **/ /** Hash API **/
cmph_t *cmph_load(FILE *f); cmph_t *cmph_new(cmph_config_t *mph);
int cmph_dump(cmph_t *mphf, FILE *f);
cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen); cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen);
cmph_uint32 cmph_size(cmph_t *mphf); cmph_uint32 cmph_size(cmph_t *mphf);
void cmph_destroy(cmph_t *mphf); void cmph_destroy(cmph_t *mphf);
/** Hash serialization/deserialization */
int cmph_dump(cmph_t *mphf, FILE *f);
cmph_t *cmph_load(FILE *f);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -6,14 +6,14 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
graph_iterator_t it; graph_iterator_t it;
uint32 i, neighbor; cmph_uint32 i, neighbor;
graph_t *g = graph_new(5, 10); graph_t *g = graph_new(5, 10);
fprintf(stderr, "Building random graph\n"); fprintf(stderr, "Building random graph\n");
for (i = 0; i < 10; ++i) for (i = 0; i < 10; ++i)
{ {
uint32 v1 = i % 5; cmph_uint32 v1 = i % 5;
uint32 v2 = (i*2) % 5; cmph_uint32 v2 = (i*2) % 5;
if (v1 == v2) continue; if (v1 == v2) continue;
graph_add_edge(g, v1, v2); graph_add_edge(g, v1, v2);
DEBUGP("Added edge %u %u\n", v1, v2); DEBUGP("Added edge %u %u\n", v1, v2);

View File

@ -1,3 +1,4 @@
#ifdef WIN32
/***************************************************************************** /*****************************************************************************
* *
* MODULE NAME : GETOPT.C * MODULE NAME : GETOPT.C
@ -175,3 +176,4 @@ int getopt(int argc, char *argv[], char *opstring)
} }
} }
#endif //WIN32