6350df0843d759575363b01edb907b528f8b5970 kent Sun Feb 15 12:18:04 2015 -0800 Adding routine for sorting elements from a hashInt type hash. diff --git src/inc/hash.h src/inc/hash.h index 6cd50b3..4b0b80c 100644 --- src/inc/hash.h +++ src/inc/hash.h @@ -182,30 +182,34 @@ /* Apply func to every element of hash with hashEl as parameter. */ void hashTraverseVals(struct hash *hash, void (*func)(void *val)); /* Apply func to every element of hash with hashEl->val as parameter. */ struct hashEl *hashElListHash(struct hash *hash); /* Return a list of all elements of hash. Free return with hashElFreeList. */ int hashElCmp(const void *va, const void *vb); /* Compare two hashEl by name. */ int hashElCmpWithEmbeddedNumbers(const void *va, const void *vb); /* Compare two hashEl by name sorting including numbers within name, * suitable for chromosomes, genes, etc. */ +int hashElCmpIntValDesc(const void *va, const void *vb); +/* Compare two hashEl from a hashInt type hash, with highest integer values + * comingFirst. */ + void *hashElFindVal(struct hashEl *list, char *name); /* Look up name in hashEl list and return val or NULL if not found. */ void hashElFree(struct hashEl **pEl); /* Free hash el list returned from hashListAll. */ void hashElFreeList(struct hashEl **pList); /* Free hash el list returned from hashListAll. (Don't use * this internally. */ struct hashCookie hashFirst(struct hash *hash); /* Return an object to use by hashNext() to traverse the hash table. * The first call to hashNext will return the first entry in the table. */ struct hashEl* hashNext(struct hashCookie *cookie);