aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-02 23:45:29 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-02 23:45:29 +0200
commitf3825a583b218a02078d2f1adcf6d4db3e418996 (patch)
tree6703dda24d00bd724be405bda0019bd0c8eb9c29
parentRemove (util app). (diff)
downloadcalp-f3825a583b218a02078d2f1adcf6d4db3e418996.tar.gz
calp-f3825a583b218a02078d2f1adcf6d4db3e418996.tar.xz
Module cleanup.
-rw-r--r--config.scm5
-rw-r--r--module/entry-points/server.scm2
-rw-r--r--module/main.scm38
-rw-r--r--module/output/html.scm6
-rw-r--r--module/output/ical.scm4
5 files changed, 22 insertions, 33 deletions
diff --git a/config.scm b/config.scm
index e74f9541..c2d395a4 100644
--- a/config.scm
+++ b/config.scm
@@ -13,6 +13,11 @@
(util config)
(datetime)
+
+ ;; TODO this module introduces description-filter. It should be
+ ;; possible to use set-config! before the declaration point is
+ ;; known. But I currently get a config error.
+ (vcomponent datetime output)
)
(set-config! 'calendar-files (glob "~/.local/var/cal/*"))
diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm
index fd322c7d..357809b4 100644
--- a/module/entry-points/server.scm
+++ b/module/entry-points/server.scm
@@ -33,7 +33,7 @@
:use-module (output html)
:use-module (output ical)
- :autoload (vcomponent instance) (get-calendars global-event-object)
+ :autoload (vcomponent instance) (#|get-calendars|# global-event-object)
:export (main)
)
diff --git a/module/main.scm b/module/main.scm
index cd1285d0..a0708275 100644
--- a/module/main.scm
+++ b/module/main.scm
@@ -6,26 +6,13 @@
(set! (@ (global) basedir) (car %load-path))
(use-modules (srfi srfi-1)
- (srfi srfi-41)
- (srfi srfi-41 util)
(srfi srfi-88) ; keyword syntax
(util)
- (util io)
- (util time)
- (util config)
+ ((util config) :select (set-config! get-configuration-documentation))
(util options)
((util hooks) :select (shutdown-hook))
- ((entry-points html) :prefix html-)
- ((entry-points terminal) :prefix terminal-)
- ((entry-points import) :prefix import-)
- ((entry-points text) :prefix text-)
- ((entry-points ical) :prefix ical-)
- ((entry-points benchmark) :prefix benchmark-)
-
- ((entry-points server) :prefix server-)
-
(text markup)
(ice-9 getopt-long)
@@ -46,7 +33,8 @@
(description
"Start a Guile repl which can be connected to, defaults to the unix socket "
(i "/run/user/${UID}/calp-${PID}") ", but it can be bound to any unix or "
- "TCP socket. ((@ (util app) current-app)) should return the current app context."
+ "TCP socket. ((@ (vcomponent instance) global-event-object)) "
+ "should contain all events."
(br)
(b "Should NOT be used in production.")))
@@ -155,21 +143,17 @@
(current-output-port))
(throw 'return)
)
- ;; (current-app (make-app))
-
- ;; ((@ (vcomponent) init-app) (get-config 'calendar-files))
- ;; ((@ (datetime app) init-app))
(let ((ropt (ornull (option-ref opts '() '())
'("term"))))
((case (string->symbol (car ropt))
- ((html) html-main)
- ((term) terminal-main)
- ((import) import-main)
- ((text) text-main)
- ((ical) ical-main)
- ((server) server-main)
- ((benchmark) benchmark-main)
+ ((html) (@ (entry-points html) main))
+ ((term) (@ (entry-points terminal) main))
+ ((import) (@ (entry-points import) main))
+ ((text) (@ (entry-points text) main))
+ ((ical) (@ (entry-points ical) main))
+ ((server) (@ (entry-points server) main))
+ ((benchmark) (@ (entry-points benchmark) main))
(else => (lambda (s)
(format (current-error-port)
"Unsupported mode of operation: ~a~%"
@@ -185,7 +169,7 @@
(string->symbol stprof)))))
(define (main args)
- (report-time! "Program start")
+ ((@ (util time) report-time!) "Program start")
(dynamic-wind (lambda () 'noop)
(lambda () (catch 'return (lambda () (wrapped-main args)) values))
(lambda () (run-hook shutdown-hook))))
diff --git a/module/output/html.scm b/module/output/html.scm
index 6b09bebb..d2addd5a 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -19,7 +19,7 @@
#:use-module (text util)
#:use-module (vcomponent datetime output)
- #:autoload (vcomponent instance) (get-calendars get-event-set global-event-object)
+ #:autoload (vcomponent instance) (#|get-calendars get-event-set|# global-event-object)
#:use-module (git)
;; #:use-module (module config all)
@@ -818,7 +818,7 @@
(unless (file-exists? link)
(symlink "../static" link))))
-(define (html-chunked-main count start-date chunk-length)
+(define-public (html-chunked-main count start-date chunk-length)
(define calendars (get-calendars global-event-object))
(define events (get-event-set global-event-object))
@@ -853,7 +853,7 @@
-(define (html-table-main count start-date)
+(define-public (html-table-main count start-date)
(define calendars (get-calendars global-event-object))
(define events (get-event-set global-event-object))
diff --git a/module/output/ical.scm b/module/output/ical.scm
index 9ab80ffb..94622e2f 100644
--- a/module/output/ical.scm
+++ b/module/output/ical.scm
@@ -221,7 +221,7 @@ CALSCALE:GREGORIAN\r
(print-footer))
-(define (print-all-events)
+(define-public (print-all-events)
(print-components-with-fake-parent
(append (get-fixed-events global-event-object)
;; TODO RECCURENCE-ID exceptions
@@ -230,7 +230,7 @@ CALSCALE:GREGORIAN\r
;; the given date range.
(get-repeating-events global-even-object))))
-(define (print-events-in-interval start end)
+(define-public (print-events-in-interval start end)
(print-components-with-fake-parent
(append (fixed-events-in-range start end)
;; TODO RECCURENCE-ID exceptions