serialize()

This commit is contained in:
2022-03-04 14:32:09 +03:00
parent 8c9431460e
commit 6cc3acea1d
19 changed files with 295 additions and 45 deletions

View File

@@ -33,3 +33,11 @@ bool Hashtable_try_get(Hashtable* ht, char* key, Unitype* output);
//not implemented yet
void Hashtable_set_pair(Hashtable* ht, KeyValuePair p);
void Hashtable_set(Hashtable* ht, char* key, Unitype u);
#define Hashtable_foreach(HT, EL, codeblock)({\
uint16 hmax=Hashtable_height(HT);\
for(uint16 h=0; h<hmax; h++){\
Autoarr(KeyValuePair)* AR=HT->rows+h;\
Autoarr_foreach(AR, EL, codeblock);\
}\
})

View File

@@ -18,3 +18,9 @@ void Autoarr_KeyValuePair_clear(Autoarr_KeyValuePair* ar){
KeyValuePair_free(ar->values[ar->blocks_count-1][elemI]);
Autoarr_clear(ar);
}
void printkvp(KeyValuePair p){
printf("{\"%s\", ",p.key);
printuni(p.value);
printf("}");
}

View File

@@ -13,3 +13,5 @@ void KeyValuePair_free(KeyValuePair p);
//func to clear KVP array
void Autoarr_KeyValuePair_clear(Autoarr_KeyValuePair* ar);
void printkvp(KeyValuePair p);