aboutsummaryrefslogtreecommitdiff
path: root/guile_interface.scm.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-03-02 17:48:17 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-03-02 17:48:17 +0100
commitc5e511a8b6e4488d35e18d9d2defba5508bfb8f2 (patch)
tree3ad25b596bee2c1c553b0a9939474e1e7ee973c4 /guile_interface.scm.c
parentFix lingering strbuf off by one error. (diff)
downloadcalp-c5e511a8b6e4488d35e18d9d2defba5508bfb8f2.tar.gz
calp-c5e511a8b6e4488d35e18d9d2defba5508bfb8f2.tar.xz
Expose KEY(TRIE(content_line)) to scheme.
Diffstat (limited to 'guile_interface.scm.c')
-rw-r--r--guile_interface.scm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/guile_interface.scm.c b/guile_interface.scm.c
index 0fd46505..41d13c3c 100644
--- a/guile_interface.scm.c
+++ b/guile_interface.scm.c
@@ -141,6 +141,24 @@ SCM scm_from_vcomponent(vcomponent* v) {
return v->scm;
}
+SCM_DEFINE(vcomponent_attr_list, "%vcomponent-attribute-list", 1, 0, 0,
+ (SCM component),
+ "Returns list of all keys in component.")
+{
+ scm_assert_foreign_object_type (vcomponent_type, component);
+ vcomponent* comp = scm_foreign_object_ref (component, 0);
+ LLIST(strbuf)* keys = KEYS(TRIE(content_line))(&comp->clines);
+
+ SCM llist = SCM_EOL;
+ FOR (LLIST, strbuf, s, keys) {
+ llist = scm_cons(scm_from_strbuf(s), llist);
+ }
+
+ FFREE(LLIST(strbuf), keys);
+
+ return llist;
+}
+
void init_lib (void) {
init_vcomponent_type();