From f0f3cbcadc16454ded8fe25568dbbcbfc020b91f Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 6 Jan 2012 16:18:40 -0700 Subject: [PATCH] Fixed CREF to handle uninterned symbols. "Names" (aka "binding-names") are symbols OR uninterned symbols, and NOT sortable. Replaced the rb-trees with hash tables. This banished the bogus complaints about free references to e.g. .tag.1 in compiler, edwin and imail. --- src/cref/forpkg.scm | 21 ++++++++------------- src/cref/make.scm | 1 - src/cref/object.scm | 38 +++++++++++++++++++++++++++++--------- src/cref/redpkg.scm | 15 +++++++-------- 4 files changed, 44 insertions(+), 31 deletions(-) diff --git a/src/cref/forpkg.scm b/src/cref/forpkg.scm index 7c8d5786c..1ad91e206 100644 --- a/src/cref/forpkg.scm +++ b/src/cref/forpkg.scm @@ -207,12 +207,12 @@ USA. destination-binding) (let ((local-name (binding/name local-binding)) (remote-name (binding/name remote-binding))) - (let ((name-string (binding-name->string local-name))) + (let ((name-string (name->string local-name))) (if (eq? local-name remote-name) name-string (string-append name-string " [" - (binding-name->string remote-name) + (name->string remote-name) "]")))))))) (define (local-map/export source destination) @@ -255,12 +255,12 @@ USA. (for-each (lambda (reference) (format-expressions port indentation width package - (binding-name->string (reference/name reference)) + (name->string (reference/name reference)) (reference/expressions reference))) references)) (define (format-expressions port indentation width package name expressions) - (receive (symbols pairs) + (receive (names pairs) (classify-expression-names (map (lambda (expression) (expression->name expression package)) @@ -270,7 +270,7 @@ USA. (newline port) (let ((indentation (new-indentation indentation))) (write-strings/compact port indentation width - (map symbol-name (sort symbols symbolstring names) stringstring (binding/name binding))) - -(define (binding-name->string name) - (if (symbol? name) - (symbol-name name) - (write-to-string name))) + (name->string (binding/name binding))) (define (package/name-string package) (package-name->string (package/name package))) @@ -357,5 +352,5 @@ USA. (define (package-name->string name) (string-append "(" (decorated-string-append "" " " "" - (map binding-name->string name)) + (map name->string name)) ")")) \ No newline at end of file diff --git a/src/cref/make.scm b/src/cref/make.scm index 6e8ecfad1..ba7d06520 100644 --- a/src/cref/make.scm +++ b/src/cref/make.scm @@ -28,7 +28,6 @@ USA. (declare (usual-integrations)) -(load-option 'RB-TREE) (with-loader-base-uri (system-library-uri "cref/") (lambda () (load-package-set "cref"))) diff --git a/src/cref/object.scm b/src/cref/object.scm index 3f6f272c6..6b240fcae 100644 --- a/src/cref/object.scm +++ b/src/cref/object.scm @@ -59,8 +59,8 @@ USA. (files '()) parent (children '()) - (bindings (make-rb-tree eq? symbolstring)) +(define (name->string name) + (if (interned-symbol? name) + (symbol-name name) + (write-to-string name))) + +(define-integrable (namestring x) (name->string y))) + +(define-integrable (binding