;;; The scsh argv switch parser. ;;; Copyright (c) 1995 by Olin Shivers. See file COPYING. ;;; Imports: ;;; COMMAND-PROCESSOR: set-batch-mode?! command-loop ;;; ENSURES-LOADED: really-ensure-loaded ;;; ENVIRONMENTS: set-interaction-environment! environment-ref ;;; environment-define! ;;; ERROR-PACKAGE: error ;;; EVALUATION: eval ;;; EXTENDED-PORTS: make-string-input-port ;;; INTERFACES: make-simple-interface ;;; INTERRUPTS: interrupt-before-heap-overflow! ;;; PACKAGE-COMMANDS-INTERNAL: user-environment config-package ;;; get-reflective-tower ;;; PACKAGE-MUTATION: package-open! ;;; PACKAGES: structure-package structure? make-structure ;;; make-simple-package ;;; RECEIVING: mv return stuff ;;; SCSH-LEVEL-0-INTERNALS: set-command-line-args! ;;; SCSH-VERSION: scsh-version-string ;;; ;;; This should be defined by the package code, but it isn't. (define (get-struct config-pack struct-name) (let ((s (environment-ref config-pack struct-name))) (cond ((structure? s) s) (else (error "not a structure" s struct-name))))) ;;; ensure-loaded and load-into now write to noise-port anyway (define (load-quietly filename p) (display "going to load now " (current-error-port)) (load-into filename p) (display "loaded " (current-error-port))) (define (really-ensure-loaded noise . structs) (apply ensure-loaded structs)) ;;; The switches: ;;; -o Open the structure in current package. ;;; -n Create new package, make it current package. ;;; -m 's package becomes current package. ;;; ;;; -l Load into current package. ;;; -lm Load into config package. ;;; ;;; These two require a terminating -s or -sfd arg: ;;; -ds Load terminating script into current package. ;;; -dm Load terminating script into config package. ;;; ;;; -e Call () to start program. ;;; ;;; Terminating switches: ;;; -c Eval , then exit. ;;; -s