Ada - How to generate a list of package variables from GNAT Pro Studio?

StackOverflow https://stackoverflow.com/questions/13371298

  •  29-11-2021
  •  | 
  •  

سؤال

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?

هل كانت مفيدة؟

المحلول

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".

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top