6 (define (skip-head-match orig match)
13 (if (equal? (car orig*)
19 (define (basepath str)
23 (reverse (string->list str))
24 (reverse (string->list ".scm"))))))
26 ;; quick solution just differentiating between signals and exits.
27 ;; todo: is even this part portable? probably not.
28 ;; (and further explanations are missing anyway)
29 (define (status->string s)
31 "exited successfully")
33 (string-append "exited with exit code "
34 (number->string (arithmetic-shift s -8))))
36 (error "negative status" s))
37 ((string-append "terminated by signal "
38 (number->string s)))))
39 ;;^ doesn't check for the case where both exit code and signal is non-zero.
42 (define (run cmd . args)
43 (let ((p (open-process (list path: (path-expand cmd)
46 stdout-redirection: #f
47 stderr-redirection: #f))))
48 (let ((s (process-status p)))
52 (error (string-append "command "
58 ;; --- / library stuff
61 (define prog (car (command-line)))
62 (define args (cdr (command-line)))
64 (define (usage maybe-err)
68 (list maybe-err "\n\n")
70 "usage: "prog" path/to/file.scm"))
74 (if (= (length args) 1)
75 (let ((base (basepath (car args))))
76 (run "picobit" (string-append base ".scm"))
77 (run "picobit-vm" (string-append base ".hex")))
78 (usage "wrong number of arguments"))