Changeset 9525


Ignore:
Timestamp:
May 16, 2008, 2:02:37 AM (11 years ago)
Author:
gb
Message:

Make sure that we use %ISTRUCT macro (which handles "registration of
istruct cells"), not just (%gvector :istruct).

Make WITH-ENCODED-CSTRS deal with non-constant encoding names; should
probably make it do a better job when the name is constant (but it's
better to have something usable and suboptimal than something mostly
unusable.)

File:
1 edited

Legend:

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

    r9433 r9525  
    224224
    225225(defmacro %cons-restart (name action report interactive test)
    226  `(gvector :istruct 'restart ,name ,action ,report ,interactive ,test))
     226 `(%istruct 'restart ,name ,action ,report ,interactive ,test))
    227227
    228228(defmacro restart-bind (clauses &body body)
     
    936936
    937937(defmacro make-destructure-state (tail whole lambda)
    938   `(gvector :istruct 'destructure-state ,tail ,whole ,lambda))
     938  `(%istruct 'destructure-state ,tail ,whole ,lambda))
    939939
    940940
     
    16501650(defmacro with-encoded-cstr ((encoding-name (sym string &optional start end))
    16511651                             &rest body &environment env)
    1652   (let* ((encoding (get-character-encoding encoding-name))
    1653          (str (gensym))
    1654          (len (gensym))
    1655          (nzeros (floor (character-encoding-code-unit-size encoding) 8)))
    1656     (collect ((trailing-zeros))
    1657       (case nzeros
    1658         (1 (trailing-zeros `(setf (%get-unsigned-byte ,sym ,len) 0)))
    1659         (2 (trailing-zeros `(setf (%get-unsigned-word ,sym ,len) 0)))
    1660         (4 (trailing-zeros `(setf (%get-unsigned-long ,sym ,len) 0)))
    1661         (t
    1662          (dotimes (i nzeros)
    1663            (trailing-zeros `(setf (%get-unsigned-byte ,sym (the fixnum (+ ,len ,i))) 0)))))
     1652  (let* ((encoding (gensym))
     1653         (str (gensym)))
    16641654      (multiple-value-bind (body decls) (parse-body body env nil)
    1665         `(let* ((,str ,string))
    1666           (%stack-block ((,sym (cstring-encoded-length-in-bytes ,encoding ,str ,start ,end)))
     1655        `(let* ((,str ,string)
     1656                (,encoding (get-character-encoding ,encoding-name)))
     1657          (%stack-block ((,sym (cstring-encoded-length-in-bytes ,encoding ,str ,start ,end) :clear t))
    16671658            ,@decls
    1668             (let* ((,len (encode-string-to-memory ,encoding ,sym 0 ,str ,start ,end)))
    1669               (declare (fixnum ,len))
    1670               ,@(trailing-zeros)
    1671               ,@body)))))))
     1659            (encode-string-to-memory ,encoding ,sym 0 ,str ,start ,end)
     1660            ,@body)))))
    16721661
    16731662(defmacro with-encoded-cstrs (encoding-name bindings &body body)
Note: See TracChangeset for help on using the changeset viewer.