removed auto run, now uses explicit command running

master
Thomas Hintz 12 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 # Makefile for Chicken-scheme shell
cscsh: shell.scm cscsh: shell.scm
csc shell.scm -o hiss csc shell.scm -compile-syntax -o hiss
.PHONY: clean .PHONY: clean
clean: clean:

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

Loading…
Cancel
Save