csys/environ, basically working: connect eff cells to contact cells if present

This commit is contained in:
Helmut Merz 2026-08-07 10:36:06 +02:00
parent 8d153001fd
commit cd30c9226e
2 changed files with 17 additions and 11 deletions

View file

@ -116,6 +116,7 @@
(handle-action msg scope :default (no-op) :actions actions)
(when nmsg
(setf (nth 1 (shape:head nmsg)) :effect)
(forward nmsg (syns nscope))
(notify nmsg nscope))
(update nscope)))))
@ -188,6 +189,9 @@
;;;; public shortcuts
(defun send-message (cell head data)
(actor:send cell (message:create head :data data)))
(defun send-create (cell &rest args &key (domain :csys)
(cat :c00) loc connect op &allow-other-keys)
(let ((args+ (if loc

View file

@ -17,8 +17,7 @@
(defclass scope (csys:scope)
((cells :reader cells :initform (make-hash-table :test #'equal))))
(defun create (proc meta-env &key eff-contacts) ; (csys:printer)
;; + create contact cells (<- &key eff-contacts)
(defun create (proc meta-env &key eff-contacts) ; meta-env example: (csys:printer)
(let* ((prg (csys:make-program proc))
(scope (csys:scope prg meta-env :cls 'scope :categ '(:env :c00)))
(env (csys:neuron scope)))
@ -38,16 +37,18 @@
((loc :reader loc :initarg :loc)))
(defun create-contact-cells (eff-contacts env cells)
(util:loop-plist eff-contacts cat loc do
(let ((ct (csys:neuron
(csys:scope (csys:make-program #'proc-contact) env
:cls 'contact-scope
:categ (list :env cat) :loc loc))))
(register-cell cells (list :env cat loc) ct))))
(util:loop-plist eff-contacts cat locs do
(dolist (loc locs)
(let ((ct (csys:neuron
(csys:scope (csys:make-program #'proc-contact) env
:cls 'contact-scope
:categ (list :env cat) :loc loc))))
;(util:lgi cells cat loc)
(register-cell cells (list :env cat loc) ct)))))
(defun proc-contact (msg scope)
(setf (nth 3 (shape:head msg)) (loc scope))
(actor:send (env scope) msg))
(actor:send (csys:environ scope) msg))
;;;; action handlers
@ -65,8 +66,9 @@
(new (getf data :new)))
(when addr
(register-cell (cells scope) addr new))
;; check: if corresponding env (contact) cell present? e.g. (:env :e00 "1-0")
;; => connect
(let* ((ct-addr (cons :env (cdr addr)))
(ct (find-cell (cells scope) ct-addr)))
(when ct (csys:send-connect new ct)))
;(csys:send-message new (list (message:domain msg) :next) :data data)
(actor:send new
(message:create (list (message:domain msg) :next) :data data))