diff --git a/csys/csys.lisp b/csys/csys.lisp index 562c2c8..fb9b2d9 100644 --- a/csys/csys.lisp +++ b/csys/csys.lisp @@ -23,7 +23,7 @@ (stage :accessor stage :initform :initial) (proc :accessor proc :initarg :proc :initform #'std-proc) (program :reader program :initarg :program :initform nil) - (actions :reader actions :initarg :actions :initform nil) + (actions :accessor actions :initarg :actions :initform nil) (syns :accessor syns :initform nil) (environ :reader environ :initarg :environ))) @@ -31,7 +31,10 @@ (apply #'make-instance 'scope :program program args)) (defun reset-scope (scope &rest args) - (apply #'scope (program scope) :environ (environ scope) args)) + (apply #'scope (or (getf args :program) (program scope)) + :categ (or (getf args :categ) (categ scope)) + :environ (or (getf args :environ) (environ scope)) + args)) ;;;; neurons (= async tasks) and synapses (= connections) @@ -58,8 +61,7 @@ (update nscope))) (defun create (msg scope) - ;todo: use message data for modifying new scope - (let ((new (neuron (reset scope)))) + (let ((new (neuron (apply #'reset scope (shape:data msg))))) (notify-created msg new scope))) (defun do-log (msg scope) diff --git a/csys/environ.lisp b/csys/environ.lisp index 56f5285..3c7c94a 100644 --- a/csys/environ.lisp +++ b/csys/environ.lisp @@ -6,15 +6,15 @@ (:csys :scopes/csys) (:message :scopes/core/message) ) - (:export #:send #:send-message) + (:export #:forward #:forward-message) ) (in-package :scopes/csys/environ) -(defun send-message (head data &key customer) - (send (message:create head :data data :customer customer))) +(defun forward-message (head scope &key data customer) + (forward (message:create head :data data :customer customer) scope)) -(defun send (msg) - (dolist (sn (find-sensors msg)) - (actor:send sn msg))) +(defun forward (msg scope) + (dolist (cell (find-cells (message:addr msg) scope)) + (actor:send cell msg)))