Question

I'd like to use the xref information from a GPS Ada project to generate lists of the variables defined for each package spec and body. I need to exclude any variables defined inside of subprograms.

I can see this information in GPS's "Project View" which shows the literals, package, pragmas, types, and variables defined in each file. However, the information is not selectable for cut/paste. How do I generate this in text form?

Was it helpful?

Solution

GPS is customised using Python. The provided scripts are in {installation}/share/gps/library; it looks as though unused_entities.py might be a good start. Or, there's a chapter on "Customizing and Extending GPS" in the GPS documentation.

[Edit]

Or, even better, look at the example globals.py in {installation}/share/examples/gps/python. A quick poke through the documentation (accessed in GPS via Help/Python extensions) suggests you're looking for GPS.Entities e where e.category() is "object".

OTHER TIPS

Since you mention GPS, have you tried Tools->Documentation->Generate project? This will generate html, with hyperlinks etc, similar to Javadoc.

SciTools' Understand product can extract this information, although it's rather pricey. Though if you're working with a mound of legacy code, it's well worth the money--it has saved my bacon on more than one occasion.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top