Optionally-named process behaviour functions
This commit is contained in:
parent
de1dc5aa8e
commit
03efb19a4d
|
@ -239,11 +239,16 @@
|
||||||
(define (make-quit #:exception [exn #f] . actions)
|
(define (make-quit #:exception [exn #f] . actions)
|
||||||
(quit exn actions))
|
(quit exn actions))
|
||||||
|
|
||||||
(define-syntax-rule (spawn-process behavior-exp initial-state-exp initial-action-tree-exp)
|
(define-syntax spawn-process
|
||||||
(spawn (lambda ()
|
(syntax-rules ()
|
||||||
(local-require racket/contract)
|
[(_ #:name name-exp behavior-exp initial-state-exp initial-action-tree-exp)
|
||||||
(list behavior-exp
|
(spawn (lambda ()
|
||||||
(transition initial-state-exp initial-action-tree-exp)))))
|
(list (procedure-rename behavior-exp name-exp)
|
||||||
|
(transition initial-state-exp initial-action-tree-exp))))]
|
||||||
|
[(_ behavior-exp initial-state-exp initial-action-tree-exp)
|
||||||
|
(spawn (lambda ()
|
||||||
|
(list behavior-exp
|
||||||
|
(transition initial-state-exp initial-action-tree-exp))))]))
|
||||||
|
|
||||||
(define-syntax-rule (spawn/stateless behavior-exp initial-action-tree-exp)
|
(define-syntax-rule (spawn/stateless behavior-exp initial-action-tree-exp)
|
||||||
(spawn-process (stateless-behavior-wrap behavior-exp)
|
(spawn-process (stateless-behavior-wrap behavior-exp)
|
||||||
|
|
|
@ -234,10 +234,16 @@
|
||||||
(define (make-quit #:exception [exn #f] . actions)
|
(define (make-quit #:exception [exn #f] . actions)
|
||||||
(quit exn actions))
|
(quit exn actions))
|
||||||
|
|
||||||
(define-syntax-rule (spawn-process behavior-exp initial-state-exp initial-action-tree-exp)
|
(define-syntax spawn-process
|
||||||
(spawn (lambda ()
|
(syntax-rules ()
|
||||||
(list behavior-exp
|
[(_ #:name name-exp behavior-exp initial-state-exp initial-action-tree-exp)
|
||||||
(transition initial-state-exp initial-action-tree-exp)))))
|
(spawn (lambda ()
|
||||||
|
(list (procedure-rename behavior-exp name-exp)
|
||||||
|
(transition initial-state-exp initial-action-tree-exp))))]
|
||||||
|
[(_ behavior-exp initial-state-exp initial-action-tree-exp)
|
||||||
|
(spawn (lambda ()
|
||||||
|
(list behavior-exp
|
||||||
|
(transition initial-state-exp initial-action-tree-exp))))]))
|
||||||
|
|
||||||
(define-syntax-rule (spawn/stateless behavior-exp initial-action-tree-exp)
|
(define-syntax-rule (spawn/stateless behavior-exp initial-action-tree-exp)
|
||||||
(spawn-process (stateless-behavior-wrap behavior-exp)
|
(spawn-process (stateless-behavior-wrap behavior-exp)
|
||||||
|
|
Loading…
Reference in New Issue