| 1 | = Module and Function Dependencies = |
| 2 | |
| 3 | == Concerning terminology == |
| 4 | We say that a module A is '''dependent''' on another '''module''' ''B'' (''A -> B'') if there is |
| 5 | at least one function call from ''A'' to ''B''. \\ |
| 6 | A '''cyclic dependency''' appears, when ''B'' is |
| 7 | also dependent directly (''B -> A'') or indirectly (e.g. ''B -> C -> A'') from ''A''. \\ |
| 8 | Note that it is possible to have a cyclic dependency among the modules while having |
| 9 | no cyclic dependencies among the functions. \\ For example, a function call from |
| 10 | ''A:foo'' to ''B:foo'', and from ''B:foo2'' to ''A:foo2'' implies a cyclic dependency on the |
| 11 | module level. \\ |
| 12 | If one wants to have a deeper analysis and pays more |
| 13 | attention to the concerning functions, a '''function''' level query should be done. \\ In |
| 14 | our previous example, no function level cycle appears, unless ''A:foo'' calls ''B:foo'', |
| 15 | and ''B:foo'' calls ''A:foo''. \\ |
| 16 | \\ |
| 17 | The following examinations can be done considering dependencies:\\ |
| 18 | * ''Checking'' whether there are ''cycles'', if so, ''listing'' them out |
| 19 | * ''Printing out'' the cycles, meaning the modules/functions will not be rep- |
| 20 | resented by their proper graph node, but with their ''names'' \\ (for instance, |
| 21 | instead of {{{ {'$gn', module,3} }}}, module test will be printed, if the graph |
| 22 | node stands for that exact module). |
| 23 | * Checking for cycle ''from one or more nodes'' as starting points |
| 24 | * ''Drawing'' the dependency graph |
| 25 | * Drawing the dependency graph from a starting node |
| 26 | * Drawing the cyclic part of the dependency graph if one exists (you can |
| 27 | also give a cyclic node as a starting node) \\ |
| 28 | \\ |
| 29 | Dependency analysis can be done in two ways: by the means of ri interface or using the web interface. \\ |
| 30 | To call the desired query, the user |
| 31 | should give a proplist, stating the different requirements. \\ The two interface |
| 32 | functions are: |
| 33 | 1. {{{ri:draw_dep/1}}} - for drawing |
| 34 | 2. {{{ri:print_dep/1}}} - for listing, printing out to the standard output \\ |
| 35 | \\ |
| 36 | The options and the keys for the functions are: |
| 37 | * {{{{level, Level}| Level = mod | func}}} |
| 38 | Stating the level of the query, module or function level. |
| 39 | * {{{{type, Type} Type = all | cycles}}}} |
| 40 | The investigation should be done on the whole graph/table, or just on the |
| 41 | cycle part (if it exists). \\ When listing out the cycles, "all" gives back the |
| 42 | result in their graph node form, while "cycles" returns with their proper |
| 43 | names (see examples above). |