Skip to content

Instantly share code, notes, and snippets.

@alexeyr
Created October 30, 2010 14:00
Show Gist options
  • Select an option

  • Save alexeyr/655324 to your computer and use it in GitHub Desktop.

Select an option

Save alexeyr/655324 to your computer and use it in GitHub Desktop.

Revisions

  1. alexeyr revised this gist Oct 30, 2010. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions moddeps.erl
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,7 @@ write_to(Filename) ->

    A2L = fun atom_to_list/1,
    file:write_file(Filename,
    iolist_to_binary(
    "graph G { "
    ++ [$\n]
    ++ [[$\t, A2L(From), " -- ", A2L(To), " ; ", $\n]
    ["graph G { \n"
    , [[$\t, A2L(From), " -- ", A2L(To), " ; ", $\n]
    || {From, To} <- Mods]
    ++ " }" ++ [$\n])).
    , " }\n"]).
  2. @beapirate beapirate created this gist Oct 29, 2010.
    18 changes: 18 additions & 0 deletions moddeps.erl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    -module(moddeps).
    -compile(export_all).


    write_to(Filename) ->
    xref:start(s),
    xref:add_directory(s, "ebin"),
    {ok, Calls} = xref:q(s, "XC"),
    Mods = [{From, To} || {{From,_,_}, {To,_,_}} <- Calls],

    A2L = fun atom_to_list/1,
    file:write_file(Filename,
    iolist_to_binary(
    "graph G { "
    ++ [$\n]
    ++ [[$\t, A2L(From), " -- ", A2L(To), " ; ", $\n]
    || {From, To} <- Mods]
    ++ " }" ++ [$\n])).