removed auto run, now uses explicit command running

master
Thomas Hintz 13 years ago
parent 90ce2997d6
commit 591e4e9344

@ -0,0 +1,3 @@
(define-syntax _ (syntax-rules () ((_ . cmd) (run (fold (lambda (e o) (string-append o " " (->string e))) "" 'cmd)))))
(define-syntax _rl (syntax-rules () ((_rl . cmd) (cmd->list (fold (lambda (e o) (string-append o " " (->string e))) "" 'cmd) read-line))))
(define-syntax _rc (syntax-rules () ((_rc f . cmd) (cmd->list (fold (lambda (e o) (string-append o " " (->string e))) "" 'cmd) 'f))))

@ -1,7 +1,7 @@
# Makefile for Chicken-scheme shell
cscsh: shell.scm
csc shell.scm -o hiss
csc shell.scm -compile-syntax -o hiss
.PHONY: clean
clean:

@ -1,5 +1,6 @@
;;; documentation at http://thintz.com/chicken-scheme-shell
(use readline symbol-utils)
(use readline symbol-utils srfi-1)
(include "macros.scm")
(define (getenv2 e)
;; handles exorcism of getenv from 4.6.4 onwards
@ -21,6 +22,8 @@
(define exit? (make-parameter #f))
(define (exit) (exit? #t))
(define (%run-cmd cmd) (with-input-from-pipe cmd read-file))
; now we can can actually use things in a more lispy way
; #;1> (cmd->list "ls" read-line)
; (file1 file2 file3)
@ -42,16 +45,14 @@
(define (shell-repl)
(if (exit?)
#t
(let ((x (read)))
(handle-exceptions
exn
(begin (print-error-message exn)
(display (with-output-to-string (lambda () (print-call-chain)))))
(if (unbound? x)
(run (symbol->string x))
(display (eval x)))
(newline))
(shell-repl))))
#t
(begin (handle-exceptions
exn
(begin (print-error-message exn)
(display (with-output-to-string (lambda () (print-call-chain)))))
(let ((x (read)))
(write (eval x))))
(newline)
(shell-repl))))
(shell-repl)

Loading…
Cancel
Save