Skip to content

Commit

Permalink
add sig/1,2 to user_Default
Browse files Browse the repository at this point in the history
  • Loading branch information
massemanet committed Aug 26, 2015
1 parent 01bd945 commit c74c9f8
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions user_default.erl
Expand Up @@ -6,19 +6,20 @@

-module('user_default').
-author('Mats Cronqvist').
-export([ineti/0
,ports/0
,export_all/1
,tab/0
,long/1,flat/1,dump/1
,e/2
,kill/1
,pi/1,pi/2
,os/1
,callstack/1
,bt/1
,pid/1
,lm/0]).
-export([ineti/0,
sig/1,sig/2,
ports/0,
export_all/1,
tab/0,
long/1,flat/1,dump/1,
e/2,
kill/1,
pi/1,pi/2,
os/1,
callstack/1,
bt/1,
pid/1,
lm/0]).

%% recompiles M with export_all without access to the source.
export_all(M) ->
Expand Down Expand Up @@ -56,6 +57,23 @@ lm() ->

[Load(M,F) || {M,F} <- code:all_loaded(), MD5Loaded(M) =/= MD5File(F)].

sig(M,F) ->
[{F,lists:usort([[siga(A) || A <- As]
|| {clause,_,As,_,_} <- C])}
|| {function,_,G,_,C} <- forms(M),F==G].
siga({var,_,V}) -> V;
siga({cons,_,_,_}) -> list;
siga({nil,_}) -> list;
siga({match,_,A1,A2}) -> {siga(A1),siga(A2)};
siga(X) -> X.

sig(M) ->
[{F,A}||{function,_,F,A,_}<-forms(M)].
forms(M) ->
{ok,{M,[{"Abst",B}]}} = beam_lib:chunks(code:which(M),["Abst"]),
{_,Forms} = binary_to_term(B),
Forms.

tab() ->
N=node(),
io:setopts([{expand_fun,fun(B)->rpc:call(N,edlin_expand,expand,[B]) end}]).
Expand Down

0 comments on commit c74c9f8

Please sign in to comment.