2008-01-09 04:52:08 -05:00
|
|
|
! Copyright (C) 2006, 2008 Slava Pestov.
|
2007-09-20 18:09:08 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
IN: definitions
|
2008-08-30 01:05:27 -04:00
|
|
|
USING: kernel sequences namespaces assocs graphs math math.order ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-03-20 16:00:49 -04:00
|
|
|
ERROR: no-compilation-unit definition ;
|
2008-01-09 16:51:55 -05:00
|
|
|
|
2008-08-30 03:31:27 -04:00
|
|
|
SINGLETON: inlined-dependency
|
|
|
|
SINGLETON: flushed-dependency
|
|
|
|
SINGLETON: called-dependency
|
|
|
|
|
|
|
|
TUPLE: method-dependency class ;
|
|
|
|
C: <method-dependency> method-dependency
|
|
|
|
|
|
|
|
UNION: dependency
|
|
|
|
inlined-dependency
|
|
|
|
flushed-dependency
|
|
|
|
called-dependency
|
|
|
|
method-dependency ;
|
|
|
|
|
|
|
|
M: dependency <=>
|
|
|
|
[
|
|
|
|
dup method-dependency? [ drop method-dependency ] when
|
|
|
|
{
|
|
|
|
called-dependency
|
|
|
|
method-dependency
|
|
|
|
flushed-dependency
|
|
|
|
inlined-dependency
|
|
|
|
} index
|
|
|
|
] bi@ <=> ;
|
2008-08-30 01:05:27 -04:00
|
|
|
|
2008-08-30 03:31:27 -04:00
|
|
|
SYMBOL: changed-definitions
|
2008-08-30 01:05:27 -04:00
|
|
|
|
2008-06-09 03:14:14 -04:00
|
|
|
: changed-definition ( defspec how -- )
|
|
|
|
swap changed-definitions get
|
|
|
|
[ set-at ] [ no-compilation-unit ] if* ;
|
|
|
|
|
2008-08-30 03:32:17 -04:00
|
|
|
SYMBOL: new-classes
|
|
|
|
|
|
|
|
: new-class ( word -- )
|
|
|
|
dup new-classes get
|
|
|
|
[ set-at ] [ no-compilation-unit ] if* ;
|
|
|
|
|
|
|
|
: new-class? ( word -- ? )
|
|
|
|
new-classes get key? ;
|
|
|
|
|
2007-09-20 18:09:08 -04:00
|
|
|
GENERIC: where ( defspec -- loc )
|
|
|
|
|
|
|
|
M: object where drop f ;
|
|
|
|
|
|
|
|
GENERIC: set-where ( loc defspec -- )
|
|
|
|
|
2008-01-09 16:51:55 -05:00
|
|
|
GENERIC: forget* ( defspec -- )
|
|
|
|
|
|
|
|
M: object forget* drop ;
|
|
|
|
|
|
|
|
SYMBOL: forgotten-definitions
|
|
|
|
|
|
|
|
: forgotten-definition ( defspec -- )
|
|
|
|
dup forgotten-definitions get
|
|
|
|
[ no-compilation-unit ] unless*
|
|
|
|
set-at ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-01-09 16:51:55 -05:00
|
|
|
: forget ( defspec -- ) dup forgotten-definition forget* ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2007-10-09 17:35:09 -04:00
|
|
|
: forget-all ( definitions -- ) [ forget ] each ;
|
|
|
|
|
2007-09-20 18:09:08 -04:00
|
|
|
GENERIC: synopsis* ( defspec -- )
|
|
|
|
|
|
|
|
GENERIC: definer ( defspec -- start end )
|
|
|
|
|
|
|
|
GENERIC: definition ( defspec -- seq )
|
|
|
|
|
|
|
|
SYMBOL: crossref
|
|
|
|
|
|
|
|
GENERIC: uses ( defspec -- seq )
|
|
|
|
|
|
|
|
M: object uses drop f ;
|
|
|
|
|
|
|
|
: xref ( defspec -- ) dup uses crossref get add-vertex ;
|
|
|
|
|
2008-06-06 21:47:09 -04:00
|
|
|
: usage ( defspec -- seq ) crossref get at keys ;
|
|
|
|
|
|
|
|
GENERIC: irrelevant? ( defspec -- ? )
|
|
|
|
|
|
|
|
M: object irrelevant? drop f ;
|
|
|
|
|
|
|
|
GENERIC: smart-usage ( defspec -- seq )
|
|
|
|
|
|
|
|
M: f smart-usage drop \ f smart-usage ;
|
|
|
|
|
|
|
|
M: object smart-usage usage [ irrelevant? not ] filter ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
: unxref ( defspec -- )
|
|
|
|
dup uses crossref get remove-vertex ;
|
|
|
|
|
|
|
|
: delete-xref ( defspec -- )
|
|
|
|
dup unxref crossref get delete-at ;
|