<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,8 @@
 2009-08-31  Robert Virding  &lt;rv@stanislaw.local&gt;
 
+	* lfe_io_pretty.erl (print1_list_max, print1_tail_max): Get it
+	right when depth = 0.
+
 	* lfe_comp.erl (passes, do_passes): Add an explicit pass driven
 	style to compiler.
 </diff>
      <filename>src/ChangeLog</filename>
    </modified>
    <modified>
      <diff>@@ -33,8 +33,8 @@
 
 %% -compile(export_all).
 
--import(lists, [member/2,keysearch/3,filter/2,
-		all/2,map/2,foldl/3,foldr/3,mapfoldl/3,mapfoldr/3,
+-import(lists, [member/2,keysearch/3,filter/2,foreach/2,
+		all/2,map/2,flatmap/2,foldl/3,foldr/3,mapfoldl/3,mapfoldr/3,
 		concat/1]).
 -import(ordsets, [add_element/2,is_element/2,from_list/1,union/2]).
 -import(orddict, [store/3,find/2]).
@@ -179,7 +179,8 @@ passes() -&gt;
      {do,fun do_lfe_codegen/1},
      {when_flag,to_core0,{done,fun core_pp/2,&quot;core&quot;}},
      {do,fun do_erl_comp/1},
-     %% to_core will make erl compiler return core erlang.
+     %% These options will have made erl compiler return internal form
+     %% after pass.
      {when_flag,to_core,{done,fun core_pp/2,&quot;core&quot;}},
      {when_flag,to_kernel,{done,fun kernel_pp/2,&quot;kernel&quot;}},
      {when_flag,to_asm,{done,fun asm_pp/2,&quot;S&quot;}},
@@ -246,8 +247,7 @@ beam_write(File, Beam) -&gt; file:write(File, Beam).
 
 %% fix_erl_errors([{File,Errors}]) -&gt; Errors.
 
-fix_erl_errors([{_,Es}|Fes]) -&gt; Es ++ fix_erl_errors(Fes);
-fix_erl_errors([]) -&gt; [].
+fix_erl_errors(Fes) -&gt; flatmap(fun ({_,Es}) -&gt; Es end, Fes).
 
 %% erl_comp_opts(Options) -&gt; Options.
 %%  Strip out report options and make sure erlang compiler returns
@@ -255,7 +255,7 @@ fix_erl_errors([]) -&gt; [].
 %%  strange behaviour.
 
 erl_comp_opts(Os) -&gt;
-    filter(fun (report) -&gt; false;
+    filter(fun (report) -&gt; false;		%No reporting!
 	       (report_warnings) -&gt; false;
 	       (report_errors) -&gt; false;
 	       ('S') -&gt; false;
@@ -289,21 +289,23 @@ do_error_return(#comp{lfile=Lfile,opts=Opts,errors=Es,warnings=Ws}) -&gt;
 return_errors(_, []) -&gt; [];
 return_errors(Lfile, Es) -&gt; [{Lfile,Es}].
 
-list_warnings(F, [{Line,Mod,Warn}|Ws]) -&gt;
-    lfe_io:format(&quot;~s:~w: Warning: ~s\n&quot;, [F,Line,Mod:format_error(Warn)]),
-    list_warnings(F, Ws);
-list_warnings(F, [{Mod,Warn}|Ws]) -&gt;
-    lfe_io:format(&quot;~s: Warning: ~s\n&quot;, [F,Mod:format_error(Warn)]),
-    list_warnings(F, Ws);
-list_warnings(_, []) -&gt; [].
-
-list_errors(F, [{Line,Mod,Error}|Ws]) -&gt;
-    lfe_io:format(&quot;~s:~w: ~s\n&quot;, [F,Line,Mod:format_error(Error)]),
-    list_errors(F, Ws);
-list_errors(F, [{Mod,Error}|Ws]) -&gt;
-    lfe_io:format(&quot;~s: ~s\n&quot;, [F,Mod:format_error(Error)]),
-    list_errors(F, Ws);
-list_errors(_, []) -&gt; [].
+list_warnings(F, Ws) -&gt;
+    foreach(fun ({Line,Mod,Warn}) -&gt;
+		    Cs = Mod:format_error(Warn),
+		    lfe_io:format(&quot;~s:~w: Warning: ~s\n&quot;, [F,Line,Cs]);
+		({Mod,Warn}) -&gt;
+		    Cs = Mod:format_error(Warn),
+		    lfe_io:format(&quot;~s: Warning: ~s\n&quot;, [F,Cs])
+	    end, Ws).
+
+list_errors(F, Es) -&gt;
+    foreach(fun ({Line,Mod,Error}) -&gt;
+		    Cs = Mod:format_error(Error),
+		    lfe_io:format(&quot;~s:~w: ~s\n&quot;, [F,Line,Cs]);
+		({Mod,Error}) -&gt;
+		    Cs = Mod:format_error(Error),
+		    lfe_io:format(&quot;~s: ~s\n&quot;, [F,Cs])
+	    end, Es).
 
 debug_print(Format, Args, St) -&gt;
     when_opt(fun () -&gt; lfe_io:format(Format, Args) end,</diff>
      <filename>src/lfe_comp.erl</filename>
    </modified>
    <modified>
      <diff>@@ -33,7 +33,7 @@
 
 -compile(export_all).
 
--import(lists, [reverse/1,flatlength/1]).
+-import(lists, [reverse/1,reverse/2,flatlength/1]).
 
 %% print1(Sexpr) -&gt; [char()].
 %% print1(Sexpr, Depth) -&gt; [char()].
@@ -85,7 +85,7 @@ print1([], _, _, _) -&gt; &quot;()&quot;;
 print1({}, _, _, _) -&gt; &quot;#()&quot;;
 print1(Tup, D, I, L) when is_tuple(Tup) -&gt;
     Es = tuple_to_list(Tup),
-    case print1_list_max(Es, D, I+3, L) of
+    case print1_list_max(Es, D-1, I+3, L) of
 	{yes,Print}  -&gt; [&quot;#(&quot;,Print,&quot;)&quot;];
 	no -&gt; [&quot;#(&quot;,print1_list(Es, D-1, I+2, L),&quot;)&quot;]
     end;
@@ -108,6 +108,7 @@ split(N, [H|T]) -&gt;
 %%  Maybe print a list on one line, but abort if it goes past
 %%  LineLength.
 
+print1_list_max(_, 0, _, _) -&gt; {yes,&quot;...&quot;};
 print1_list_max([Car|Cdr], D, I, L) -&gt;
     Cs = print1(Car, D, 0, 99999),		%Never break the line
     print1_tail_max(Cdr, D, I + flatlength(Cs), L, [Cs]);
@@ -119,16 +120,18 @@ print1_list_max([], _, _, _) -&gt; {yes,[]}.
 
 print1_tail_max(_, _, I, L, _) when I &gt;= L -&gt; no;	%No more room
 print1_tail_max([], _, _, _, Acc) -&gt; {yes,reverse(Acc)};
+print1_tail_max(_, 0, _, _, Acc) -&gt; {yes,reverse(Acc)};
 print1_tail_max([Car|Cdr], D, I, L, Acc) -&gt;
-    Cs = print1(Car, D, 0, 99999),		%Never break the line
-    print1_tail_max(Cdr, D, I + flatlength(Cs) + 1, L, [Cs,&quot; &quot;|Acc]);
+    Cs = print1(Car, D-1, 0, 99999),		%Never break the line
+    print1_tail_max(Cdr, D-1, I + flatlength(Cs) + 1, L, [Cs,&quot; &quot;|Acc]);
 print1_tail_max(S, D, I, L, Acc) -&gt;
-    Cs = print1(S, D, 0, 99999),		%Never break the line
+    Cs = print1(S, D-1, 0, 99999),		%Never break the line
     print1_tail_max([], D, I + flatlength(Cs) + 3, L, [Cs,&quot; . &quot;|Acc]).
 
 %% print1_list(List, Depth, Indentation, LineLength)
 %%  Print a list, one element per line. No leading/trailing ().
 
+print1_list(_, 0, _, _) -&gt; &quot;...&quot;;
 print1_list([Car|Cdr], D, I, L) -&gt;
     [print1(Car, D, I, L),print1_tail(Cdr, D, I, L)];
 print1_list([], _, _, _) -&gt; [].
@@ -137,7 +140,7 @@ print1_list([], _, _, _) -&gt; [].
 %%  Print the tail of a list. We know about dotted pairs.
 
 print1_tail([], _, _, _) -&gt; &quot;&quot;;
-print1_tail(_, 1, _, _) -&gt; &quot; ...&quot;;
+print1_tail(_, 0, _, _) -&gt; &quot;&quot;;
 print1_tail([Car|Cdr], D, I, L) -&gt;
     [&quot;\n&quot;,blanks(I, []),print1(Car, D-1, I, L),print1_tail(Cdr, D-1, I, L)];
 print1_tail(S, D, I, L) -&gt;</diff>
      <filename>src/lfe_io_pretty.erl</filename>
    </modified>
    <modified>
      <diff>@@ -67,8 +67,9 @@ server_loop(Env0, BaseEnv) -&gt;
 	      Env1 = update_vbinding('-', Form, Env0),
 	      %% Macro expand and evaluate it.
 	      {Value,Env2} = eval_form(Form, Env1, BaseEnv),
-	      %% Print the result.
-	      lfe_io:prettyprint(Value), io:nl(),
+	      %% Print the result, but only to depth 30.
+	      VS = lfe_io:prettyprint1(Value, 30),
+	      io:requests([{put_chars,VS},nl]),
 	      %% Update bindings.
 	      Env3 = update_shell_vars(Form, Value, Env2),
 	      %% lfe_io:prettyprint({Env1,Env2}), io:nl(),</diff>
      <filename>src/lfe_shell.erl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f866aed6f7923afbd2f04c2749797241f4e4c9df</id>
    </parent>
  </parents>
  <author>
    <name>Robert Virding</name>
    <email>rvirding@gmail.com</email>
  </author>
  <url>http://github.com/rvirding/lfe/commit/2b2e1db19f80fb8696a573c1afaec0d8cecabced</url>
  <id>2b2e1db19f80fb8696a573c1afaec0d8cecabced</id>
  <committed-date>2009-08-31T13:40:03-07:00</committed-date>
  <authored-date>2009-08-31T13:40:03-07:00</authored-date>
  <message>Mixed small improvements.</message>
  <tree>b8f963d811dbd65a6f9f6f1dfa2fb1948c828295</tree>
  <committer>
    <name>Robert Virding</name>
    <email>rvirding@gmail.com</email>
  </committer>
</commit>
