#!/usr/local/bin/euscheme -qf ; -*- Lisp -*- ; lc: lambda calculus interpreter ; Copyright (c) 2001 Ian Hickson ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ; General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; import the modules we shall use here (import "lambda-calculus-interface") (import "utilities") ;; The invalid argument condition (defcondition ) ;; main ; setup argument variables with initial values (let ((files ()) ; files to parse (quiet-mode ()) ; disables the prompts (abort-reductions-mode ())) ; in interactive mode, makes reductions abort after five seconds ; internal loop to set argument variables (defun handle-arguments (arguments index) (if (< index (size arguments)) (let* ((args (element arguments index)) (arg1 (element args 0)) (arg2 (cdr args))) (cond ((equal arg1 #\q) (setq quiet-mode 1)) ((equal arg1 #\a) (setq abort-reductions-mode 1)) ((equal arg1 #\f) (if arg2 ; "-f" arguments requires at least one filename (setq files arg2) (cerror "-f argument requires list of files to execute" ))) (t (cerror (concatenate "unknown argument: " arg1) ))) ; XXX print usage info (handle-arguments arguments (+ index 1))))) ; set argument variables (handle-arguments (process-arguments) 0) (if files ; non-interactive mode (run-files files (not quiet-mode)) (progn ; interactive mode (if (not quiet-mode) (print-intro)) (run-interactively (not quiet-mode) abort-reductions-mode)))) ;; end