Changeset 12928


Ignore:
Timestamp:
09/28/10 18:21:06 (13 years ago)
Author:
astalla
Message:

Fixes in java collections support (iterators) and dosequence (wrong call to parse-body)

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/extensible-sequences.lisp

    r12517 r12928  
    997997(defmacro dovector ((elt vector &optional result) &body body)
    998998  (multiple-value-bind (forms decls)
    999       (sys:parse-body body :doc-string-allowed nil)
     999      (sys:parse-body body nil)
    10001000    (let ((index (gensym "INDEX")) (length (gensym "LENGTH")) (vec (gensym "VEC")))
    10011001      `(let ((,vec ,vector))
     
    10161016  (declare (ignore from-end start end))
    10171017  (multiple-value-bind (forms decls)
    1018       (sys:parse-body body :doc-string-allowed nil)
     1018      (sys:parse-body body nil)
    10191019    (let ((s sequence)
    10201020          (sequence (gensym "SEQUENCE")))
  • trunk/abcl/src/org/armedbear/lisp/java-collections.lisp

    r12833 r12928  
    6565    ((s (jclass "java.util.List")) &key from-end (start 0) end)
    6666  (let* ((end (or end (length s)))
    67    (index (if from-end (1- end) start))
     67   (index (if from-end end start))
    6868   (it (jcall "listIterator" s index))
    6969   (iter (make-jlist-iterator :native-iterator it
    70             :index (if from-end (1+ index)
    71                  (1- index))))
    72    (limit (if from-end start (1- end))))
     70            :index (if from-end (1+ index) (1- index))))
     71   (limit (if from-end (1+ start) (1- end))))
    7372    ;;CL iterator semantics are that first element is present from the start
    7473    (unless (sequence:iterator-endp s iter limit from-end)
     
    7978(defmethod sequence:iterator-step
    8079    ((s (jclass "java.util.Collection")) it from-end)
    81   (if from-end
    82       (progn
    83   (setf (jlist-it-element it)
    84         (jcall "previous" (jlist-it-native-iterator it)))
    85   (decf (jlist-it-index it)))
    86       (progn
    87   (setf (jlist-it-element it)
    88         (jcall "next" (jlist-it-native-iterator it)))
    89   (incf (jlist-it-index it))))
     80  (let ((native-it (jlist-it-native-iterator it)))
     81    (if from-end
     82  (progn
     83    (setf (jlist-it-element it)
     84    (when (jcall "hasPrevious" native-it)
     85      (jcall "previous" native-it)))
     86    (decf (jlist-it-index it)))
     87  (progn
     88    (setf (jlist-it-element it)
     89    (when (jcall "hasNext" native-it)
     90      (jcall "next" native-it)))
     91    (incf (jlist-it-index it)))))
    9092  it)
    9193
     
    9395    ((s (jclass "java.util.Collection")) it limit from-end)
    9496  (if from-end
    95       (<= (jlist-it-index it) limit)
    96       (>= (jlist-it-index it) limit)))
     97      (< (jlist-it-index it) limit)
     98      (> (jlist-it-index it) limit)))
    9799
    98100(defmethod sequence:iterator-element
Note: See TracChangeset for help on using the changeset viewer.