external form using srfi-10 for dictionaries
This commit is contained in:
parent
312914fa0d
commit
e339b7c64a
13
src/write.c
13
src/write.c
|
@ -10,7 +10,7 @@
|
|||
#include "picrin/string.h"
|
||||
#include "picrin/vector.h"
|
||||
#include "picrin/blob.h"
|
||||
#include "picrin/macro.h"
|
||||
#include "picrin/dict.h"
|
||||
|
||||
static bool
|
||||
is_tagged(pic_state *pic, pic_sym tag, pic_value pair)
|
||||
|
@ -179,6 +179,7 @@ write_core(struct writer_control *p, pic_value obj)
|
|||
xFILE *file = p->file;
|
||||
size_t i;
|
||||
xh_entry *e;
|
||||
xh_iter it;
|
||||
int c;
|
||||
float f;
|
||||
|
||||
|
@ -300,8 +301,18 @@ write_core(struct writer_control *p, pic_value obj)
|
|||
}
|
||||
xfprintf(file, ")");
|
||||
break;
|
||||
case PIC_TT_DICT:
|
||||
xfprintf(file, "#,(dictionary");
|
||||
xh_begin(&it, &pic_dict_ptr(obj)->hash);
|
||||
while (xh_next(&it)) {
|
||||
xfprintf(file, " '%s ", pic_symbol_name(pic, xh_key(it.e, pic_sym)));
|
||||
write_core(p, xh_val(it.e, pic_value));
|
||||
}
|
||||
xfprintf(file, ")");
|
||||
break;
|
||||
default:
|
||||
xfprintf(file, "#<%s %p>", pic_type_repr(pic_type(obj)), pic_ptr(obj));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue