Skip to content

Commit

Permalink
Unify *print-length* formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Affonso-Gui committed Mar 28, 2019
1 parent 3bef60c commit 11dcdf4
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions lisp/c/printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,21 +372,19 @@ int prlevel;
printstr(ctx,n,vec->c.str.chars,f); break;
case ELM_INT:
writestr(f,(byte *)"#i(",3);
while (i<n && (nullprlen || prlength>0)) {
while (i<n && (nullprlen || prlength-->0)) {
printint(ctx,vec->c.ivec.iv[i++],f,intval(Spevalof(PRINTBASE)),
0,0);
if(i<n) writech(f,' ');
prlength--; }
if (i<n) writestr(f,(byte *)"... ",4);
if(i<n) writech(f,' '); }
if (i<n) writestr(f,(byte *)"...",3);
writech(f,')');
break;
case ELM_FLOAT:
writestr(f,(byte *)"#f(",3);
while (i<n && (nullprlen || prlength>0)) {
while (i<n && (nullprlen || prlength-->0)) {
printflt(vec->c.fvec.fv[i++],f);
if(i<n) writech(f,' ');
prlength--; }
if (i<n) writestr(f,(byte *)"... ",4);
if(i<n) writech(f,' '); }
if (i<n) writestr(f,(byte *)"...",3);
writech(f,')');
break;
case ELM_FOREIGN:
Expand All @@ -401,11 +399,10 @@ int prlevel;
writech(f,' ');
printint(ctx,(eusinteger_t)vec->c.vec.size,f,intval(Spevalof(PRINTBASE)),0,0);
writech(f,' ');}
while (i<n && (nullprlen || prlength>0)) {
while (i<n && (nullprlen || prlength-->0)) {
prin1(ctx,vec->c.vec.v[i++],f,prlevel);
if (i<n) writech(f,' ');
prlength--; }
if (i<n) writestr(f,(byte *)"... ",4);
if (i<n) writech(f,' '); }
if (i<n) writestr(f,(byte *)"...",3);
writech(f,')');}
return(vec);}

Expand Down Expand Up @@ -495,16 +492,14 @@ register int prlevel;
prin1(ctx,ccar(rest),f,prlevel-1);
return;}
writech(f,'(');
prin1(ctx,fobj,f,prlevel);
x=rest;
while (islist(x) && !s_marked(x)) {
if (!nullprlen && --prlength<=0) {
writestr(f,(byte *)" ...",4);
if (!nullprlen && prlength--<=0) {
writestr(f,(byte *)"...",3);
x=NIL; break;}
else {
writech(f,' ');
prin1(ctx,ccar(x),f,prlevel);
x=ccdr(x);} }
x=ccdr(x);
if (islist(x)) writech(f,' ');} }
if (x!=NIL) { writestr(f,(byte *)" . ",3); prin1(ctx,x,f,prlevel);}
writech(f,')'); }

Expand Down

0 comments on commit 11dcdf4

Please sign in to comment.