changeset 285: |
0029791b33dd |
parent 284: |
597f34d43df7 |
child 286: |
237756e1358b |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Thu, 18 Apr 2024 21:03:49 -0400 |
files: |
lisp/app/bin/skel.lisp x.lisp |
description: |
x run |
1.1--- a/lisp/app/bin/skel.lisp Thu Apr 18 18:30:58 2024 -0400
1.2+++ b/lisp/app/bin/skel.lisp Thu Apr 18 21:03:49 2024 -0400
1.3@@ -1,6 +1,7 @@
1.4 ;;; Code:
1.5 (uiop:define-package :bin/skel
1.6- (:use :cl :std :cli :skel :log :vc)
1.7+ (:use :cl :std :cli :vc :sb-ext)
1.8+ (:use-reexport :skel :log)
1.9 (:export :main))
1.10
1.11 (in-package :bin/skel)
1.12@@ -34,11 +35,11 @@
1.13 :load t)))
1.14
1.15 (defcmd skc-inspect
1.16- (inspect
1.17- (find-skelfile
1.18- (if $args (pathname (car $args))
1.19- #P".")
1.20- :load t)))
1.21+ (inspect
1.22+ (find-skelfile
1.23+ (if $args (pathname (car $args))
1.24+ #P".")
1.25+ :load t)))
1.26
1.27 (defcmd skc-show
1.28 (if $args
1.29@@ -113,6 +114,9 @@
1.30
1.31 (defun run ()
1.32 (let ((*log-level* :info))
1.33+ (in-package :std-user)
1.34+ (in-package :skel)
1.35+ (use-package :sb-ext)
1.36 (in-readtable :shell)
1.37 (with-cli (opts cmds) $cli
1.38 (load-skelrc)
2.1--- a/x.lisp Thu Apr 18 18:30:58 2024 -0400
2.2+++ b/x.lisp Thu Apr 18 21:03:49 2024 -0400
2.3@@ -27,6 +27,7 @@
2.4
2.5 (asdf:load-asd (probe-file (merge-pathnames "std.asd" "lisp/std/std.asd")))
2.6 (asdf:load-system :std)
2.7+
2.8 (defpackage :x
2.9 (:use :cl :std :std/named-readtables)
2.10 (:export :*core-path* :*lisp-path* :*lib-path* :*std-path* :*ffi-path* :*stash-path* :*app-path* :*bin-path*))
2.11@@ -48,6 +49,7 @@
2.12 (push *lib-path* ql:*local-project-directories*)
2.13 (push *bin-path* ql:*local-project-directories*)
2.14 (push *ffi-path* ql:*local-project-directories*)
2.15+
2.16 (ql:register-local-projects)
2.17
2.18 (unless (asdf:find-system :log nil)
2.19@@ -116,11 +118,6 @@
2.20 :test #'string=
2.21 :key #'car)))
2.22
2.23-(defun setflag (k v)
2.24- (setf
2.25- (getflag k)
2.26- v))
2.27-
2.28 (defun parse-flag (arg)
2.29 (flet ((f (k)
2.30 (if (or (characterp k) (= (length k) 1))
2.31@@ -145,7 +142,13 @@
2.32 (ql:quickload sys)
2.33 (asdf:make sys))))
2.34
2.35-(defun x-run (&optional args))
2.36+(defun x-run (&optional args)
2.37+ (if args
2.38+ (let* ((name (car args))
2.39+ (path (merge-pathnames name *stash-path*)))
2.40+ (unless (probe-file path)
2.41+ (sb-ext:run-program "x" (list "build" name) :wait t))
2.42+ (sb-ext:run-program path (cdr args) :output t))))
2.43
2.44 (defun x-test (&optional args)
2.45 (if args
2.46@@ -158,7 +161,9 @@
2.47 (if (null *args*)
2.48 (progn
2.49 (println "Welcome to CORE/X")
2.50- (in-package :std-user)
2.51+ (use-package :cl-user)
2.52+ (use-package :sb-ext)
2.53+ (use-package :std-user)
2.54 (sb-impl::toplevel-repl nil))
2.55 (let ((cmd (pop *args*)))
2.56 (cond
2.57@@ -182,9 +187,17 @@
2.58 (string-case (name)
2.59 ("prelude" (compile-prelude t))
2.60 ("std" (compile-std t))))
2.61- ;; self save
2.62+ ;; self save
2.63 (progn
2.64 (info! "saving self to ./x")
2.65+ (eval
2.66+ (read-from-string
2.67+ (with-open-file (f (merge-pathnames "x.lisp" *core-path*))
2.68+ ;; skip shebang
2.69+ (read-line f t)
2.70+ (with-output-to-string (s)
2.71+ (copy-stream f s)))
2.72+ nil))
2.73 (sb-ext:save-lisp-and-die "x"
2.74 :toplevel #'x-init
2.75 ;; :callable-exports '("compile_std" "compile_prelude")
2.76@@ -193,4 +206,3 @@
2.77 :save-runtime-options t))))
2.78
2.79 (x-save)
2.80-;; (x-repl)