environ:create, with fixes / improvemenst on csys:scope
This commit is contained in:
parent
baf46a36d4
commit
85c23f10e0
3 changed files with 15 additions and 10 deletions
|
|
@ -29,16 +29,18 @@
|
|||
(syns :accessor syns :initform nil)
|
||||
(environ :reader environ :initarg :environ)))
|
||||
|
||||
(defun scope (&optional (program (make-prog #'std-proc)) &rest args)
|
||||
(let ((sc (apply #'make-instance 'scope :program program args)))
|
||||
(set-proc sc)))
|
||||
(defun scope (program &rest args &key (cls 'scope) &allow-other-keys)
|
||||
(remf args :cls)
|
||||
(apply #'make-instance cls :program program args))
|
||||
|
||||
(defmethod initialize-instance :after ((sc scope) &key &allow-other-keys)
|
||||
(set-proc sc))
|
||||
|
||||
(defun reset-scope (scope &rest args)
|
||||
(let ((sc (apply #'scope (or (getf args :program) (program scope))
|
||||
(apply #'scope (or (getf args :program) (program scope))
|
||||
:categ (getf args :categ (categ scope))
|
||||
:environ (getf args :environ (environ scope))
|
||||
args)))
|
||||
(set-proc sc)))
|
||||
args))
|
||||
|
||||
(defun set-proc (scope)
|
||||
(setf (proc scope) (funcall (program scope) scope))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
(:index :scopes/util/index)
|
||||
(:message :scopes/core/message)
|
||||
(:shape :scopes/shape))
|
||||
(:export #:actions
|
||||
(:export #:create
|
||||
#:actions
|
||||
#:forward))
|
||||
|
||||
(in-package :scopes/csys/environ)
|
||||
|
|
@ -15,6 +16,10 @@
|
|||
(defclass scope (csys:scope)
|
||||
((cells :reader cells :initform (make-hash-table :test #'equal))))
|
||||
|
||||
(defun create (proc app)
|
||||
(let ((prog (csys:make-prog proc)))
|
||||
(csys:neuron (csys:scope prog :cls 'scope :environ app))))
|
||||
|
||||
;;;; action handlers, public callables
|
||||
|
||||
(defun actions ()
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@
|
|||
(core:setup-services)
|
||||
(setf (tc:receiver t:*test-suite*) (core:find-service :test-receiver))
|
||||
;(csys:add-action '(:csys :sensor) #'csys:create-sensor)
|
||||
(let* ((prog (csys:make-prog #'proc-env))
|
||||
(env (csys:neuron (csys:scope prog
|
||||
:environ (tc:receiver t:*test-suite*))))
|
||||
(let* ((env (environ:create #'proc-env (tc:receiver t:*test-suite*)))
|
||||
(msg (message:create '(:csys :create)
|
||||
:data `(:addr (:csys :c00 "0-0")
|
||||
:categ :c00
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue