Download attributed graph-based representations for software view generation
Transcript
59 GraphRecordType(G ;u); GraphNode u; APDG G = (N ; E ); /* For each declaration section of a record type t, this process gets a /* queue L of all eld selectors in a this section and their type s. /* Then, it creates an o node for each eld selector and links /* this node with two arcs to the procedure node u and the type node s. /* Th queue is used to reserve the ordering of the elds of the record. [ GraphNode p; s; t; Identifier id; Queue of identiers L; /* Represent the record type entity. id = NextIdentier(); t = CreateNewNode( id; t node ); AddEdge(G ; u; t; l); /* N =N [ ftg /* E = E [ f u!l t g Repeat /* Process each identiers list /* Get the identiers list of this section. L = ;; Repeat id = NextIdentier(); /* N = N [ fpg; p = CreateNewNode(id; o node); AddQueue ( L; p); Until all eld identiers are processed; ] /* Get the type of all elds in this section s = GetType(); /* Create the subgraph representation of this section. Repeat p = DeleteQueue( L ); AddEdge(G ; t; p; l); /* E = E [ f t!l p g AddEdge(G ; p; s; r); /* E = E [ f p!r s g Until EmptyQueue( L ); /* L == ; Until end of the current declaration part; Algorithm 5.3: GraphRecordType