fisl

fisl is scheme lox
git clone git://git.alexkarle.com.com/fisl
Log | Files | Refs | README | LICENSE

util.scm (401B) [raw]


      1 ;; util.scm -- shared utils (no deps!)
      2 (import (chicken format)
      3 	(chicken io))
      4 
      5 (define had-err #f)
      6 (define fname "repl")
      7 
      8 (define (set-fname! fn)
      9   (set! fname fn))
     10 
     11 (define (err! str)
     12   (set! had-err #t)
     13   (fprintf (current-error-port) "~A\n" str))
     14 
     15 (define (fname-err! str)
     16   (err! (format "~A:~A" fname str)))
     17 
     18 (define (clear-err!)
     19   (set! had-err #f))
     20 
     21 (define (die str)
     22   (err! str)
     23   (exit 1))