Changeset 7956


Ignore:
Timestamp:
Dec 26, 2007, 8:04:40 AM (12 years ago)
Author:
gb
Message:

New hash-table iteration scheme.
New WITH-PROCESS-WHOSTATE just binds a special.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/lib/macros.lisp

    r7854 r7956  
    26292629  (let* ((hash (gensym))
    26302630         (keys (gensym))
     2631         (values (gensym))
     2632         (count (gensym))
    26312633         (state (gensym)))
    26322634    `(let* ((,hash ,hash-table)
    2633             (,keys (make-array (the fixnum (hash-table-count ,hash))))
    2634             (,state (vector ,hash 0 ,keys (enumerate-hash-keys ,hash ,keys))))
    2635       (declare (dynamic-extent ,keys ,state))
    2636       (macrolet ((,mname () `(next-hash-table-iteration ,',state)))
     2635            (,count (hash-table-count ,hash))
     2636            (,keys (make-array ,count))
     2637            (,values (make-array ,count))
     2638            (,state (vector ,hash 0 ,keys ,values (enumerate-hash-keys-and-values ,hash ,keys ,values))))
     2639      (declare (dynamic-extent ,keys ,state)
     2640               (fixnum ,count))
     2641      (macrolet ((,mname () `(next-hash-table-iteration-1 ,',state)))
    26372642        ,@body))))
    26382643
     
    29872992
    29882993(defmacro with-process-whostate ((whostate) &body body)
    2989   (let* ((p (gensym))
    2990          (old-whostate (gensym)))
    2991     `(let* ((,p *current-process*)
    2992             (,old-whostate (process-whostate ,p)))
    2993       (unwind-protect
    2994            (progn
    2995              (setf (%process-whostate ,p) ,whostate)
    2996              ,@body)
    2997         (setf (%process-whostate ,p) ,old-whostate)))))
     2994  `(let* ((*whostate* ,whostate))
     2995    ,@body))
    29982996
    29992997
Note: See TracChangeset for help on using the changeset viewer.