chiark / gitweb /
src/classes.lisp: Fix `print-object' on `sod-initializer'.
[sod] / src / codegen-proto.lisp
index 6b1f947f3f7fd669d453e89f96b1e8583b4aa335..e7486fac9ba4c01cbfa9678ad5f6b217d35f0ffc 100644 (file)
@@ -7,7 +7,7 @@
 
 ;;;----- Licensing notice ---------------------------------------------------
 ;;;
-;;; This file is part of the Sensble Object Design, an object system for C.
+;;; This file is part of the Sensible Object Design, an object system for C.
 ;;;
 ;;; SOD is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
@@ -64,6 +64,8 @@ (defparameter *sod-master-ap*
   (make-instance 'temporary-name :tag "sod__master_ap"))
 (defparameter *sod-tmp-ap*
   (make-instance 'temporary-name :tag "sod__tmp_ap"))
+(defparameter *sod-tmp-val*
+  (make-instance 'temporary-name :tag "sod__t"))
 
 ;;;--------------------------------------------------------------------------
 ;;; Instructions.
@@ -154,7 +156,7 @@        (defmethod print-object ((,inst-var ,class-name) ,streamvar)
               (print-unreadable-object (,inst-var ,streamvar :type t)
                 (format stream "~@<~@{~S ~@_~S~^ ~_~}~:>"
                         ,@(mappend #'list keys args)))
-              (progn ,@body))))
+              (block ,code ,@body))))
        ,@(and export `((export '(,class-name ,constructor-name
                                 ,@(mapcar (lambda (arg)
                                             (symbolicate 'inst- arg))
@@ -334,10 +336,13 @@ (defmacro with-temporary-var ((codegen var type) &body body)
 
    During BODY, VAR will be marked in-use; when BODY ends, VAR will be marked
    available for re-use."
-  `(let ((,var (temporary-var ,codegen ,type)))
-     (unwind-protect
-         (progn ,@body)
-       (setf (var-in-use-p ,var) nil))))
+  (multiple-value-bind (doc decls body) (parse-body body :docp nil)
+    (declare (ignore doc))
+    `(let ((,var (temporary-var ,codegen ,type)))
+       ,@decls
+       (unwind-protect
+           (progn ,@body)
+        (setf (var-in-use-p ,var) nil)))))
 
 ;;;--------------------------------------------------------------------------
 ;;; Code generation idioms.