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:8-117:56
o1 : FilePosition
|
i2 : code needs
o2 = /usr/local/share/Macaulay2/Core/Core.m2:115:8-117:56:
--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:283:37-310:90
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:282:37-282:78)}
{1 => (/usr/local/share/Macaulay2/Core/res.m2:283:37-310:90)}
{2 => (/usr/local/share/Macaulay2/Core/res.m2:312:40-313:69)}
o4 : NumberedVerticalList
|
i5 : methods doc
o5 = {0 => (doc, String)}
o5 : NumberedVerticalList
|
i6 : locate 0
o6 = /usr/local/share/Macaulay2/SimpleDoc.m2:35:14-43:93
o6 : FilePosition
|
i7 : peek oo
o7 = FilePosition{/usr/local/share/Macaulay2/
------------------------------------------------------------------------
SimpleDoc.m2, 35, 14, 43, 93, 35, 14}
|
If the function f is compiled, or if f is null, then a location is not available and null is returned.