Description
For a symbol interpreted function f, returns a FilePosition{n,i,c,j,d,k,e} describing the location of the definition in the source code:
The name of the source file is n;
the code occupies line i column c through line j column d;
the central point of interest located at line k column e.
i1 : locate needs
o1 = /usr/local/share/Macaulay2/Core/Core.m2:115:17-117:47
o1 : FilePosition
|
i2 : code needs
o2 = /usr/local/share/Macaulay2/Core/Core.m2:115:17-117:47:
--source code:
needs = filename -> if not filesLoaded#?filename then load filename else (
(filepath, filetime) := filesLoaded#filename;
if filetime < fileTime filepath then load filepath)
|
If f is a sequence, then lookup is applied first, and the location of the resulting function is provided.
i3 : locate(resolution, Module)
o3 = /usr/local/share/Macaulay2/Core/res.m2:282:42-309:64
o3 : FilePosition
|
In particular, the output of methods can be used as an input to locate.
i4 : locate methods resolution
o4 = {0 => (/usr/local/share/Macaulay2/Core/res.m2:311:41-313:51) }
{1 => (/usr/local/share/Macaulay2/Core/res.m2:315:45-316:67) }
{2 => (/usr/local/share/Macaulay2/Core/res.m2:282:42-309:64) }
{3 => (/usr/local/share/Macaulay2/Core/monideal.m2:165:49-165:74)}
o4 : NumberedVerticalList
|
i5 : methods doc
o5 = {0 => (doc, String)}
o5 : NumberedVerticalList
|
i6 : locate 0
o6 = /usr/local/share/Macaulay2/SimpleDoc.m2:35:18-43:13
o6 : FilePosition
|
i7 : peek oo
o7 = FilePosition{/usr/local/share/Macaulay2/
------------------------------------------------------------------------
SimpleDoc.m2, 35, 18, 43, 13, 36, 56}
|
If the function f is compiled, or if f is null, then a location is not available and null is returned.