On 7/19/05, Daishi Kato <[EMAIL PROTECTED]> wrote:
> 
> Then, I would make a perl script to communicate with "my-http-server"
> and translate the S-expression command to any format,
> but the point is I would like to compile it.
> 
> Does this make sense?
> 

Absolutely. You can try out Thomas' suggestions. Alternatively, this is the code
from srfi-18.scm, that makes the repl non-blocking:

  (set! ##sys#read-prompt-hook
    (let ([old ##sys#read-prompt-hook]
          [thread-yield! thread-yield!] )
      (lambda ()
        (when (or (##sys#fudge 12) (##sys#tty-port? ##sys#standard-input))
          (old)
          (##sys#thread-block-for-i/o! ##sys#current-thread 0 #t)
          (thread-yield!)))) ) )

Here is an adaption that might work:

(use srfi-18) 

(thread-start!
 (lambda ()
   (let loop ((i 1))
     (thread-sleep! 1)
     (print "[" i "]")
     (loop (add1 i)))))

(define (my-repl)
  (let loop ()
    (print* "my-server> ")
    (##sys#thread-block-for-i/o! (current-thread) 0 #t)
    (thread-yield!)
    (pp `(READ: ,(read)))
    (loop) ) )

(my-repl)


cheers,
felix


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to