Ignore:
Timestamp:
11/24/16 10:31:17 (7 years ago)
Author:
Mark Evenson
Message:

Dramatically improve source recording on SYS::SOURCE plist for a symbol (Alan Ruttenberg)

The interface to recording information on the SYS:%SOURCE plist for a
symbol is now deprecated and will be removed with abcl-1.7.

Implementation


Source information for ABCL is now recorded on the SYS::SOURCE
property. The appropiate information for type is recorded by the
SYS::RECORD-SOURCE-INFORMATION-BY-TYPE function:

record-source-information-by-type (name type &optional source-pathname source-position)

TYPE is either a symbol or list.

Source information for functions, methods, and generic functions are
represented as lists of the following form:

(:generic-function function-name)
(:function function-name)
(:method method-name qualifiers specializers)

Where FUNCTION-NAME or METHOD-NAME can be a either be of the form
'symbol or '(setf symbol).

Source information for all other forms have a symbol for TYPE which is
one of the following:

:class, :variable, :condition, :constant, :compiler-macro, :macro
:package, :structure, :type, :setf-expander, :source-transform

These values follow SBCL'S implemenation in SLIME
c.f. <https://github.com/slime/slime/blob/bad2acf672c33b913aabc1a7facb9c3c16a4afe9/swank/sbcl.lisp#L748>

Modifications are in two places, one at the definitions, calling
record-source-information-by-type and then again in the file-compiler,
which writes forms like

(put 'source name (cons (list type pathname position) (get 'source name)))

In theory this can lead to redundancy if a fasl is loaded again and
again. I'm not sure how to fix this yet. Forms in the loader get
called early in build when many of the sequence functions aren't
present. Will probably just filter when presenting in slime.

<> :closes <http://abcl.org/trac/ticket/421> .
<> :merges <https://github.com/armedbear/abcl/pull/5> .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/gray-streams.lisp

    r14605 r14914  
    655655(setf (symbol-function 'common-lisp::file-position) #'gray-file-position)
    656656(setf (symbol-function 'common-lisp::listen) #'gray-listen)
     657
     658(dolist (e '((common-lisp::read-char gray-read-char)
     659       (common-lisp::peek-char gray-peek-char)
     660       (common-lisp::unread-char gray-unread-char)
     661       (common-lisp::read-line gray-read-line)
     662       (common-lisp::clear-input gray-clear-input)
     663       (common-lisp::read-char-no-hang gray-read-char-no-hang)
     664       (common-lisp::write-char gray-write-char)
     665       (common-lisp::fresh-line gray-fresh-line)
     666       (common-lisp::terpri gray-terpri)
     667       (common-lisp::write-string gray-write-string)
     668       (common-lisp::write-line gray-write-line)
     669       (sys::%force-output gray-force-output)
     670       (sys::%finish-output gray-finish-output)
     671       (sys::%clear-output gray-clear-output)
     672       (sys::%output-object gray-output-object)
     673       (common-lisp::read-byte gray-read-byte)
     674       (common-lisp::write-byte gray-write-byte)
     675       (common-lisp::stream-column gray-stream-column)
     676       (common-lisp::stream-element-type gray-stream-element-type)
     677       (common-lisp::close gray-close)
     678       (common-lisp::input-stream-p gray-input-stream-p)
     679       (common-lisp::input-character-stream-p gray-input-character-stream-p) ;; # fb 1.01
     680       (common-lisp::output-stream-p gray-output-stream-p)
     681       (common-lisp::open-stream-p gray-open-stream-p)
     682       (common-lisp::streamp gray-streamp)
     683       (common-lisp::read-sequence gray-read-sequence)
     684       (common-lisp::write-sequence gray-write-sequence)
     685       (common-lisp::file-position gray-file-position)
     686       (common-lisp::listen gray-listen)))
     687  (sys::put (car e) 'sys::source (cl:get (second e) 'sys::source)))
     688
    657689#|
    658690(setf (symbol-function 'common-lisp::make-two-way-stream) #'gray-make-two-way-stream)
Note: See TracChangeset for help on using the changeset viewer.