Changeset 6251


Ignore:
Timestamp:
Apr 10, 2007, 5:42:55 AM (13 years ago)
Author:
gb
Message:

Don't bother using RLET or equivalent to avoid making GCable pointers
for ObjC dispatch function args; trust the compiler to do that for us.

Location:
trunk/ccl/examples
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/examples/cocoa-editor.lisp

    r6234 r6251  
    447447  (let* ((pos (#/longValue (#/objectAtIndex: params 0)))
    448448         (n (#/longValue (#/objectAtIndex: params 1))))
    449     (rlet ((range :ns-range :location pos :length n))
    450       (#/edited:range:changeInLength: self #$NSTextStorageEditedCharacters range (- n)))
     449    (#/edited:range:changeInLength: self #$NSTextStorageEditedCharacters (ns:make-ns-range pos n) (- n))
    451450    (let* ((display (hemlock-buffer-string-cache (#/string self))))
    452451      (reset-buffer-cache display)
     
    458457    #+debug
    459458    (#_NSLog #@"Note modification: pos = %d, n = %d" :int pos :int n)
    460     (rlet ((range :ns-range :location pos :length n))
    461       (#/edited:range:changeInLength: self (logior #$NSTextStorageEditedCharacters
    462                                                   #$NSTextStorageEditedAttributes) range 0))))
     459    (#/edited:range:changeInLength: self (logior #$NSTextStorageEditedCharacters
     460                                                 #$NSTextStorageEditedAttributes) (ns:make-ns-range pos n) 0)))
    463461
    464462(objc:defmethod (#/noteAttrChange: :void) ((self hemlock-text-storage) params)
     
    466464         (n (#/longValue (#/objectAtIndex: params 1))))
    467465    #+debug (#_NSLog #@"attribute-change at %d/%d" :int pos :int n)
    468     (rlet ((range :ns-range :location pos :length n))
    469       (#/edited:range:changeInLength: self #$NSTextStorageEditedAttributes range 0))))
     466    (#/edited:range:changeInLength: self #$NSTextStorageEditedAttributes (ns:make-ns-range pos n) 0)))
    470467
    471468(objc:defmethod (#/beginEditing :void) ((self hemlock-text-storage))
     
    701698    ;; Force the blinked character to be redrawn.  Let the text
    702699    ;; system do the drawing.
    703     (let* ((layout (#/layoutManager self)))
    704       (rlet ((invalid-range :ns-range
    705                             :location  (text-view-blink-location self)
    706                             :length 1))
    707         (#/invalidateDisplayForCharacterRange: layout invalid-range)))))
     700    (#/invalidateDisplayForCharacterRange: (#/layoutManager self) (ns:make-ns-range (text-view-blink-location self) 1))))
    708701
    709702(defmethod update-blink ((self hemlock-textstorage-text-view))
     
    981974              (create-text-attributes :color (#/blackColor ns:ns-color)
    982975                                      :font (default-font
    983                                               :name *modeline-font-name*
     976                                                :name *modeline-font-name*
    984977                                              :size *modeline-font-size*))))
    985      
    986978      (let* ((string
    987979              (apply #'concatenate 'string
     
    991983                                   buffer pane))
    992984                      (hi::buffer-modeline-fields buffer)))))
    993         (rletZ ((zpoint :ns-point))
    994           (#/drawAtPoint:withAttributes: (%make-nsstring string)
    995                                          zpoint
    996                                          *modeline-text-attributes*))))))
     985        (#/drawAtPoint:withAttributes: (%make-nsstring string)
     986                                       (ns:make-ns-point 0 0)
     987                                       *modeline-text-attributes*)))))
    997988
    998989;;; Draw the underlying buffer's modeline string on a white background
     
    16341625  #+debug
    16351626  (#_NSLog #@"insertion at position %d, len %d" :int pos :int n)
    1636   (rlet ((range ns:ns-range :location pos :length 0))
    1637     (#/edited:range:changeInLength:
    1638      textstorage #$NSTextStorageEditedAttributes range n)
    1639     (setf (ns:ns-range-length range) n)
    1640     (#/edited:range:changeInLength:
    1641      textstorage  #$NSTextStorageEditedCharacters range 0)))
     1627  (#/edited:range:changeInLength:
     1628   textstorage #$NSTextStorageEditedAttributes (ns:make-ns-range pos 0) n)
     1629  (#/edited:range:changeInLength:
     1630   textstorage  #$NSTextStorageEditedCharacters (ns:make-ns-range pos n) 0))
    16421631
    16431632
     
    16851674                 :int n)
    16861675        #-all-in-cocoa-thread
    1687         (rlet ((range :ns-range) :location (mark-absolute-position mark) :length n)
    1688           (#/edited:range:changeInLength:
    1689            textstorage
    1690            (logior #$NSTextStorageEditedCharacters
    1691                           #$NSTextStorageEditedAttributes)
    1692            range
    1693            0))
     1676        (#/edited:range:changeInLength:
     1677         textstorage
     1678         (logior #$NSTextStorageEditedCharacters
     1679                 #$NSTextStorageEditedAttributes)
     1680         (ns:make-ns-range (mark-absolute-position mark) n)
     1681         0)
    16941682        #+all-in-cocoa-thread
    16951683        (perform-edit-change-notification textstorage
     
    17061694        #-all-in-cocoa-thread
    17071695        (let* ((pos (mark-absolute-position mark)))
    1708           (rlet ((range :ns-range :location pos :length n))
    17091696          (#/edited:range:changeInLength:
    1710            textstorage #$NSTextStorageEditedCharacters range (- n)))
     1697           textstorage #$NSTextStorageEditedCharacters (ns:make-ns-range pos n) (- n))
    17111698          (let* ((display (hemlock-buffer-string-cache (#/string textstorage))))
    17121699            (reset-buffer-cache display)
     
    18201807         (pointpos (mark-absolute-position point)))
    18211808    (#/beginEditing textstorage)
    1822     (rlet ((changed :ns-range :location 0 :length old-length))
    1823       (#/edited:range:changeInLength:
    1824        textstorage #$NSTextStorageEditedCharacters changed (- old-length)))
     1809    (#/edited:range:changeInLength:
     1810     textstorage #$NSTextStorageEditedCharacters (ns:make-ns-range 0 old-length) (- old-length))
    18251811    (nsstring-to-buffer nsstring buffer)
    1826     (rletZ ((new-range :ns-range))
    1827       (let* ((newlen (hemlock-buffer-length buffer)))
    1828         (#/edited:range:changeInLength: textstorage  #$NSTextStorageEditedAttributes new-range newlen)
    1829         (setf (ns:ns-range-length new-range) newlen)
    1830         (#/edited:range:changeInLength: textstorage #$NSTextStorageEditedCharacters new-range 0)
    1831         (let* ((ts-string (#/string textstorage))
    1832                (display (hemlock-buffer-string-cache ts-string)))
    1833           (reset-buffer-cache display)
    1834           (update-line-cache-for-index display 0)
    1835           (move-hemlock-mark-to-absolute-position point
    1836                                                   display
    1837                                                   (min newlen pointpos))))
    1838       (#/endEditing textstorage))
     1812    (let* ((newlen (hemlock-buffer-length buffer)))
     1813      (#/edited:range:changeInLength: textstorage  #$NSTextStorageEditedAttributes (ns:make-ns-range 0 0) newlen)
     1814      (#/edited:range:changeInLength: textstorage #$NSTextStorageEditedCharacters (ns:make-ns-range 0 newlen) 0)
     1815      (let* ((ts-string (#/string textstorage))
     1816             (display (hemlock-buffer-string-cache ts-string)))
     1817        (reset-buffer-cache display)
     1818        (update-line-cache-for-index display 0)
     1819        (move-hemlock-mark-to-absolute-position point
     1820                                                display
     1821                                                (min newlen pointpos))))
     1822    (#/endEditing textstorage)
    18391823    (hi::document-set-point-position self)
    18401824    (setf (hi::buffer-modified buffer) nil)
  • trunk/ccl/examples/cocoa-typeout.lisp

    r6234 r6251  
    175175         (len (#/length text-storage)))
    176176    (declare (type ns:ns-text-storage text-storage))
    177     (rlet ((range-for-deletion :ns-range :location 0 :length len))
    178       (#/deleteCharactersInRange: text-storage range-for-deletion))))
     177    (#/deleteCharactersInRange: text-storage (ns:make-ns-range 0 len))))
    179178
    180179(defloadvar *typeout-stream* (make-instance 'typeout-stream))
  • trunk/ccl/examples/cocoa-window.lisp

    r6234 r6251  
    9494    (if (or (not *NSApp*) (not (#/isRunning *NSApp*)))
    9595      (call-next-method)
    96       (rletZ ((point :ns-point))
    9796        (let* ((e (#/otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:
    9897                   ns:ns-event
    9998                   #$NSApplicationDefined
    100                    point
     99                   (ns:make-ns-point 0 0)
    101100                   0
    102101                   0.0d0
     
    108107        (#/retain e)
    109108        (#/performSelectorOnMainThread:withObject:waitUntilDone:
    110          *NSApp* (@selector "postEventAtStart:") e  t))))))
     109         *NSApp* (@selector "postEventAtStart:") e  t)))))
    111110
    112111
  • trunk/ccl/examples/objc-support.lisp

    r6227 r6251  
    315315(defun lisp-string-from-nsstring-substring (nsstring start length)
    316316  (%stack-block ((cstring (1+ length)))
    317     (rlet ((range :ns-range :location start :length length))
    318       (#/getCString:maxLength:range:remainingRange:
    319        nsstring  cstring  length range +null-ptr+)
    320       (%get-cstring cstring))))
     317    (#/getCString:maxLength:range:remainingRange:
     318       nsstring  cstring  length (ns:make-ns-range start length) +null-ptr+)
     319    (%get-cstring cstring)))
    321320
    322321(def-standard-initial-binding *listener-autorelease-pool* nil)
  • trunk/ccl/examples/tiny.lisp

    r6231 r6251  
    5656      ;; with lines
    5757      (#/set (#/blackColor ns:ns-color))
    58       (rlet ((source-point :ns-point)
    59              (dest-point :ns-point))
    6058      (loop
    6159        for f from 0.0 below (* 2 short-pi) by (* 2 (/ short-pi numsides))
     
    6462          for g from 0.0 below (* 2 short-pi) by (* 2 (/ short-pi numsides))
    6563          do
    66           (ns:init-ns-point source-point (X f) (Y f))
    67           (ns:init-ns-point dest-point (X g) (Y g))
    68           (#/strokeLineFromPoint:toPoint: ns:ns-bezier-path source-point dest-point)))))))
     64          (#/strokeLineFromPoint:toPoint: ns:ns-bezier-path (ns:make-ns-point (X f) (Y f)) (ns:make-ns-point (X g) (Y g))))))))
    6965
    7066
Note: See TracChangeset for help on using the changeset viewer.