/[slime]/slime/swank-cmucl.lisp
ViewVC logotype

Diff of /slime/swank-cmucl.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.217 by heller, Tue Jan 5 09:00:22 2010 UTC revision 1.218 by heller, Tue Jan 5 09:00:30 2010 UTC
# Line 791  condition object." Line 791  condition object."
791  (defun location-in-file (filename code-location debug-source)  (defun location-in-file (filename code-location debug-source)
792    "Resolve the source location for CODE-LOCATION in FILENAME."    "Resolve the source location for CODE-LOCATION in FILENAME."
793    (let* ((code-date (di:debug-source-created debug-source))    (let* ((code-date (di:debug-source-created debug-source))
794             (root-number (di:debug-source-root-number debug-source))
795           (source-code (get-source-code filename code-date)))           (source-code (get-source-code filename code-date)))
796      (with-input-from-string (s source-code)      (with-input-from-string (s source-code)
797        (make-location (list :file (unix-truename filename))        (make-location (list :file (unix-truename filename))
798                       (list :position (1+ (code-location-stream-position                       (list :position (1+ (code-location-stream-position
799                                            code-location s)))                                            code-location s root-number)))
800                       `(:snippet ,(read-snippet s))))))                       `(:snippet ,(read-snippet s))))))
801    
802  (defun location-in-stream (code-location debug-source)  (defun location-in-stream (code-location debug-source)
# Line 848  This is true for functions that were com Line 849  This is true for functions that were com
849    
850  ;;;;; Groveling source-code for positions  ;;;;; Groveling source-code for positions
851    
852  (defun code-location-stream-position (code-location stream)  (defun code-location-stream-position (code-location stream root)
853    "Return the byte offset of CODE-LOCATION in STREAM.  Extract the    "Return the byte offset of CODE-LOCATION in STREAM.  Extract the
854  toplevel-form-number and form-number from CODE-LOCATION and use that  toplevel-form-number and form-number from CODE-LOCATION and use that
855  to find the position of the corresponding form.  to find the position of the corresponding form.
856    
857  Finish with STREAM positioned at the start of the code location."  Finish with STREAM positioned at the start of the code location."
858    (let* ((location (debug::maybe-block-start-location code-location))    (let* ((location (debug::maybe-block-start-location code-location))
859           (tlf-offset (di:code-location-top-level-form-offset location))           (tlf-offset (- (di:code-location-top-level-form-offset location)
860                            root))
861           (form-number (di:code-location-form-number location)))           (form-number (di:code-location-form-number location)))
862      (let ((pos (form-number-stream-position tlf-offset form-number stream)))      (let ((pos (form-number-stream-position tlf-offset form-number stream)))
863        (file-position stream pos)        (file-position stream pos)
# Line 877  FORM-NUMBER is an index into a source-pa Line 879  FORM-NUMBER is an index into a source-pa
879    "Return the byte offset of CODE-LOCATION in STRING.    "Return the byte offset of CODE-LOCATION in STRING.
880  See CODE-LOCATION-STREAM-POSITION."  See CODE-LOCATION-STREAM-POSITION."
881    (with-input-from-string (s string)    (with-input-from-string (s string)
882      (code-location-stream-position code-location s)))      (code-location-stream-position code-location s 0)))
883    
884    
885  ;;;; Finding definitions  ;;;; Finding definitions

Legend:
Removed from v.1.217  
changed lines
  Added in v.1.218

  ViewVC Help
Powered by ViewVC 1.1.5