Changeset 5974


Ignore:
Timestamp:
Mar 2, 2007, 4:06:24 AM (18 years ago)
Author:
Gary Byers
Message:

WITH-MACPTRS: move initialization/modification of null pointers into body.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/macros.lisp

    r5820 r5974  
    13221322   body)
    13231323
    1324 (defmacro with-macptrs (varlist &rest body &aux decls inits)
    1325   (dolist (var varlist)
    1326     (if (consp var)
    1327       (progn
    1328         (push (car var) decls)
    1329         (push (list (%car var)
    1330                     (if (%cdr var)
    1331                       `(%setf-macptr (%null-ptr) ,@(%cdr var))
    1332                       '(%null-ptr))) inits))
    1333       (progn
    1334         (push var decls)
    1335         (push (list var '(%null-ptr)) inits))))
    1336   `(let* ,(nreverse inits)
    1337      (declare (dynamic-extent ,@decls))
    1338      (declare (type macptr ,@decls))
    1339      ,@body))
     1324(defmacro with-macptrs (varlist &rest body &environment env)
     1325  (multiple-value-bind (body other-decls) (parse-body body env)
     1326    (collect ((bindings)
     1327              (our-decls)
     1328              (inits))
     1329      (dolist (var varlist)
     1330        (if (consp var)
     1331          (progn
     1332            (our-decls (car var))
     1333            (bindings `(,(car var) (%null-ptr)))
     1334            (if (cdr var)
     1335              (inits `(%setf-macptr ,(car var) ,@(cdr var)))))
     1336          (progn
     1337            (our-decls var)
     1338            (bindings `(,var (%null-ptr))))))
     1339  `(let* ,(bindings)
     1340     (declare (dynamic-extent ,@(our-decls))
     1341     (declare (type macptr ,@(our-decls)))
     1342     ,@other-decls)
     1343    ,@(inits)
     1344     ,@body))))
    13401345
    13411346(defmacro with-loading-file (filename &rest body)
Note: See TracChangeset for help on using the changeset viewer.