[cl-carbon-cvs] CVS update: CL-Carbon/package.lisp CL-Carbon/utils.lisp

David Steuber dsteuber at common-lisp.net
Sat May 21 07:27:22 UTC 2005


Update of /project/cl-carbon/cvsroot/CL-Carbon
In directory common-lisp.net:/tmp/cvs-serv14938

Modified Files:
	package.lisp utils.lisp 
Log Message:
Fixed macros in utils.lisp that were using FFI reader macros with side
effects.  This bug showed up as undeclared free variables that are created
by the #$ reader macros.  I also made some utility functions for the #_
reader macro functions being used in utils.lisp macros.  This should allow
dfsl files to work properly when loaded into an image even though they
were created during a different lisp session.

I also did some package exports cleanup.  Instead of using EXPORT in
utils.lisp, I moved the exported symbols to the :exports section of the
DEFPACKAGE form in package.lisp.  At some point, those exports probably
should be sorted into alphabetical order.

I tested these chages with Example which I have not made any changes to.
Example symlinks in CL-Carbon, so the make script can't remove dfsl files
built when making CL-Carbon which was hiding the bug from me.  Example
still seems to work.  It just needs to use more of CL-Carbon :-).

Date: Sat May 21 09:27:22 2005
Author: dsteuber

Index: CL-Carbon/package.lisp
diff -u CL-Carbon/package.lisp:1.1.1.1 CL-Carbon/package.lisp:1.2
--- CL-Carbon/package.lisp:1.1.1.1	Fri Apr 29 22:19:03 2005
+++ CL-Carbon/package.lisp	Sat May 21 09:27:21 2005
@@ -8,7 +8,7 @@
 ;;;; Programmer:    David Steuber
 ;;;; Date Started:  1/21/2005
 ;;;;
-;;;; $Id: package.lisp,v 1.1.1.1 2005/04/29 20:19:03 dsteuber Exp $
+;;;; $Id: package.lisp,v 1.2 2005/05/21 07:27:21 dsteuber Exp $
 ;;;; ***********************************************************************
 ;;;;
 ;;;; Copyright (c) 2005 by David Steuber
@@ -74,6 +74,13 @@
              "DISABLE-DEBUGGING"
              "DEBUG-LOG"
              "INT32-TO-STRING"
+             "WITH-CFSTRING"
+             "WITH-CFSTRINGS"
+             "CONST-CFSTRING"
+             "MAKE-CFSTRING"
+             "REQUIRE-NOERROR"
+             "SHOW-ALERT"
+             "MAKE-LISP-STRING-FROM-CFSTRINGREF"
              "NIB"
              "NIB-FILE-NAME"
              "NIB-RESOURCE-NAME")))


Index: CL-Carbon/utils.lisp
diff -u CL-Carbon/utils.lisp:1.1.1.1 CL-Carbon/utils.lisp:1.2
--- CL-Carbon/utils.lisp:1.1.1.1	Fri Apr 29 22:19:03 2005
+++ CL-Carbon/utils.lisp	Sat May 21 09:27:21 2005
@@ -8,7 +8,7 @@
 ;;;; Programmer:    David Steuber
 ;;;; Date Started:  1/21/2005
 ;;;;
-;;;; $Id: utils.lisp,v 1.1.1.1 2005/04/29 20:19:03 dsteuber Exp $
+;;;; $Id: utils.lisp,v 1.2 2005/05/21 07:27:21 dsteuber Exp $
 ;;;; ***********************************************************************
 ;;;;
 ;;;; Copyright (c) 2005 by David Steuber
@@ -36,37 +36,38 @@
 
 (in-package :cl-carbon)
 
+(defun cf-string-make-constant-string (s)
+  (#___CFStringMakeConstantString s))
+
 (defmacro const-cfstring (str)
   (let ((s (gensym)))
-    `(ccl::with-cstr (,s ,str) (#___CFStringMakeConstantString ,s))))
-(export 'const-cfstring)
+    `(ccl::with-cstr (,s ,str) (cl-carbon::cf-string-make-constant-string ,s))))
 
 (defun make-cfstring (str)
   "Allocates a CFString object stored in a MACPTR which must be
   CFRelease(d) when no longer needed."
   (ccl::with-cstr (cstr str)
      (#_CFStringCreateWithCString (ccl:%null-ptr) cstr #$kCFStringEncodingMacRoman)))
-(export 'make-cfstring)
+
+(defun cf-release (cf-ptr)
+  (#_CFRelease cf-ptr))
 
 (defmacro with-cfstring ((sym str) &rest body)
   "Create, use, and then release a CFString."
   `(let ((,sym (make-cfstring ,str)))
      (unwind-protect (progn , at body)
-       (#_CFRelease ,sym))))
-(export 'with-cfstring)
+       (cl-carbon::cf-release ,sym))))
   
 (defmacro with-cfstrings (speclist &body body)
   "Create, use, and then release CFStrings."
   (ccl::with-specs-aux 'with-cfstring speclist body))
-(export 'with-cfstrings)
 
 (defmacro require-noerror (&body forms)
   (let* ((err (gensym))
          (body (reverse `(let (,err)))))
     (dolist (form forms (nreverse body))
       (push `(setf ,err ,form) body)
-      (push `(assert (eql ,err #$noErr)) body))))
-(export 'require-noerror)
+      (push `(assert (eql ,err #.#.(read-from-string "#$noErr"))) body))))
 
 (defmacro case-equal (exp &body clauses)
   (let ((temp (gensym)))
@@ -80,12 +81,10 @@
                                      `((member ,temp ',keys :test #'equal)
                                        , at clause-forms)))))
                        clauses)))))
-(export 'case-equal)
 
 (defun show-alert (s)
   (ccl::with-pstr (message-str s)
     (#_StandardAlert #$kAlertNoteAlert message-str (%null-ptr) (%null-ptr) (%null-ptr))))
-(export 'show-alert)
 
 (defun make-lisp-string-from-cfstringref (ptr &optional (encoding #$kCFStringEncodingMacRoman))
   "Use the CFStringRef in ptr to make a Lisp string useing the provided encoding."
@@ -95,4 +94,3 @@
           (when (= 1 (#_CFStringGetCString ptr buffer 1024 encoding))
             (ccl::%get-cstring buffer)))
         (ccl::%get-cstring (ccl::%get-ptr cstr)))))
-(export 'make-lisp-string-from-cfstringref)




More information about the Cl-carbon-cvs mailing list