Changeset 5296


Ignore:
Timestamp:
Oct 5, 2006, 5:09:49 AM (18 years ago)
Author:
Gary Byers
Message:

WITH-ENCODED-CSTR(s). (Hey, it's a start.)

File:
1 edited

Legend:

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

    r5230 r5296  
    15761576(defmacro with-cstrs (speclist &body body)
    15771577   (with-specs-aux 'with-cstr speclist body))
     1578
     1579(defmacro with-encoded-cstr (encoding-name (sym string &optional start end)
     1580                                 &rest body &environment env)
     1581  (let* ((encoding (get-character-encoding encoding-name))
     1582         (str (gensym)))
     1583    (multiple-value-bind (body decls) (parse-body body env nil)
     1584      `(let* ((,str ,string))
     1585        (%stack-block ((,sym (cstring-encoded-length-in-bytes ,encoding ,str ,start ,end) :clear t))
     1586          ,@decls
     1587          (encode-string-to-memory ,encoding ,sym 0 ,str ,start ,end)
     1588          ,@body)))))
     1589
     1590(defmacro with-encoded-cstrs (encoding-name bindings &body body)
     1591  (with-specs-aux 'with-encoded-cstr (mapcar #'(lambda (b)
     1592                                                 `(,encoding-name ,b))
     1593                                             bindings) body))
    15781594
    15791595
Note: See TracChangeset for help on using the changeset viewer.