From 6bf086e9b22d1b56fe78dc59642589b9608ec6ab Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 25 Feb 2000 20:24:19 +0000 Subject: [PATCH] Clarify meaning of optional argument to NAME->foo procedures. --- v7/src/edwin/comman.scm | 21 ++++++++++++--------- v7/src/edwin/modes.scm | 12 +++++++----- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/v7/src/edwin/comman.scm b/v7/src/edwin/comman.scm index 937631bc9..cd1375e3b 100644 --- a/v7/src/edwin/comman.scm +++ b/v7/src/edwin/comman.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: comman.scm,v 1.82 2000/02/23 19:20:42 cph Exp $ +$Id: comman.scm,v 1.83 2000/02/25 20:24:15 cph Exp $ Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology @@ -69,23 +69,22 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (define editor-commands (make-string-table 500)) -(define (name->command name #!optional error?) +(define (name->command name #!optional if-undefined) (let ((name (canonicalize-name name))) (or (string-table-get editor-commands (symbol->string name)) - (case (if (default-object? error?) 'INTERN error?) + (case (if (default-object? if-undefined) 'INTERN if-undefined) ((#F) #f) + ((ERROR) (error "Undefined command:" name)) ((INTERN) (letrec ((command (make-command name "undefined command" '() - (lambda () - (editor-error "Undefined command: " - (command-name-string command)))))) + (lambda () (editor-error "Undefined command:" name))))) command)) (else - (error "Undefined command:" (command-name-string command))))))) + (error:bad-range-argument if-undefined 'NAME->COMMAND)))))) (define (->command object) (if (command? object) @@ -176,10 +175,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (define editor-variables (make-string-table 50)) -(define (name->variable name) +(define (name->variable name #!optional if-undefined) (let ((name (canonicalize-name name))) (or (string-table-get editor-variables (symbol->string name)) - (make-variable name "" #f #f)))) + (case (if (default-object? if-undefined) 'INTERN if-undefined) + ((#F) #f) + ((ERROR) (error "Undefined variable:" name)) + ((INTERN) (make-variable name "" #f #f)) + (else (error:bad-range-argument if-undefined 'NAME->VARIABLE)))))) (define (->variable object) (if (variable? object) diff --git a/v7/src/edwin/modes.scm b/v7/src/edwin/modes.scm index 6add53573..7e1ea03fa 100644 --- a/v7/src/edwin/modes.scm +++ b/v7/src/edwin/modes.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: modes.scm,v 1.31 2000/02/23 19:20:33 cph Exp $ +;;; $Id: modes.scm,v 1.32 2000/02/25 20:24:19 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -73,17 +73,19 @@ (define editor-modes (make-string-table)) -(define (name->mode object #!optional error?) +(define (name->mode object #!optional if-undefined) (let ((name (canonicalize-name object))) (let ((sname (symbol->string name))) (or (string-table-get editor-modes sname) - (case (if (default-object? error?) 'INTERN error?) + (case (if (default-object? if-undefined) 'INTERN if-undefined) ((#F) #f) + ((ERROR) (error "Undefined mode:" name)) ((INTERN) (make-mode name #t sname #f "" (lambda () (error "Undefined mode:" name)))) - (else - (error "Undefined mode:" name))))))) + + (else + (error:bad-range-argument if-undefined 'NAME->MODE))))))) (define (->mode object) (if (mode? object) -- 2.25.1