simplify environ:send-value calls
This commit is contained in:
parent
4d37117339
commit
e53f09e3d6
3 changed files with 14 additions and 11 deletions
|
|
@ -117,7 +117,7 @@
|
|||
(when nmsg
|
||||
(setf (nth 1 (shape:head nmsg)) :effect)
|
||||
(forward nmsg (syns nscope))
|
||||
(notify nmsg nscope))
|
||||
(unless (syns nscope) (notify nmsg nscope)))
|
||||
(update nscope)))))
|
||||
|
||||
(defun handle-action (msg scope &key (default (no-op)) actions)
|
||||
|
|
|
|||
|
|
@ -8,12 +8,15 @@
|
|||
(:message :scopes/core/message)
|
||||
(:shape :scopes/shape)
|
||||
(:util :scopes/util))
|
||||
(:export #:create #:simple-proc
|
||||
(:export #:*env*
|
||||
#:create #:simple-proc
|
||||
#:actions
|
||||
#:send-value #:send-connect))
|
||||
|
||||
(in-package :scopes/csys/environ)
|
||||
|
||||
(defvar *env* nil)
|
||||
|
||||
(defclass scope (csys:scope)
|
||||
((cells :reader cells :initform (make-hash-table :test #'equal))))
|
||||
|
||||
|
|
@ -92,9 +95,9 @@
|
|||
|
||||
;;;; public shortcuts
|
||||
|
||||
(defun send-value (env val &key (domain :csys) (cat :c00) (loc ""))
|
||||
(let ((head (list domain :value cat loc)))
|
||||
(actor:send env (message:create head :data `(:value ,val)))))
|
||||
(defun send-value (cat-loc val &key (domain :csys) (env *env*))
|
||||
(let ((head (cons domain (cons :value cat-loc))))
|
||||
(actor:send env (message:create head :data `(:value ,val)))))
|
||||
|
||||
(defun send-connect (env &rest args &key (domain :csys) addr to target op)
|
||||
(let ((head (list domain :connect)))
|
||||
|
|
|
|||
|
|
@ -67,19 +67,19 @@
|
|||
;;;; test definitions
|
||||
|
||||
(deftest test-basic-0 ()
|
||||
(let ((env (setup-test (list (program:basic-0)))))
|
||||
(let ((environ:*env* (setup-test (list (program:basic-0)))))
|
||||
;(rcvr (tc:receiver t:*test-suite*))
|
||||
(sleep 0.1)
|
||||
;(tc:expect rcvr (message:create '(:csys :effect :e01) :data '(:value 1)))
|
||||
(environ:send-value env 1 :cat :s01 :loc "0-1")
|
||||
(environ:send-value env 2 :cat :s01 :loc "0-1")
|
||||
(environ:send-value '(:s01 "0-1") 1)
|
||||
(environ:send-value '(:s01 "0-1") 2)
|
||||
(sleep 0.1)
|
||||
(core:shutdown)))
|
||||
|
||||
(deftest test-basic-1 ()
|
||||
(let ((env (setup-test (program:config-basic-1))))
|
||||
(let ((environ:*env* (setup-test (program:config-basic-1))))
|
||||
(sleep 0.1)
|
||||
(environ:send-value env 1 :cat :s00 :loc "0-0")
|
||||
(environ:send-value env 2 :cat :s00 :loc "0-1")
|
||||
(environ:send-value '(:s00 "0-0") 1)
|
||||
(environ:send-value '(:s00 "0-1") 2)
|
||||
(sleep 0.1)
|
||||
(core:shutdown)))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue