The output of CPPX is a graph, that is, a collection of vertices and edges, representing the structure and meaning of the input program. The graph must be output in a generally acceptable format if CPPX is to be a universal front end. We use the Graph Exchange Language GXL, which draws together many streams of research and experience in representing and using graphs to exchange software engineering data. GXL is an XML sublanguage with a published DTD.

GXL provides a schema facility, whereby the details and constraints of a class of GXL graphs can be advertised beforehand. A GXL schema for the Datrix model, which is the class of graphs generated by CPPX, is available here. Not all the facilities of GXL are used: there are attributed vertices and edges, but no n-ary relationships, and no contained graphs. Edge ordering is represented explicitly, in keeping with the Datrix model, so the inherent fromorder and toorder edge attributes are not used.

Here is a very simple C++ source, declaring just an enumerated type and nothing else:

enum E
{
    enumerator1 = 0,
    enumerator2,
    enumerator3 = 5
};

Here is what the CPPX output looks like in GXL (lots omitted):

<?xml version="1.0"?>
<!DOCTYPE gxl SYSTEM "gxl-1-0.dtd">
<gxl>
 <graph id="enums.gd">
  <node id="@0">
   <type xlink:href="gd.xml#NameSpace" />
   <attr name="name"><string>::</string></attr>
   <attr name="visb"><string>unkown</string></attr>
  </node>
  <edge from="@0" to="@2">
   <type xlink:href="gd.xml#ArcSon" />
  </edge>
... ...
  <edge from="@14" to="@4">
   <type xlink:href="gd.xml#Instance" />
   <attr name="ordinal"><int>1</int></attr>
  </edge>
  <edge from="@20" to="@4">
   <type xlink:href="gd.xml#Instance" />
   <attr name="ordinal"><int>1</int></attr>
  </edge>
 </graph>
</gxl>

Everything you need to know about GXL in general is available from its web site.

last update 2001 May 9 by AJM