DIPSWL(A,V,n)
[Distributive polynomial special write, linear. If n=1,then
A is a distributive rational polynomial, and if n=0 A is a
distributive integral polynomial. V is a variable list for A.
A is written in the output stream in a format readable by
ipsr and rpsr (i.e. by diipsr and dirpsr).
Modification 10/28/85 - There are now no
preceding or terminating emptobs, i.e. DIPSWL
acts like standard SAC-2 write routines, simply inserting
a stream of characters into the output buffer. In order for
this to mesh well with diipsr and dirpsr, it is desirable
that OSIZE = ISIZE; then e.g. very long coefficients will
split across lines in such a way that they are readable.]
safe W[10].
safe r,i,s,j,b,z.
(1) [A=0.] if A==0 then
{ AWRITE(0); return }.
(2) [A constant.] if V==() then { if n==1 then
RNWRIT(FIRST(A)) else IWRITE(FIRST(A));
return }.
(3) [Initialize for nonconstant polynomial.] r=LENGTH(V);
V'=V; for i=1,...,r do ADV(V';W[i],V');
A'=A; b=1; U=RNINT(1).
(4) [Write next term.]
if A'==() then go to 5;
ADV2(A';c,d,A');
if n==1 then { s=RNSIGN(c); c=RNABS(c) }
else { s=ISIGNF(c); c=IABSF(c) };
if s<0 then CWRITE('-') else if b==0
then CWRITE('+'); CWRITE(' '); b=0;
if n==1&RNCOMP(c,U)~=0 then
{ RNWRIT(c); CWRITE(' ') }
else if n==0&c~=1 then { IWRITE(c); CWRITE(' ') };
z=1; d=CINV(d);
while d~=() do { z=0; ADV2(d;e,j,d); CLOUT(W[j]);
if e>1 then { CLOUT("**"); AWRITE(e) }; CWRITE(' ') };
if z==1&((n==1&RNCOMP(c,U)==0)
|(n==0&c==1)) then
{ AWRITE(1); CWRITE(' ') }; go to 4.
(5) [Finish.] return..