get red of default-actions
This commit is contained in:
parent
7628cd7e49
commit
dc37f7778a
2 changed files with 8 additions and 6 deletions
|
@ -8,7 +8,7 @@
|
|||
(:util :scopes/util)
|
||||
(:alx :alexandria))
|
||||
(:export #:action-spec #:define-actions
|
||||
#:*root* #:default-setup #:default-actions
|
||||
#:*root* #:default-setup #:actions
|
||||
#:find-service #:run-services #:setup-services #:shutdown
|
||||
#:base-context #:context #:add-action #:config #:name #:send
|
||||
#:handle-message
|
||||
|
@ -56,14 +56,14 @@
|
|||
|
||||
(defvar *root* nil)
|
||||
|
||||
;;; check / fix:
|
||||
(defvar *quit-queue* (lparallel.queue:make-queue :fixed-capacity 1))
|
||||
(defun quit-handler (sig)
|
||||
(format t "~%quit-handler: got signal ~s~%" sig)
|
||||
(lparallel.queue:push-queue sig))
|
||||
|
||||
(defclass base-context ()
|
||||
((actions :accessor actions :initform nil)
|
||||
(default-actions :reader default-actions :initform nil)))
|
||||
((actions :accessor actions :initform nil)))
|
||||
|
||||
(defclass context (base-context)
|
||||
((config :reader config :initarg :config)
|
||||
|
@ -93,6 +93,7 @@
|
|||
(unwind-protect
|
||||
(progn
|
||||
(setup-services cfg)
|
||||
;(do-listen)
|
||||
(lparallel.queue:pop-queue *quit-queue*))
|
||||
(shutdown)))
|
||||
|
||||
|
@ -110,7 +111,9 @@
|
|||
(when child
|
||||
(dolist (a (config:actions cfg))
|
||||
(add-action child (car a) (cadr a)))
|
||||
(setf (gethash (config:name cfg) services) child)))))
|
||||
(setf (gethash (config:name cfg) services) child)
|
||||
;(do-start child)
|
||||
))))
|
||||
|
||||
(defgeneric send (rcvr msg)
|
||||
(:method ((rcvr base-context) msg)
|
||||
|
@ -120,7 +123,6 @@
|
|||
(:method ((ctx base-context) msg)
|
||||
(cond
|
||||
((do-actions ctx msg) t)
|
||||
((do-actions ctx msg #'default-actions) t)
|
||||
(t (util:lgw "no action selected" msg)))))
|
||||
|
||||
(defun do-actions (ctx msg &optional (acts #'actions))
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
;;; interaction class and methods
|
||||
|
||||
(defclass interaction (core:base-context)
|
||||
((core:default-actions :initform *interaction-default-actions*)
|
||||
((core:actions :initform *interaction-default-actions*)
|
||||
(response :reader response :initarg :response)
|
||||
(messages :accessor messages :initform nil)))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue