Add error checking to symbol operations.
authorChris Hanson <org/chris-hanson/cph>
Thu, 4 Jan 1990 06:43:35 +0000 (06:43 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 4 Jan 1990 06:43:35 +0000 (06:43 +0000)
v7/src/runtime/scode.scm

index 8e8f5c338dd9303b84d1bed8563a6b2c1d500b18..65d51a930cea95a46cb17c959bd645ac3b7553c7 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/scode.scm,v 14.6 1989/08/17 14:51:17 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/scode.scm,v 14.7 1990/01/04 06:43:35 cph Exp $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -102,7 +102,9 @@ MIT in each case. |#
   (or (object-type? (ucode-type interned-symbol) object)
       (object-type? (ucode-type uninterned-symbol) object)))
 
-(define-integrable (string->uninterned-symbol string)
+(define (string->uninterned-symbol string)
+  (if (not (string? string))
+      (error error-type:wrong-type-argument string))
   (&typed-pair-cons (ucode-type uninterned-symbol)
                    string
                    (make-unbound-reference-trap)))
@@ -110,20 +112,25 @@ MIT in each case. |#
 (define-integrable string->symbol
   (ucode-primitive string->symbol))
 
-(define-integrable (symbol->string symbol)
-  (string-copy (system-pair-car symbol)))
-
 (define-integrable (intern string)
   (string->symbol (string-downcase string)))
 
-(define-integrable (symbol-hash symbol)
-  (string-hash (system-pair-car symbol)))
+(define (symbol-name symbol)
+  (if (not (symbol? symbol))
+      (error error-type:wrong-type-argument symbol))
+  (symbol-name symbol))
+
+(define-integrable (symbol->string symbol)
+  (string-copy (symbol-name symbol)))
 
 (define (symbol-append . symbols)
-  (let ((string (apply string-append (map system-pair-car symbols))))
+  (let ((string (apply string-append (map symbol-name symbols))))
     (string-downcase! string)
     (string->symbol string)))
 
+(define-integrable (symbol-hash symbol)
+  (string-hash (symbol-name symbol)))
+
 ;;;; Variable
 
 (define-integrable (make-variable name)