This simple script creates a dialog box showing a list of all modules that are linked to the current module. It also includes the name of the link module used and a count of the number of links.
// List Linked Modules /* 02-MAR-2011 Tony Goodman Initial Version */ // List Linked Modules /* Lists modules that are linked to from the current module, together with a count of links. */ pragma runLim, 0 DB dbMain = null DBE dbeResults = null Module m = null /*********************** populateBuffer ************************/ void populateBuffer(Buffer &b) { Object o = null Link l = null LinkRef lr = null ModName_ mn = null int count = 0 int outTotal = 0 int inTotal = 0 Skip inLinks = createString Skip outLinks = createString string s = "" for o in m do { for l in o -> "*" do { mn = target(l) s = fullName(mn) " [" fullName(module(l)) "]" if (find(outLinks, s, count)) { delete(outLinks, s) put(outLinks, s, count + 1) } else { put(outLinks, s, 1) } outTotal++ } } b += fullName(m) "\n\n" if (outTotal == 0) { b += "has no outgoing links\n" } else { b += "has outgoing links to:\n" for count in outLinks do { b += (string key outLinks) " - " count " links\n" } } for o in (m) do { for lr in o <- "*" do { mn = source(lr) s = fullName(mn) " [" fullName(module(lr)) "]" if (find(inLinks, s, count)) { delete(inLinks, s) put(inLinks, s, count + 1) } else { put(inLinks, s, 1) } inTotal++ } } if (inTotal == 0) { b += "has no incoming links\n" } else { b += "\nhas incoming links from:\n" for count in inLinks do { b += (string key inLinks) " - " count " links\n" } } b += "\n" } /******************************* listLinkedModules ********************************/ void buildDialog() { Buffer b = create populateBuffer(b) dbMain = create(m, "Linked Modules", styleFloating|styleCentered) dbeResults = text(dbMain, "", "", 800, 250, false) realize(dbMain) set(dbeResults, b) delete(b) b = null show(dbMain) } /******************************* listLinkedModules ********************************/ void listLinkedModules() { m = current Module buildDialog() } listLinkedModules()