lilu-script.ros 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. #|-*- mode:lisp -*-|#
  3. #|
  4. exec ros -Q -m my-lilu -- $0 "$@"
  5. |#
  6. (progn ;;init forms
  7. (ros:ensure-asdf)
  8. #+quicklisp(ql:quickload '(:lilu-roswell :lilu-debugger/emacs) :silent t)
  9. )
  10. (defpackage :ros.script.lilu-eval.3841829401
  11. (:use :cl))
  12. (in-package :ros.script.lilu-eval.3841829401)
  13. (opts:define-opts
  14. #.lilu-roswell:*default-help-option*
  15. #.lilu-roswell:*default-debugger-option*)
  16. (defun main (&rest argv)
  17. (lilu-roswell:init-debugging)
  18. (multiple-value-bind (options free-args)
  19. (lilu-roswell:parse-options argv
  20. :free-args-p t :min-free-args 1 :max-free-args 1)
  21. (declare (ignorable free-args))
  22. (lilu-roswell:options-check-for-help options
  23. :prefix nil
  24. :suffix nil
  25. :usage-of "lilu-script.ros"
  26. :args "FILE ...")
  27. (lilu-debugger:with-debugger
  28. ((lilu-roswell:options-get-value options :debugger))
  29. (with-open-file (stream (car free-args))
  30. ;; remove shebang
  31. (let ((first-char (read-char stream))
  32. (second-char (read-char stream)))
  33. (cond
  34. ((and (char= first-char #\#) (char= second-char #\!))
  35. (read-line stream))
  36. (t (unread-char second-char stream)
  37. (unread-char first-char stream))))
  38. (loop for sexp = (read stream nil)
  39. while sexp
  40. do
  41. (format t "R: ~A~%" (eval sexp)))))))
  42. ;;; vim: set ft=lisp lisp: