aboutsummaryrefslogtreecommitdiff
path: root/guile_interface.scm.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-03-10 23:30:27 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-03-10 23:34:28 +0100
commit974405a7ad177965551a9ec5b4bf68b7fe4517aa (patch)
tree60e3587236859d41cfcd43377e1586d1d22b5674 /guile_interface.scm.c
parentAdd parsing for all RRULEs except BYDAY. (diff)
downloadcalp-974405a7ad177965551a9ec5b4bf68b7fe4517aa.tar.gz
calp-974405a7ad177965551a9ec5b4bf68b7fe4517aa.tar.xz
Add filter-children!
Diffstat (limited to '')
-rw-r--r--guile_interface.scm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/guile_interface.scm.c b/guile_interface.scm.c
index a5921869..3d0bff1e 100644
--- a/guile_interface.scm.c
+++ b/guile_interface.scm.c
@@ -111,6 +111,27 @@ SCM_DEFINE(vcomponent_children, "%vcomponent-children", 1, 0, 0,
return llist;
}
+SCM_DEFINE(vcomponent_filter_children_x, "%vcomponent-filter-children!",
+ 2, 0, 0,
+ (SCM pred, SCM component),
+ "Remove all children from component who DOESN'T satisfy `pred`")
+{
+ scm_assert_foreign_object_type (vcomponent_type, component);
+ vcomponent* cal = scm_foreign_object_ref (component, 0);
+
+ for (LINK(vcomponent)* l = FIRST(&cal->components);
+ l->after != NULL;
+ l = l->after)
+ {
+ if (scm_is_false(scm_call_1 (pred, scm_from_vcomponent(l->value)))) {
+ FFREE(vcomponent, l->value);
+ UNLINK(LINK(vcomponent))(l);
+ }
+ }
+
+ return SCM_UNSPECIFIED;
+}
+
SCM_DEFINE(vcomponent_push_child_x, "%vcomponent-push-child!", 2, 0, 0,
(SCM component, SCM child),
"")