aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-05-21 09:02:00 +0200
committerBjörn Gustavsson <[email protected]>2019-05-29 16:31:06 +0200
commit5fef9df3faf0504c5c281a5720b992c19c94a6c2 (patch)
tree6722280600acf117b75148507b710eb28ee213e2 /lib/erl_interface/src
parent3d7b35dcc7852ec735f39a66566f80f8dad65701 (diff)
downloadotp-5fef9df3faf0504c5c281a5720b992c19c94a6c2.tar.gz
otp-5fef9df3faf0504c5c281a5720b992c19c94a6c2.tar.bz2
otp-5fef9df3faf0504c5c281a5720b992c19c94a6c2.zip
Teach ei_print_term() to print funs
Diffstat (limited to 'lib/erl_interface/src')
-rw-r--r--lib/erl_interface/src/misc/ei_printterm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/erl_interface/src/misc/ei_printterm.c b/lib/erl_interface/src/misc/ei_printterm.c
index 52ab8cd504..a94d6e2ad8 100644
--- a/lib/erl_interface/src/misc/ei_printterm.c
+++ b/lib/erl_interface/src/misc/ei_printterm.c
@@ -121,6 +121,7 @@ static int print_term(FILE* fp, ei_x_buff* x,
erlang_pid pid;
erlang_port port;
erlang_ref ref;
+ erlang_fun fun;
double d;
long l;
@@ -329,6 +330,23 @@ static int print_term(FILE* fp, ei_x_buff* x,
*index = tindex;
xputc('}', fp, x); ch_written++;
break;
+ case ERL_FUN_EXT:
+ case ERL_NEW_FUN_EXT:
+ case ERL_EXPORT_EXT:
+ if (ei_decode_fun(buf, &tindex, &fun) < 0) goto err;
+ if (fun.type == EI_FUN_EXPORT) {
+ ch_written += xprintf(fp, x, "fun %s:%s/%ld",
+ fun.module,
+ fun.u.exprt.func,
+ fun.arity);
+ } else {
+ ch_written += xprintf(fp, x, "#Fun{%s.%ld.%lu}",
+ fun.module,
+ fun.u.closure.index,
+ fun.u.closure.uniq);
+ }
+ *index = tindex;
+ break;
default:
goto err;
}