X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=sam.git;a=blobdiff_plain;f=chat_client.scm;h=4bf02d8f018bbd17f004e0ce406d43755b2866a8;hp=60d0ee4ca312bbccf0556f92cd31cd0c97422f7d;hb=38a62fdef7fe2929d7e0bba8a847a3e1cc50c177;hpb=e00264f0f59bbddc6eded6747d2d272840a9662b diff --git a/chat_client.scm b/chat_client.scm index 60d0ee4..4bf02d8 100644 --- a/chat_client.scm +++ b/chat_client.scm @@ -3,10 +3,9 @@ srfi-13 (chicken process-context)) -(define client-beh +(define (make-client-beh system) (let ((name "name") (recipients '())) - (lambda (self . message) (match message (('start) @@ -67,6 +66,10 @@ (send-message system 'read self) 'sleep))) +(define (main-beh self system) + (send-message (make-actor (make-client-beh system)) 'start) + 'done) + (define (print-usage) (print "Actor-driven chat client.\n") (print "Usage: chat_client -h") @@ -83,9 +86,7 @@ (((or "-n" "--hostname") hstr rest ...) (loop rest hstr port)) (() - (init-sam host port) - (send-message (make-actor client-beh) 'start) - (start-console)) + (boot-sam host port main-beh)) (else (print "Unrecognised argument '" (car args) "'.\n") (print-usage))))