Allow batch processing systems
This commit is contained in:
parent
42df36534e
commit
edd3d24160
2 changed files with 7 additions and 4 deletions
|
|
@ -94,12 +94,13 @@ When entities are created or removed, the creation/deletion is added to an inter
|
|||
(system-name system)
|
||||
(system-priority system)
|
||||
(set-system-priority! system priority)
|
||||
(system-mode system)
|
||||
(system-criteria system)
|
||||
(set-system-criteria! system criteria)
|
||||
(system-process system)
|
||||
(set-system-process! system process)
|
||||
#+end_src
|
||||
Functions for creating systems, which are SRFI-99 records. ~name~ must be a symbol, ~priority~ must be an integer, ~criteria~ must be a list of symbols, and ~process~ must be a single argument procedure (where the argument is an entity, a list of components, to act on).
|
||||
Functions for creating systems, which are SRFI-99 records. ~name~ must be a symbol, ~priority~ must be an integer, ~mode~ must be either ~entity~ or ~batch~, ~criteria~ must be a list of symbols, and ~process~ must be a single argument procedure (where the single argument is expected to be either a single entity matching all given criteria when the mode is ~entity~, or a list of entities matching the given criteria when the mode is ~batch~).
|
||||
|
||||
#+begin_src scheme
|
||||
(add-system system)
|
||||
|
|
|
|||
|
|
@ -140,20 +140,22 @@
|
|||
|
||||
;; The system record
|
||||
(define-record-type <system>
|
||||
(int:make-system name priority criteria process)
|
||||
(int:make-system name priority mode criteria process)
|
||||
system?
|
||||
(name system-name)
|
||||
(priority system-priority int:set-system-priority!)
|
||||
(mode system-mode)
|
||||
(criteria system-criteria int:set-system-criteria!)
|
||||
(process system-process int:set-system-process!))
|
||||
|
||||
;; Type-checked system constructor wrapper
|
||||
(define (make-system name priority criteria process)
|
||||
(define (make-system name priority mode criteria process)
|
||||
(assert (symbol? name))
|
||||
(assert (integer? priority))
|
||||
(assert (member mode '(enity batch)))
|
||||
(assert (every symbol? criteria))
|
||||
(assert (procedure? process))
|
||||
(int:make-system name priority criteria process))
|
||||
(int:make-system name priority mode criteria process))
|
||||
|
||||
;; Type-checked system priority mutator
|
||||
(define (set-system-priority! system priority)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue