Fix system manager creation

This commit is contained in:
TakeV 2024-05-25 23:35:10 -04:00
parent 9eb5be1663
commit ee55ec59b5
Signed by: TakeV
GPG key ID: A64F41345C7400AF

View file

@ -38,26 +38,27 @@
(define (add-system-to-system-manager sys-manager sys) (define (add-system-to-system-manager sys-manager sys)
"Returns a new system manager with sys added, "Returns a new system manager with sys added,
or false if the input is invalid." or false if the input is invalid."
(let ((proc-table (system-manager-proc-table sys-manager)) (if (and (system-manager? sys-manager)
(old-systems (systems sys-manager))) (system? sys))
(if (and (system-manager? sys-manager) (let ((proc-table (system-manager-proc-table sys-manager))
(system? sys)) (old-systems (systems sys-manager)))
(make-system-manager (cons sys old-systems) (make-system-manager (cons sys old-systems) proc-table))
proc-table) (error "Invalid inputs to add-system-to-system-manager" sys-manager sys)))
(error "Invalid inputs to add-system-to-system-manager"
sys-manager sys))))
(define create-system-manager (define create-system-manager
(case-lambda (case-lambda
(() (()
(make-system-manager '() (make-eq-hashtable))) (make-system-manager '() (make-eq-hashtable)))
((sys-list) ((sys-list)
(fold (lambda (manager sys) (cond
(if (system? sys) ((list? sys-list)
(add-system-to-system-manager manager sys) (fold (lambda (manager sys)
manager)) (when (system? sys)
(create-system-manager) (add-system-to-system-manager manager sys)))
sys-list)))) (create-system-manager)
sys-list))
(else (error "Incorrect parameter passed to create-system-manager"
sys-list))))))
(define (get-procs-from-table sys-manager entity) (define (get-procs-from-table sys-manager entity)
(if (and (system-manager? sys-manager) (if (and (system-manager? sys-manager)