GetSymbolLocationEx (symbol_name, output_buffer, fMatchCase, LocateFiles, fLocateSymbols)
Finds all the declarations for the symbol specified in symbol_name. Each declaration location is appended as a line to the given buffer output_buffer as a Symbol record. If fMatchCase, then the symbol name case must match exactly. If fLocateFiles, then file names in the project or on the project symbol path are located. File extensions don't have to be specified. If fLocateSymbols, then symbol definitions are located. Both fLocateFiles and fLocateSymbols may be set to True.
Since record variables can be expressed as a string, a Symbol record can be written as a line of text in a buffer. To read a Symbol record from the output buffer, use the GetBufLine function to return the entire line text; in this case a Symbol record. See GetSymbolLocation for a description of the Symbol record.
GetSymbolLocationEx returns the number of matching declarations, or zero if none were found.
Unlike the GetSymbolLocation function, this function will find multiple declarations that match on symbol_name. You can use this function to enumerate through each location by scanning each line of the output buffer.
This example looks up a symbol and enumerates through each declaration found:
symbol = Ask("What symbol do you want to locate?")
hbuf = NewBuf("output")
count = GetSymbolLocationEx(symbol, hbuf, 1, 1, 1)
ln = 0
while (ln < count)
{
loc = GetBufLine(hbuf, ln)
msg (loc.file # " at line " # loc.lnFirst)
ln = ln + 1
}
CloseBuf(hbuf)
GetSymbolLocationEx can also look up file names. By giving a simple file name as the symbol_name parameter, GetSymbolLocationEx can look up the file in the project, or on the project symbol path, and return the fully qualified path to the file in the location.file field. See GetSymbolLocation for an example.
If fLocateFiles is TRUE, and a symbol name is given without an extension, GetSymbolLocationEx will locate files that have this base name, regardless of extension. For example, if you specify "dlg" in symbol_name, GetSymbolLocationEx may return matches on "dlg.c" (a file), and "dlg.h" (another file). Furthermore, if fLocateSymbols is also TRUE, then "DLG" (a data type) may also be returned.