;;;; eval-server.scm - A simple DLL that evaluates Scheme expressions - felix
;
; - This doesn't check wether the output-buffer overflows!


(declare (uses extras))

(include "chicken-entry-points")

(define-entry-point 1 ([expr c-string]) (c-string)
  (let ([getmsg (condition-property-accessor 'exn 'message)]
	[getargs (condition-property-accessor 'exn 'arguments)] )
    (handle-exceptions exn
	(with-output-to-string 
	  (lambda () 
	    (print "Error: " (getmsg exn))
	    (for-each (lambda (x) (write x) (newline)) (getargs exn)) ) )
      (with-output-to-string
	(lambda () (write (eval (with-input-from-string expr read))) ) ) ) ) )
