changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/cli/repl/top-level.lisp

changeset 698: 96958d3eb5b0
parent: 0f0e5f9b5c55
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 (in-package :cli/repl)
2 
3 ;;; TOPLEVEL
4 
5 ;; These macros help with defining a toplevel initialization
6 ;; function. Initialization functions are responsible for parsing runtime
7 ;; options and starting a REPL if needed.
8 ;; (defmacro define-toplevel-init (name (props opts) &body body))
9 ;; (defmacro define-toplevel-repl (name (props opts) &body body))
10 
11 (defun default-toplevel-init ()
12  (let ((opts (cdr *posix-argv*))
13  (sysinit))
14  (declare (type list opts))
15  (flet (($pop ()
16  (if opts
17  (pop opts)
18  (sb-impl::startup-error "unexpected end of cli opts"))))
19  (loop while opts do
20  (let ((opt (car opts)))
21  (cond
22  ((string= opt "--sysinit")
23  ($pop)
24  (if sysinit
25  (sb-impl::startup-error "multiple --sysinit opts")
26  (setf sysinit ($pop))))
27  (t
28  (if (find "--end-toplevel-options" opts
29  :test #'string=)
30  (sb-impl::startup-error "bad toplevel opt: ~S"
31  (car opts))
32  (return))))))
33  (when *posix-argv*
34  (setf (cdr *posix-argv*) opts)))))
35