aboutsummaryrefslogtreecommitdiff
path: root/vcalendar
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vcalendar.scm16
-rw-r--r--vcalendar/primitive.scm16
2 files changed, 28 insertions, 4 deletions
diff --git a/vcalendar.scm b/vcalendar.scm
index c6aee02c..c2228650 100644
--- a/vcalendar.scm
+++ b/vcalendar.scm
@@ -1,12 +1,11 @@
(define-module (vcalendar)
+ #:use-module (vcalendar primitive)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (make-vcomponent children set-attr! get-attr type
+ type-filter
transform-attr! push-child!))
-(setenv "LD_LIBRARY_PATH" (dirname (current-filename)))
-(load-extension "libguile-calendar" "init_lib")
-
(define (make-vcomponent path)
(if (string-ci=? ".ics" (string-take-right path 4))
;; == Single ICS file ==
@@ -27,7 +26,16 @@
accum)
'() (%vcomponent-children (%vcomponent-make path)))))
-(define children %vcomponent-children)
+(define (type-filter t lst)
+ (filter (lambda (e) (eqv? t (type e)))
+ lst))
+
+(define* (children component #:optional only-type)
+ (let ((childs (%vcomponent-children component)))
+ (if only-type
+ (type-filter only-type childs)
+ childs)))
+
(define set-attr! %vcomponent-set-attribute!)
(define get-attr %vcomponent-get-attribute)
(define type %vcomponent-type)
diff --git a/vcalendar/primitive.scm b/vcalendar/primitive.scm
new file mode 100644
index 00000000..aa182040
--- /dev/null
+++ b/vcalendar/primitive.scm
@@ -0,0 +1,16 @@
+;;; Primitive export of symbols linked from C binary.
+
+(define-module (vcalendar primitive)
+ #:export (%vcomponent-children
+ %vcomponent-push-child!
+
+ %vcomponent-parent
+
+ %vcomponent-make
+ %vcomponent-type
+
+ %vcomponent-set-attribute!
+ %vcomponent-get-attribute))
+
+(setenv "LD_LIBRARY_PATH" (dirname (dirname (current-filename))))
+(load-extension "libguile-calendar" "init_lib")