core: minor improvements: intializations, exports, ...
This commit is contained in:
parent
e19b60bf9f
commit
ae24fabee5
2 changed files with 8 additions and 11 deletions
|
@ -4,11 +4,9 @@
|
|||
(:use :common-lisp)
|
||||
(:local-nicknames (:config :scopes/config)
|
||||
(:message :scopes/core/message))
|
||||
(:export #:*root* #:setup #:find-service
|
||||
#:config #:service-config
|
||||
#:name #:start #:actions
|
||||
#:context #:add-action #:add-service #:send
|
||||
#:action-spec
|
||||
(:export #:config #:service-config
|
||||
#:context #:*root* #:setup #:find-service
|
||||
#:name #:send
|
||||
#:printer))
|
||||
|
||||
(in-package :scopes/core)
|
||||
|
@ -19,7 +17,7 @@
|
|||
|
||||
(defclass service-config (config:base)
|
||||
((name :reader name :initarg :name)
|
||||
(start :reader start :initarg :start :initform nil)
|
||||
(start :reader start :initarg :start :initform #'default-start)
|
||||
(actions :reader actions :initarg :actions :initform nil)))
|
||||
|
||||
;;;; actions
|
||||
|
@ -56,7 +54,10 @@
|
|||
(defclass context ()
|
||||
((config :reader config :initarg :config)
|
||||
(actions :accessor actions :initform nil)
|
||||
(services :accessor services :initform nil)))
|
||||
(services :initform (make-hash-table))))
|
||||
|
||||
(defun default-start (cfg)
|
||||
(make-instance 'context :config cfg))
|
||||
|
||||
(defun find-service (name)
|
||||
(with-slots (services) *root*
|
||||
|
@ -78,9 +79,6 @@
|
|||
|
||||
(defun add-service (ctx cfg)
|
||||
(with-slots (services) ctx
|
||||
(unless services
|
||||
(setf services (make-hash-table)))
|
||||
;(let ((child (make-instance 'context :config cfg)))
|
||||
(let ((child (funcall (start cfg) cfg)))
|
||||
(dolist (a (actions cfg))
|
||||
(add-action child (car a) (cadr a)))
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
(t:*test-suite* (make-instance 'test-suite :name "core")))
|
||||
(log4cl:log-config :sane :daily (t:test-path "scopes-test.log" "log"))
|
||||
(load (t:test-path "config-core" "etc"))
|
||||
;(core:add-action rcvr '(:test) #'check-message)
|
||||
(core:setup *config*)
|
||||
(setf (receiver t:*test-suite*) (core:find-service :test-receiver))
|
||||
(test-send)
|
||||
|
|
Loading…
Add table
Reference in a new issue