ASIS2XML

ASIS is the Ada Semantic Interface Specification; see http://www.acm.org/sigada/WG/asiswg/.

This program converts a unit's ASIS representation into XML, so as to make it easier to develop transformational tools using (for example) XSLT.

As supplied, it relies on GNAT; the only GNAT feature it relies on is that Data_Decomposition.Size has been extended to work for Subtype Indications; and that only so that it can work out how many bytes a record component will occupy when streamed.

Not every ASIS feature is supported yet.

There is no XML Schema as yet. The output's structure is quite close to that of ASIS, at least in overall terms; for example, an A_Defining_Name element in ASIS is represented as a <defining_name/> element in XML.

Copyright

This work is derived from the Node_Trav component of Display_Source, which is distributed as a part of the ASIS implementation for GNAT and is Copyright (c) 1995-1999, Free Software Foundation, Inc. The original work in the program is Copyright (c) Simon Wright .

Licensing

The work is distributed under the terms of the GPL.

Download

here ...

Prerequisites

Building

These instructions are written for Linux and assume you've already extracted the distribution into your home directory; the files are at ~/asis2xml-yyyymmddl/ (the "l" is used for alpha (a), patch (p) or working (t...) releases). The supplied Makefile uses the GNAT Project file build.gpr, which makes assumptions about where things are; they should be straightforward to change.

Install ASIS-for-GNAT. I've used

   $ make INSTALL_DIR=$HOME/asis-3.15p
(substitute your GNAT version there).

Make a symbolic link ~/asis pointing to the directory where the ASIS installation has placed the source code (with 3.15p it's in INSTALL_DIR/asis).

Unpack XML/Ada.

Make a symbolic link ~/xmlada pointing to the XML/Ada installation directory.

Go to the ~/asis2xml-yyyymmddl/ directory and just say make.

Installation

Copy the built asis2xml to a directory on your path.

Use

asis2xml will accept either a spec file (.ads) or a tree file (.adt). The GNAT ASIS implementation doesn't understand Project files, so if you have any sort of complex path setup the way to go is to generate the tree file:

   $ gnatmake -Pbuild -c -u -f -gnatct example.ads
creates example.adt in your project (build.gpr)'s Object_Dir -- in the case of asis2xml's build.gpr, this is ./.build. You have to have the input file in the current directory, because asis2xml assumes the parameter filename specifies the unit. This will be sorted!
   $ asis2xml example.adt >example.xml
The output is in "packed" XML; to get a more legible view, you can use HTML Tidy:
   $ asis2xml example.adt | tidy -xml -i >example.xml
or variations.
Simon Wright