Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » debugging » locate
next | previous | forward | backward | up | index | toc

locate -- locate source code

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 = ${prefix}/share/Macaulay2/Core/Core.m2:148:8-148:68

o1 : FilePosition
i2 : code needs

o2 = ${prefix}/share/Macaulay2/Core/Core.m2:148:8-148:68: --source
     code:
     needs = filename -> (loadPath(path, filename, simpleNeeds, notify);)

If f is a sequence, then lookup is applied first, and the location of the resulting function is provided.

i3 : locate(jacobian, Matrix)

o3 = ${prefix}/share/Macaulay2/Core/matrix.m2:550:29-550:66

o3 : FilePosition

In particular, the output of methods can be used as an input to locate.

i4 : locate methods jacobian

o4 = {0 => (${prefix}/share/Macaulay2/Core/matrix.m2:550:29-550:66) }
     {1 => (${prefix}/share/Macaulay2/Core/matrix.m2:551:27-551:62) }
     {2 => (${prefix}/share/Macaulay2/Core/matrix.m2:552:34-552:60) }
     {3 => (${prefix}/share/Macaulay2/Core/matrix1.m2:512:28-512:56)}

o4 : NumberedVerticalList
i5 : methods doc

o5 = {0 => (doc, String)}

o5 : NumberedVerticalList
i6 : locate 0

o6 = ${prefix}/share/Macaulay2/SimpleDoc.m2:42:14-49:83

o6 : FilePosition
i7 : peek oo

o7 = FilePosition{${prefix}/share/Macaulay2/SimpleDoc.m2,
     ------------------------------------------------------------------------
     42, 14, 49, 83, 42, 14}

If the function f is compiled, or if f is null, then a location is not available and null is returned.

See also

Ways to use locate:

  • locate(DocumentTag) -- see DocumentTag -- the class of all document tags
  • locate(Command)
  • locate(Function)
  • locate(FunctionBody)
  • locate(List)
  • locate(Nothing)
  • locate(Package)
  • locate(Pseudocode)
  • locate(Sequence)
  • locate(Symbol)
  • locate(ZZ)
  • locate(TestInput) -- see tests -- locate a package's tests

For the programmer

The object locate is a method function with a single argument.


The source of this document is in Macaulay2Doc/functions/locate-doc.m2:59:0.