csys, work in progress: environ setup: create zero neuron
This commit is contained in:
parent
20ed5134e5
commit
e3308dbf80
3 changed files with 18 additions and 9 deletions
|
|
@ -35,8 +35,8 @@
|
|||
|
||||
(defun reset-scope (scope &rest args)
|
||||
(let ((sc (apply #'scope (or (getf args :program) (program scope))
|
||||
:categ (or (getf args :categ) (categ scope))
|
||||
:environ (or (getf args :environ) (environ scope))
|
||||
:categ (getf args :categ (categ scope))
|
||||
:environ (getf args :environ (environ scope))
|
||||
args)))
|
||||
(set-proc sc)))
|
||||
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
(update nscope)))
|
||||
|
||||
(defun create (msg scope)
|
||||
(let ((new (neuron (apply #'reset scope (shape:data msg)))))
|
||||
(let ((new (neuron (apply #'reset-scope scope (shape:data msg)))))
|
||||
(notify-created msg new scope)))
|
||||
|
||||
(defun do-log (msg scope)
|
||||
|
|
@ -88,12 +88,12 @@
|
|||
(defun handle-action (msg scope &key (default #'no-op) actions params)
|
||||
(let* ((key (message:action msg))
|
||||
;(act (gethash key (actions scope) default))
|
||||
(act (getf actions key default)))
|
||||
(act (getf actions key (getf actions :default default))))
|
||||
(apply act msg scope params)))
|
||||
|
||||
(defun notify-created (msg new scope)
|
||||
(let* ((head (list (message:domain msg) :created))
|
||||
(data (util:plist-merge (shape:data scope) '(:new new :parent actor:*self*)))
|
||||
(data (util:plist-merge (shape:data msg) '(:new new :parent actor:*self*)))
|
||||
(msg1 (message:create head :data data)))
|
||||
(notify msg1 scope))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
(:local-nicknames (:actor :scopes/core/actor)
|
||||
(:csys :scopes/csys)
|
||||
(:message :scopes/core/message)
|
||||
)
|
||||
(:shape :scopes/shape))
|
||||
(:export #:actions
|
||||
#:forward))
|
||||
|
||||
|
|
@ -20,7 +20,11 @@
|
|||
'(:created #'cell-created
|
||||
:default #'csys:notify))
|
||||
|
||||
(defun cell-created (msg scope))
|
||||
(defun cell-created (msg scope)
|
||||
(let* ((data (shape:data msg))
|
||||
(addr (getf data :addr)))
|
||||
(when addr
|
||||
(register-cell (cells scope) addr (getf data :new)))))
|
||||
|
||||
(defun forward-message (head scope &key data customer)
|
||||
(forward (message:create head :data data :customer customer) scope))
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@
|
|||
)
|
||||
|
||||
(defun proc-env (msg scope)
|
||||
(let ((t:*test-suite* (csys:environ scope))) (destructuring-bind (nmsg scope)
|
||||
(let ((t:*test-suite* (csys:environ scope)))
|
||||
(destructuring-bind (nmsg scope)
|
||||
(csys:handle-action msg scope :actions (environ:actions))
|
||||
(util:lgi nmsg)
|
||||
(actor:send (core:mailbox (tc:receiver t:*test-suite*)) nmsg))))
|
||||
|
|
@ -58,7 +59,11 @@
|
|||
;(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*)))))
|
||||
:environ (tc:receiver t:*test-suite*))))
|
||||
(msg (message:create '(:csys :create)
|
||||
:data `(:addr (:csys :c00 "0-0")
|
||||
:categ :c00
|
||||
:environ ,env))))
|
||||
;(csys:create) ; or: (environ:setup program:basic-0 #'proc-env)
|
||||
))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue