aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/user_drv.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2013-04-22 15:28:49 +0200
committerHans Bolinder <[email protected]>2013-05-06 12:14:12 +0200
commit21a7806986d58480367cff8d385a12f9659c7754 (patch)
treecba88bf517ff4f86b86bb0d649f5204bac4d9ade /lib/kernel/src/user_drv.erl
parent0dc5a00011d1d24b68c9d43ff608415f84c50499 (diff)
downloadotp-21a7806986d58480367cff8d385a12f9659c7754.tar.gz
otp-21a7806986d58480367cff8d385a12f9659c7754.tar.bz2
otp-21a7806986d58480367cff8d385a12f9659c7754.zip
Fix unmatched_returns warnings in STDLIB and Kernel
Diffstat (limited to 'lib/kernel/src/user_drv.erl')
-rw-r--r--lib/kernel/src/user_drv.erl41
1 files changed, 26 insertions, 15 deletions
diff --git a/lib/kernel/src/user_drv.erl b/lib/kernel/src/user_drv.erl
index bb654495d3..6544426a54 100644
--- a/lib/kernel/src/user_drv.erl
+++ b/lib/kernel/src/user_drv.erl
@@ -488,21 +488,19 @@ set_unicode_state(Iport, Bool) ->
%% io_request(Request, InPort, OutPort)
%% io_requests(Requests, InPort, OutPort)
-
-io_request({put_chars, unicode,Cs}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]}};
-io_request({move_rel,N}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_MOVE|put_int16(N, [])]}};
-io_request({insert_chars,unicode,Cs}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_INSC|unicode:characters_to_binary(Cs,utf8)]}};
-io_request({delete_chars,N}, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_DELC|put_int16(N, [])]}};
-io_request(beep, _Iport, Oport) ->
- Oport ! {self(),{command,[?OP_BEEP]}};
-io_request({requests,Rs}, Iport, Oport) ->
- io_requests(Rs, Iport, Oport);
-io_request(_R, _Iport, _Oport) ->
- ok.
+%% Note: InPort is unused.
+
+io_request(Request, Iport, Oport) ->
+ try io_command(Request) of
+ Command ->
+ Oport ! {self(),Command},
+ ok
+ catch
+ {requests,Rs} ->
+ io_requests(Rs, Iport, Oport);
+ _ ->
+ ok
+ end.
io_requests([R|Rs], Iport, Oport) ->
io_request(R, Iport, Oport),
@@ -513,6 +511,19 @@ io_requests([], _Iport, _Oport) ->
put_int16(N, Tail) ->
[(N bsr 8)band 255,N band 255|Tail].
+io_command({put_chars, unicode,Cs}) ->
+ {command,[?OP_PUTC|unicode:characters_to_binary(Cs,utf8)]};
+io_command({move_rel,N}) ->
+ {command,[?OP_MOVE|put_int16(N, [])]};
+io_command({insert_chars,unicode,Cs}) ->
+ {command,[?OP_INSC|unicode:characters_to_binary(Cs,utf8)]};
+io_command({delete_chars,N}) ->
+ {command,[?OP_DELC|put_int16(N, [])]};
+io_command(beep) ->
+ {command,[?OP_BEEP]};
+io_command(Else) ->
+ throw(Else).
+
%% gr_new()
%% gr_get_num(Group, Index)
%% gr_get_info(Group, Pid)