Changeset 8448


Ignore:
Timestamp:
Feb 9, 2008, 5:16:45 PM (12 years ago)
Author:
gz
Message:

Move double-%-in to cocoa-utils, use it in log-debug

Location:
branches/gz-working/cocoa-ide
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/gz-working/cocoa-ide/cocoa-editor.lisp

    r8428 r8448  
    18101810      (hemlock-view pane))))
    18111811
    1812 (defun double-%-in (string)
    1813   ;; Replace any % characters in string with %%, to keep them from
    1814   ;; being treated as printf directives.
    1815   (let* ((%pos (position #\% string)))
    1816     (if %pos
    1817       (concatenate 'string (subseq string 0 %pos) "%%" (double-%-in (subseq string (1+ %pos))))
    1818       string)))
    1819 
    1820 (defun nsstring-for-lisp-condition (cond)
    1821   (%make-nsstring (double-%-in (or (ignore-errors (princ-to-string cond))
    1822                                    "#<error printing error message>"))))
    1823 
    18241812(objc:defmethod (#/runErrorSheet: :void) ((self hemlock-frame) message)
    18251813  #+debug (#_NSLog #@"runErrorSheet: signal = %@" :id signal)
  • branches/gz-working/cocoa-ide/cocoa-utils.lisp

    r8428 r8448  
    235235;; debugging
    236236
     237(defun double-%-in (string)
     238  ;; Replace any % characters in string with %%, to keep them from
     239  ;; being treated as printf directives.
     240  (let* ((%pos (position #\% string)))
     241    (if %pos
     242      (concatenate 'string (subseq string 0 %pos) "%%" (double-%-in (subseq string (1+ %pos))))
     243      string)))
     244
    237245(defun log-debug (format-string &rest args)
    238   (#_NSLog (ccl::%make-nsstring (apply #'format nil format-string args))))
     246  (let ((string (apply #'format nil format-string args)))
     247    (#_NSLog (ccl::%make-nsstring (double-%-in string)))))
    239248
    240249(defun nslog-condition (c)
     
    244253        (#_NSLog #@"Error in event loop: %@" :address nsstr)))))
    245254
     255(defun nsstring-for-lisp-condition (cond)
     256  (%make-nsstring (double-%-in (or (ignore-errors (princ-to-string cond))
     257                                   "#<error printing error message>"))))
     258
    246259
    247260
Note: See TracChangeset for help on using the changeset viewer.