From a3810dc1272be0998c419f89057cbf1b2c4969d8 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 12 Feb 2003 13:40:40 +0000 Subject: [PATCH] Clened up, more doxygen docu [r758] --- ir/ident/ident.c | 32 +++++++++++++------------------- ir/ident/ident.h | 37 ++++++++++++++++++++++++------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ir/ident/ident.c b/ir/ident/ident.c index cd15a3a58..ca8288330 100644 --- a/ir/ident/ident.c +++ b/ir/ident/ident.c @@ -106,48 +106,42 @@ id_init (void) } -INLINE ident *id_from_str (const char *str, int len) { +INLINE ident *id_from_str (const char *str, int len) +{ assert (len > 0); - return (const set_entry *) set_hinsert (id_set, - (str), - (len), - ID_HASH ((str), (len))); + return (ident *)set_hinsert(id_set, str, len, ID_HASH(str, len)); } INLINE const char *id_to_str (ident *id) { - return ((const char *)&(id)->dptr[0]); + return (const char *)id->dptr; } INLINE int id_to_strlen(ident *id) { - return ((id)->size); + return id->size; } int id_is_prefix (ident *prefix, ident *id) { if (id_to_strlen(prefix) > id_to_strlen(id)) return 0; - if (0 == memcmp(&(prefix->dptr[0]), &(id->dptr[0]), id_to_strlen(prefix))) - return 1; - return 0; + return 0 == memcmp(prefix->dptr, id->dptr, id_to_strlen(prefix)); } int id_is_suffix (ident *suffix, ident *id) { int suflen = id_to_strlen(suffix); - int idlen = id_to_strlen(id); + int idlen = id_to_strlen(id); char *part; + if (suflen > idlen) return 0; - part = (char *) &id->dptr[0]; + part = (char *)id->dptr; part = part + (idlen - suflen); - if (0 == memcmp(&(suffix->dptr[0]), part, suflen)) - return 1; - return 0; + + return 0 == memcmp(suffix->dptr, part, suflen); } int print_id (ident *id) { - xprintf("%I", id); - return(0); + return xprintf("%I", id); } int fprint_id (FILE *F, ident *id) { - xfprintf(F, "%I", id); - return(0); + return xfprintf(F, "%I", id); } diff --git a/ir/ident/ident.h b/ir/ident/ident.h index d46088817..5bebf9b7e 100644 --- a/ir/ident/ident.h +++ b/ir/ident/ident.h @@ -27,12 +27,16 @@ /* Identifiers */ /** - * the abstract data type ident + * The abstract data type ident. + * + * An ident repraesents an unique string. The == operator + * is sufficient to compare two idents. */ typedef const struct set_entry ident; /** * Store a string and create an ident. + * * Stores a string in the ident module and returns a handle for the string. * Copies the string. * @@ -41,60 +45,64 @@ typedef const struct set_entry ident; * * @return id - a handle for the generated ident * - * @see id_to_str, id_to_strlen + * @see id_to_str(), id_to_strlen() */ INLINE ident *id_from_str (const char *str, int len); /** * Returns a string represented by an ident. - * Returns the string cp represented by id. This string cp is not + * + * Returns the string represented by id. This string is not * NULL terminated! The string may not be changed. * * @param id - the ident * * @return cp - a string * - * @see id_from_str, id_to_strlen + * @see id_from_str(), id_to_strlen() */ INLINE const char *id_to_str (ident *id); /** - * Returns the length of a string represented by an ident. + * Returns the length of the string represented by an ident. * * @param id - the ident * * @return len - the length of the string * - * @see id_from_str, id_to_str + * @see id_from_str(), id_to_str() */ INLINE int id_to_strlen(ident *id); /** - * Returns true if prefix is prefix of an ident. + * Returns true if prefix is a prefix of an ident. * * @param prefix - the prefix * @param id - the ident * - * @see id_from_str, id_to_str, id_is_prefix + * @see id_from_str(), id_to_str(), id_is_prefix() */ int id_is_prefix (ident *prefix, ident *id); /** - * Returns true if suffix is suffix of id. + * Returns true if suffix is a suffix of an ident. * * @param suffix - the suffix * @param id - the ident * - * @see id_from_str, id_to_str, id_is_prefix + * @see id_from_str(), id_to_str(), id_is_prefix() */ int id_is_suffix (ident *suffix, ident *id); /** * Prints the ident to stdout. * - * @param id - The ident to print. + * @param id - The ident to be printed. * - * @see id_from_str, id_to_str, id_is_prefix, fprint_id + * @return + * number of btes written + * + * @see id_from_str(), id_to_str(), id_is_prefix(), fprint_id() */ int print_id (ident *id); @@ -104,7 +112,10 @@ int print_id (ident *id); * @param F - file pointer to print the ident to. * @param id - The ident to print and the file. * - * @see id_from_str, id_to_str, id_is_prefix, print_id + * @return + * number of btes written + * + * @see id_from_str(), id_to_str(), id_is_prefix(), print_id() */ int fprint_id (FILE *F, ident *id); -- 2.20.1