aboutsummaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/vcomponent.scm6
-rw-r--r--module/vcomponent/base.scm24
-rw-r--r--module/vcomponent/primitive.scm30
3 files changed, 36 insertions, 24 deletions
diff --git a/module/vcomponent.scm b/module/vcomponent.scm
index cc79b646..fc360486 100644
--- a/module/vcomponent.scm
+++ b/module/vcomponent.scm
@@ -1,5 +1,5 @@
(define-module (vcomponent)
- #:use-module ((vcomponent primitive) :select (%vcomponent-make))
+ #:use-module ((vcomponent primitive) :select (parse-path make-vcomponent))
#:use-module (vcomponent datetime)
#:use-module (vcomponent recurrence)
#:use-module (vcomponent timezone)
@@ -81,8 +81,8 @@
(define* (make-vcomponent #:optional path)
(if (not path)
- (%vcomponent-make)
- (let* ((root (%vcomponent-make path))
+ (make-vcomponent)
+ (let* ((root (parse-path path))
(component
(case (string->symbol (or (attr root "X-HNH-SOURCETYPE") "no-type"))
;; == Single ICS file ==
diff --git a/module/vcomponent/base.scm b/module/vcomponent/base.scm
index fd8628f9..4b49ba66 100644
--- a/module/vcomponent/base.scm
+++ b/module/vcomponent/base.scm
@@ -6,11 +6,16 @@
:use-module ((ice-9 optargs) :select (define*-public)))
(define (get-attr component attr)
+ (hash-ref (struct-ref component 3)
+ (as-string attr))
+ #;
(%vcomponent-get-attribute
component
(as-string attr)))
(define (set-attr! component attr value)
+ 'noop
+ #;
(set! (car (get-attr component (as-string attr)))
value))
@@ -49,21 +54,24 @@
(hash-map->list cons (cdar attrptr)))
(define-public type (make-procedure-with-setter
- %vcomponent-get-type
- %vcomponent-set-type!))
-(define-public parent %vcomponent-parent)
-(define-public push-child! %vcomponent-push-child!)
-(define-public (attributes component) (map string->symbol (%vcomponent-attribute-list component)))
+ (lambda (c) (struct-ref c 0))
+ (lambda (c v) struct-set! c 0 v)
+ ))
+(define-public (parent c) (struct-ref c 2))
+(define-public push-child! add-child!)
+(define-public (attributes component) '("noop")
+ #; (map string->symbol (%vcomponent-attribute-list component))
+ )
(define*-public (children component #:optional only-type)
- (let ((childs (%vcomponent-children component)))
+ (let ((childs (slot-ref component 1)))
(if only-type
(filter (lambda (e) (eq? only-type (type e))) childs)
childs)))
-(define-public copy-vcomponent %vcomponent-shallow-copy)
+;; (define-public copy-vcomponent %vcomponent-shallow-copy)
-(define-public filter-children! %vcomponent-filter-children!)
+;; (define-public filter-children! %vcomponent-filter-children!)
(define-public (extract field)
(lambda (e) (attr e field)))
diff --git a/module/vcomponent/primitive.scm b/module/vcomponent/primitive.scm
index ad33a3be..e103feae 100644
--- a/module/vcomponent/primitive.scm
+++ b/module/vcomponent/primitive.scm
@@ -1,19 +1,23 @@
;;; Primitive export of symbols linked from C binary.
(define-module (vcomponent primitive)
- #:export (%vcomponent-children
- %vcomponent-push-child!
- %vcomponent-filter-children!
+ #:export #;
+ (%vcomponent-children ;
+ %vcomponent-push-child! ;
+ %vcomponent-filter-children! ;
+ ;
+ %vcomponent-parent ;
+ ;
+ %vcomponent-make ;
+ %vcomponent-get-type ;
+ %vcomponent-set-type! ;
+ ;
+ %vcomponent-get-attribute ;
+ %vcomponent-attribute-list ;
+ ;
+ %vcomponent-shallow-copy)
- %vcomponent-parent
-
- %vcomponent-make
- %vcomponent-get-type
- %vcomponent-set-type!
-
- %vcomponent-get-attribute
- %vcomponent-attribute-list
-
- %vcomponent-shallow-copy))
+ (make-vcomponent add-line! add-child! make-vline add-attribute! parse-path)
+ )
(load-extension "libguile-calendar" "init_lib")