| 44 | | 1. ''ri'' (using RefactorErl through console interface) |
| 45 | | 2. using the ''web'' interface. (see: wiki:WebInterface/DependencyExaminations) \\ |
| 46 | | |
| 47 | | |
| 48 | | == The ''ri'' == |
| 49 | | |
| 50 | | The two interface functions are: |
| 51 | | |
| 52 | | 1. |
| 53 | | {{{#!erlang |
| 54 | | ri:draw_dep/1 |
| 55 | | }}} |
| 56 | | - for drawing |
| 57 | | 2. |
| 58 | | {{{#!erlang |
| 59 | | ri:print_dep/1 |
| 60 | | }}} |
| 61 | | - for listing, printing out to the standard output \\ |
| 62 | | \\ |
| 63 | | \\ |
| 64 | | \\ |
| 65 | | |
| 66 | | === Options for ''ri'' === |
| 67 | | To call the desired query, the user should give a ''proplist'', stating the different requirements. \\ |
| 68 | | The options and the keys for the functions are: |
| 69 | | * |
| 70 | | {{{#!erlang |
| 71 | | {level, Level} |
| 72 | | Level = mod | func |
| 73 | | }}} |
| 74 | | Stating the level of the query, module or function level. |
| 75 | | * |
| 76 | | {{{#!erlang |
| 77 | | {type, Type} |
| 78 | | Type = all | cycles |
| 79 | | }}} |
| 80 | | The investigation should be done on the whole graph/table, or just on the cycle part (if it exists). \\ |
| 81 | | When listing out the cycles, {{{all}}} gives back the result in their graph node form, while {{{cycles}}} returns with their proper |
| 82 | | names. |
| 83 | | * |
| 84 | | {{{#!erlang |
| 85 | | {gnode, Node | lists(Node)} |
| 86 | | Node = node() | Name |
| 87 | | Name = Module::atom() | Function::string() |
| 88 | | }}} |
| 89 | | Specify a node or nodes (given in a list) as a starting point for the analysis. \\ |
| 90 | | - Module level: the name as an atom \\ |
| 91 | | - Function level: name as string ("Module:Function/Arity"). \\ |
| 92 | | - In both cases the node/nodes can be given as graph nodes as well.\\ |
| 93 | | * |
| 94 | | {{{#!erlang |
| 95 | | {dot, Dot::string()} |
| 96 | | }}} |
| 97 | | The user can stipulate his own name and absolute path or the generated {{{.dot}}} file. |
| 98 | | Unless it is a new absolute path, the {{{.dot}}} file will be placed into |
| 99 | | the {{{./dep_files}}} directory. Only available in the case of draw_dep. |
| 100 | | * |
| 101 | | {{{#!erlang |
| 102 | | {exception, NodeList::lists(Node)} |
| 103 | | Node = node() | Name |
| 104 | | Name = Module::atom() | Function::string() |
| 105 | | }}} |
| 106 | | The exception key gives the user the opportunity to define certain nodes (by stating their name or by giving a gnode) which |
| 107 | | will be exluded from the analysis. |
| 108 | | * |
| 109 | | {{{#!erlang |
| 110 | | {leaves, NodeList::lists(Node)} |
| 111 | | Node = node() | Name |
| 112 | | Name = Module::atom() | Function::string() |
| 113 | | }}} |
| 114 | | Leaves contains those nodes which would be included in the analysis, but their children won't (so this way they become exceptions). |
| 115 | | * |
| 116 | | {{{#!erlang |
| 117 | | {otp, true | false} |
| 118 | | }}} |
| 119 | | The built-in erlang otp modules should be included in the analysis or not. The default value is false. |
| 120 | | |
| 121 | | === Examples for listing results === |
| 122 | | |
| 123 | | |
| 124 | | |
| 125 | | * Checking for cycles in module level. \\ |
| 126 | | {{{#!erlang |
| 127 | | ri:print_dep([{level, mod}, {type, all}]). |
| 128 | | }}} |
| 129 | | |
| 130 | | |
| 131 | | * Checking for cycles in function level, and printing out the whole names of the functions (Module:Function/Arity). \\ |
| 132 | | {{{#!erlang |
| 133 | | ri:print_dep([{level, func}, {type, cycles}]). |
| 134 | | |
| 135 | | [['foo:fv4/1','foo:fv4/1'], |
| 136 | | ['test3:p/1','test:fv6/1','test3:p/1'], |
| 137 | | ['cycle4:f4/1','cycle3:f3/1','cycle4:f4/1'], |
| 138 | | ['cycle2:fv2/1','cycle1:fv1/0','cycle2:fv2/1'], |
| 139 | | ['test:fv5/1','test:fv4/2','test:fv5/1'], |
| 140 | | ['cycle4:f5/1','cycle3:f6/1','cycle4:f5/1']] |
| 141 | | }}} |
| 142 | | |
| 143 | | |
| 144 | | * Checking for cycles in function level, and printing out the graph nodes of the functions (notice the changed "type" in the proplist) \\ |
| 145 | | {{{#!erlang |
| 146 | | ri:print_dep([{level, func}, {type, all}]). |
| 147 | | |
| 148 | | {"6 cycle(s)", |
| 149 | | {[[{'$gn',func,28},{'$gn',func,28}], |
| 150 | | [{'$gn',func,29},{'$gn',func,37},{'$gn',func,29}], |
| 151 | | [{'$gn',func,7},{'$gn',func,9},{'$gn',func,7}], |
| 152 | | [{'$gn',func,2},{'$gn',func,1},{'$gn',func,2}], |
| 153 | | [{'$gn',func,36},{'$gn',func,35},{'$gn',func,36}], |
| 154 | | [{'$gn',func,8},{'$gn',func,6},{'$gn',func,8}]]} |
| 155 | | }}} |
| 156 | | |
| 157 | | * Checking for cycles in module level from an exact node \\ |
| 158 | | {{{#!erlang |
| 159 | | ri:print_dep([{level, mod}, {gnode, {'$gn', module, 24}}]). |
| 160 | | |
| 161 | | {true,[[{'$gn',module,24}, |
| 162 | | {'$gn',module,25}, |
| 163 | | {'$gn',module,24}]]} |
| 164 | | }}} |
| 165 | | |
| 166 | | |
| 167 | | * Checking for cycles in function level from an exact node given with its whole name \\ |
| 168 | | {{{#!erlang |
| 169 | | ri:print_dep([{level, func}, {gnode, "cycle4:f5/1"}]). |
| 170 | | }}} |