Permalink
Browse files

Add some very rudimentary EDoc tags to Matthias's comments

  • Loading branch information...
1 parent 791b65a commit 0dd0975ecf9d0a47f414e4b74f4fdc2cf44c796b Scott Lystig Fritchie committed Nov 3, 2010
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/trunc_io.erl
View
@@ -13,7 +13,7 @@
%% Portions created by Corelatus are Copyright 2003, Corelatus
%% AB. All Rights Reserved.''
%%
-%% Module to print out terms for logging. Limits by length rather than depth.
+%% @doc Module to print out terms for logging. Limits by length rather than depth.
%%
%% The resulting string may be slightly larger than the limit; the intention
%% is to provide predictable CPU and memory consumption for formatting
@@ -23,6 +23,9 @@
%%
%% trunc_io:print(Term, 500).
%%
+%% Source license: Erlang Public License.
+%% Original author: Matthias Lang, <tt>matthias@corelatus.se</tt>
+
-module(trunc_io).
-author('matthias@corelatus.se').
%% And thanks to Chris Newcombe for a bug fix
@@ -31,13 +34,13 @@
-version("$Id: trunc_io.erl,v 1.11 2009-02-23 12:01:06 matthias Exp $").
-%% Returns an flattened list containing the ASCII representation of the given
+%% @doc Returns an flattened list containing the ASCII representation of the given
%% term.
fprint(T, Max) ->
{L, _} = print(T, Max),
lists:flatten(L).
-%% Same as print, but never crashes.
+%% @doc Same as print, but never crashes.
%%
%% This is a tradeoff. Print might conceivably crash if it's asked to
%% print something it doesn't understand, for example some new data
@@ -52,13 +55,13 @@ safe(What, Len) ->
_ -> {"unable to print" ++ io_lib:write(What, 99)}
end.
-%% Returns {List, Length}
+%% @doc Returns {List, Length}
print(_, Max) when Max < 0 -> {"...", 3};
print(Tuple, Max) when is_tuple(Tuple) ->
{TC, Len} = tuple_contents(Tuple, Max-2),
{[${, TC, $}], Len + 2};
-%% We assume atoms, floats, funs, integers, PIDs, ports and refs never need
+%% @doc We assume atoms, floats, funs, integers, PIDs, ports and refs never need
%% to be truncated. This isn't strictly true, someone could make an
%% arbitrarily long bignum. Let's assume that won't happen unless someone
%% is being malicious.

0 comments on commit 0dd0975

Please sign in to comment.