aboutsummaryrefslogtreecommitdiff
path: root/guile_interface.scm.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-02-25 23:56:01 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-02-25 23:56:35 +0100
commit6ecb49f5104b89596eb1c5d8bb2c788cd6c39386 (patch)
tree4a382d3f33064ad381ec833b069a058b31de761d /guile_interface.scm.c
parentStore static reference to SCM version of vcomponent. (diff)
downloadcalp-6ecb49f5104b89596eb1c5d8bb2c788cd6c39386.tar.gz
calp-6ecb49f5104b89596eb1c5d8bb2c788cd6c39386.tar.xz
Single elemnt lists in components now return their CAR.
Diffstat (limited to 'guile_interface.scm.c')
-rw-r--r--guile_interface.scm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/guile_interface.scm.c b/guile_interface.scm.c
index fa4f2f5f..725d16e6 100644
--- a/guile_interface.scm.c
+++ b/guile_interface.scm.c
@@ -47,12 +47,17 @@ SCM_DEFINE (vcomponent_get_attribute, "vcomponent-get-attribute", 2, 0, 0,
if (c == NULL) return SCM_BOOL_F;
- // TODO returns the car of list if list is one long.
SCM llist = SCM_EOL;
FOR (LLIST, content_set, v, &c->val) {
llist = scm_cons(scm_from_strbuf(&v->key), llist);
}
- return llist;
+
+ /* returns the car of list if list is one long. */
+ if (scm_to_int(scm_length(llist)) == 1) {
+ return SCM_CAR(llist);
+ } else {
+ return llist;
+ }
}
SCM_DEFINE (vcomponent_set_attr_x, "vcomponent-set-attribute!", 3, 0, 0,
@@ -66,8 +71,6 @@ SCM_DEFINE (vcomponent_set_attr_x, "vcomponent-set-attribute!", 3, 0, 0,
content_line* c = get_property (com, key);
free(key);
- // TODO if list is a value store it as is, else wrap it in a list
- // of length one.
scm_gc_unprotect_object(c->val.cur->value->key.scm);
c->val.cur->value->key.scm = new_value;
scm_gc_protect_object(c->val.cur->value->key.scm);