more progress in new ktv storage

FossilOrigin-Name: a2c26a366de1946feb707439302b22de2e3d02f7621d0834fdf242852b28639c
This commit is contained in:
7u83@mail.ru
2018-03-15 19:07:17 +00:00
parent 8b2e36e912
commit 15cca4e553
40 changed files with 411 additions and 310 deletions

View File

@ -1,8 +1,49 @@
#include "ktv.h"
cw_kvt_read_file(mavl_t ktv, mavl_t types)
int cw_ktv_read_file(FILE * file, mavl_t ktv, mavl_t types)
{
char key[256];
char xtype[256];
char val[2048];
int rc;
struct cw_Type typesearch, *cwtype;
}
do {
cw_KTV_t nktv, *nres;
rc = cw_ktv_read_line(file,key,xtype,val);
if (rc == 0){
printf("Got a line %s:%s:%s\n",key,xtype,val);
}
typesearch.name=xtype;
/* printf("Searching for type: '%s'\n",xtype);*/
cwtype = mavl_get_ptr(types,&typesearch);
if (cwtype != NULL){
// printf("Yes! I know the type: %s\n",cwtype->name);
}
else
continue;
cw_ktv_add_from_str(ktv,key,cwtype,val);
/* nres = cwtype->from_str(&nktv,val);
if (nres !=NULL ){
// printf("Yea, created from string\n");
nktv.key=cw_strdup(key);
mavl_add(ktv, &nktv, NULL);
}
*/
}while(rc==0);
return 0;
}