From 53eab85617c656b88a48968971e3b79d1310cb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 3 May 2019 13:18:33 +0200 Subject: more --- src/parse.c | 2 +- src/vcal.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/parse.c b/src/parse.c index cd64e192..71272998 100644 --- a/src/parse.c +++ b/src/parse.c @@ -160,7 +160,7 @@ int handle_kv ( /* key \in { VCALENDAR, VEVENT, VALARM, VTODO, VTIMEZONE, ... } */ NEW(vcomponent, e, - ctx->str.mem, + val->mem, ctx->filename); SCM_PUSH_X(ctx->key_stack, scm_string_to_symbol(scm_from_utf8_stringn(ctx->str.mem, ctx->str.len))); diff --git a/src/vcal.c b/src/vcal.c index 208a47a9..1df528f4 100644 --- a/src/vcal.c +++ b/src/vcal.c @@ -142,9 +142,6 @@ int DEEP_COPY(vcomponent)(vcomponent* a, vcomponent* b) { // TODO int vcomponent_copy(vcomponent* dest, vcomponent* src) { - ERR("Deep copy not implemented for vcomponent"); - (void) dest; - (void) src; #if 0 DEEP_COPY(TRIE(content_line))(&dest->clines, &src->clines); @@ -156,6 +153,16 @@ int vcomponent_copy(vcomponent* dest, vcomponent* src) { PUSH(vcomponent)(src->parent, dest); #endif + SCM proc = scm_c_eval_string("(lambda (dest) (lambda (k v) (hashq-set! dest k v)))"); + SCM iproc = scm_call_1 (proc, dest->clines); + scm_hash_for_each (iproc, src->clines); + + SCM lst = src->components; + while (! scm_is_null (lst)) { + PUSH(vcomponent)(dest, scm_to_vcomponent(SCM_CAR(lst))); + } + + PUSH(vcomponent)(src->parent, dest); return 0; } -- cgit v1.2.3