From ae434fdc8d6804273ee29999a41c034c7441a7d4 Mon Sep 17 00:00:00 2001 From: davi Date: Fri, 21 Jan 2005 21:14:55 +0000 Subject: [PATCH] Fixed wingetopt.c --- README.t2t | 3 ++- src/cmph.h | 12 +++++++----- tests/graph_tests.c | 6 +++--- wingetopt.c | 2 ++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.t2t b/README.t2t index a40b32d..d0c1946 100644 --- a/README.t2t +++ b/README.t2t @@ -15,9 +15,10 @@ features of cmph: - Fast - Space-efficient with main memory usage carefully documented - 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 - Serialization of hash functions +- Portable C code (currently works on GNU/Linux and WIN32) +- Object oriented implementation - Easily extensible - Well encapsulated API aiming binary compatibility through releases - Free Software diff --git a/src/cmph.h b/src/cmph.h index f74de32..2d8d087 100644 --- a/src/cmph.h +++ b/src/cmph.h @@ -23,22 +23,24 @@ typedef struct void (*rewind)(void *); } cmph_key_source_t; -/** Hash generation API **/ +/** Hash configuration API **/ 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_verbosity(cmph_config_t *mph, cmph_uint32 verbosity); 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_destroy(cmph_config_t *mph); -cmph_t *cmph_new(cmph_config_t *mph); -/** Hash querying API **/ -cmph_t *cmph_load(FILE *f); -int cmph_dump(cmph_t *mphf, FILE *f); +/** Hash API **/ +cmph_t *cmph_new(cmph_config_t *mph); cmph_uint32 cmph_search(cmph_t *mphf, const char *key, cmph_uint32 keylen); cmph_uint32 cmph_size(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 } #endif diff --git a/tests/graph_tests.c b/tests/graph_tests.c index 35476aa..74dd32e 100644 --- a/tests/graph_tests.c +++ b/tests/graph_tests.c @@ -6,14 +6,14 @@ int main(int argc, char **argv) { graph_iterator_t it; - uint32 i, neighbor; + cmph_uint32 i, neighbor; graph_t *g = graph_new(5, 10); fprintf(stderr, "Building random graph\n"); for (i = 0; i < 10; ++i) { - uint32 v1 = i % 5; - uint32 v2 = (i*2) % 5; + cmph_uint32 v1 = i % 5; + cmph_uint32 v2 = (i*2) % 5; if (v1 == v2) continue; graph_add_edge(g, v1, v2); DEBUGP("Added edge %u %u\n", v1, v2); diff --git a/wingetopt.c b/wingetopt.c index 09fd6d9..c981d0f 100644 --- a/wingetopt.c +++ b/wingetopt.c @@ -1,3 +1,4 @@ +#ifdef WIN32 /***************************************************************************** * * MODULE NAME : GETOPT.C @@ -175,3 +176,4 @@ int getopt(int argc, char *argv[], char *opstring) } } +#endif //WIN32