+
+/**
+ * \brief Iterate over the hash and call PrintEntry.
+ * \param Hash your Hashlist structure
+ * \param Trans is called so you could for example print 'A:' if the next entries are like that.
+ * Must be aware to receive NULL in both pointers.
+ * \param PrintEntry print entry one by one
+ * \returns the number of items printed
+ */
+int PrintHash(HashList *Hash, TransitionFunc Trans, PrintHashDataFunc PrintEntry)
+{
+ int i;
+ void *Previous;
+ void *Next;
+ const char* KeyStr;
+
+ for (i=0; i < Hash->nMembersUsed; i++) {
+ if (i==0) {
+ Previous = NULL;
+ }
+ else {
+ if (Hash->LookupTable[i - 1] == NULL)
+ Previous = NULL;
+ else
+ Previous = Hash->Members[Hash->LookupTable[i-1]->Position]->Data;
+ }
+ if (Hash->LookupTable[i] == NULL) {
+ KeyStr = "";
+ Next = NULL;
+ }
+ else {
+ Next = Hash->Members[Hash->LookupTable[i]->Position]->Data;
+ KeyStr = Hash->LookupTable[i]->HashKey;
+ }
+
+ Trans(Previous, Next, i % 2);
+ PrintEntry(KeyStr, Next, i % 2);
+ }
+ return i;
+}
+
+