mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 23:32:17 -08:00
Load-form for hash tables is now based on EXT:HASH-TABLE-FILL
This commit is contained in:
parent
05a46aca0b
commit
efc7413d28
2 changed files with 20 additions and 9 deletions
|
|
@ -143,6 +143,10 @@ ECL 11.7.1:
|
|||
invocations of the C compiler. This can be modfied by changing the type
|
||||
specifier in c:*suppress-compiler-messages*.
|
||||
|
||||
- Hash tables can now be printed readably when *READ-EVAL* is true. This is
|
||||
done using two new functions, EXT:HASH-TABLE-CONTENT and
|
||||
EXT:HASH-TABLE-FILL.
|
||||
|
||||
;;; Local Variables: ***
|
||||
;;; mode:text ***
|
||||
;;; fill-column:79 ***
|
||||
|
|
|
|||
|
|
@ -115,15 +115,22 @@ printer and we should rather use MAKE-LOAD-FORM."
|
|||
(values `(cons ,(maybe-quote (car object)) nil)
|
||||
(and (rest object) `(rplacd ,(maybe-quote object) ,(maybe-quote (cdr object))))))
|
||||
(hash-table
|
||||
(values
|
||||
`(make-hash-table :size ,(hash-table-size object)
|
||||
:rehash-size ,(hash-table-rehash-size object)
|
||||
:rehash-threshold ,(hash-table-rehash-threshold object)
|
||||
:test ',(hash-table-test object))
|
||||
`(dolist (i ',(loop for key being each hash-key in object
|
||||
using (hash-value obj)
|
||||
collect (cons key obj)))
|
||||
(setf (gethash (car i) ,object) (cdr i)))))
|
||||
(let* ((content (ext:hash-table-content object))
|
||||
(make-form `(make-hash-table
|
||||
:size ,(hash-table-size object)
|
||||
:rehash-size ,(hash-table-rehash-size object)
|
||||
:rehash-threshold ,(hash-table-rehash-threshold object)
|
||||
:test ',(hash-table-test object))))
|
||||
(if (need-to-make-load-form-p content)
|
||||
(values
|
||||
make-form
|
||||
`(dolist (i ',(loop for key being each hash-key in object
|
||||
using (hash-value obj)
|
||||
collect (cons key obj)))
|
||||
(setf (gethash (car i) ,object) (cdr i))))
|
||||
(values
|
||||
`(ext:hash-table-fill ,make-form ',content)
|
||||
nil))))
|
||||
(t
|
||||
(error "Cannot externalize object ~a" object)))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue