core/actor, csys: improve testing and debugging, suppress irrelevant warnings

This commit is contained in:
Helmut Merz 2026-08-13 13:33:26 +02:00
parent e2d82fed8f
commit f9888d0830
5 changed files with 16 additions and 13 deletions

View file

@ -59,11 +59,14 @@
(defun ac-step (tsk bhv msg) (defun ac-step (tsk bhv msg)
(let ((*self* tsk)) (let ((*self* tsk))
(handler-case (funcall bhv msg) (flet ((handle-err (err)
(error (err) (let* ((st (butlast (dissect:stack) 16))
(util:lg :error "behavior" msg err)) (stack (format nil "~%~{~a~%~}" st)))
;(invoke-debugger err)) (util:lg :error "ac-step" err bhv stack tsk msg)
))) (return-from ac-step nil))))
;(dissect:with-capped-stack ()
(handler-bind ((error #'handle-err))
(funcall bhv msg)))))
;;;; the core (classical, i.e. Hewitt) actor API ;;;; the core (classical, i.e. Hewitt) actor API

View file

@ -77,7 +77,7 @@
(when addr (when addr
(register-cell (cells scope) addr new)) (register-cell (cells scope) addr new))
(let* ((ct-addr (cons :env (cdr addr))) (let* ((ct-addr (cons :env (cdr addr)))
(ct (find-cell (cells scope) ct-addr))) (ct (find-cell (cells scope) ct-addr :no-warn t)))
(when ct (csys:send-connect new ct))) (when ct (csys:send-connect new ct)))
(csys:send-message new (list (message:domain msg) :next) data) (csys:send-message new (list (message:domain msg) :next) data)
nil)) nil))
@ -130,16 +130,16 @@
(setf (gethash categ reg) idx)) (setf (gethash categ reg) idx))
(index:put idx key cell)))) (index:put idx key cell))))
(defun find-cells (reg addr) (defun find-cells (reg addr &key no-warn)
(destructuring-bind (dom cat &optional (key "")) addr (destructuring-bind (dom cat &optional (key "")) addr
(let* ((idx (gethash (list dom cat) reg)) (let* ((idx (gethash (list dom cat) reg))
(cells (when idx (index:query idx key)))) (cells (when idx (index:query idx key))))
(unless cells (unless (or no-warn cells)
(util:lgw "not found" addr reg idx)) (util:lgw "not found" addr reg idx))
cells))) cells)))
(defun find-cell (reg addr) (defun find-cell (reg addr &key no-warn)
(let ((cells (find-cells reg addr))) (let ((cells (find-cells reg addr :no-warn no-warn)))
(when (> (length cells) 1) (when (> (length cells) 1)
(util:lgw "more than one cell found" addr reg cells)) (util:lgw "more than one cell found" addr reg cells))
(car cells))) (car cells)))

View file

@ -25,7 +25,7 @@
(csys:send-create self :cat :e00 :connect :succ) (csys:send-create self :cat :e00 :connect :succ)
(csys:send-create self :cat :s00 :loc "0-1" :connect :pred) (csys:send-create self :cat :s00 :loc "0-1" :connect :pred)
(csys:send-connect self self :op (csys:multiply -1)) (csys:send-connect self self :op (csys:multiply -1))
;; switch :active ;(csys:send-switch self :active)
nil))) nil)))
;;;; basic-1: minimal cross-linked system ;;;; basic-1: minimal cross-linked system

View file

@ -6,7 +6,7 @@
:version "0.0.1" :version "0.0.1"
:homepage "https://www.cyberconcepts.org" :homepage "https://www.cyberconcepts.org"
:description "Core packages of the scopes project." :description "Core packages of the scopes project."
:depends-on (:alexandria :cl-dotenv :cl-readline :com.inuoe.jzon :depends-on (:alexandria :cl-dotenv :cl-readline :com.inuoe.jzon :dissect
:flexi-streams :ironclad :local-time :log4cl :flexi-streams :ironclad :local-time :log4cl
:lparallel :qbase64 :serapeum :str) :lparallel :qbase64 :serapeum :str)
:components ((:file "config" :depends-on ("util/util")) :components ((:file "config" :depends-on ("util/util"))

View file

@ -2,7 +2,7 @@
(in-package :scopes/test-csys) (in-package :scopes/test-csys)
(config:root) (config:root :env-keys '(:loglevel))
(config:add :logger :class 'logging:config (config:add :logger :class 'logging:config
:loglevel (config:from-env :loglevel :info) :loglevel (config:from-env :loglevel :info)