diff --git a/core/core.lisp b/core/core.lisp index 13827a6..e86102d 100644 --- a/core/core.lisp +++ b/core/core.lisp @@ -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))) diff --git a/test/test-core.lisp b/test/test-core.lisp index 4634677..a5142e6 100644 --- a/test/test-core.lisp +++ b/test/test-core.lisp @@ -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)