Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Polynomials/multprec_complex_polynomials_io.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with Standard_Natural_Vectors; use Standard_Natural_Vectors;
3: with Standard_Complex_Polynomials_io;
4: with Symbol_Table,Symbol_Table_io; use Symbol_Table;
5: with Multprec_Floating_Numbers; use Multprec_Floating_Numbers;
6: with Multprec_Floating_Numbers_io; use Multprec_Floating_Numbers_io;
7: with Multprec_Complex_Numbers; use Multprec_Complex_Numbers;
8: with Multprec_Complex_Numbers_io; use Multprec_Complex_Numbers_io;
9:
10: package body Multprec_Complex_Polynomials_io is
11:
12: -- THE INPUT OPERATIONS :
13:
14: procedure get ( n : in out natural; p : in out Poly ) is
15: begin
16: null;
17: end get;
18:
19: procedure get ( file : in file_type; n : in out natural; p : in out Poly ) is
20: begin
21: null;
22: end get;
23:
24: procedure get ( p : in out Poly ) is
25: begin
26: null;
27: end get;
28:
29: procedure get ( file : in file_type; p : in out Poly ) is
30: begin
31: null;
32: end get;
33:
34: -- THE OUTPUT OPERATIONS FOR TERMS :
35:
36: procedure Write ( file : in file_type; c : in Complex_Number ) is
37:
38: cre : Floating_Number := REAL_PART(c);
39: cim : Floating_Number := IMAG_PART(c);
40:
41: begin
42: if Equal(cim,0.0)
43: then if cre > 0.0
44: then put(file,"+");
45: end if;
46: put(file,cre);
47: elsif Equal(cre,0.0)
48: then if cim > 0.0
49: then put(file,"+");
50: end if;
51: put(file,cim);
52: put(file,"*i");
53: else put(file,"+(");
54: put(file,cre);
55: if cim > 0.0
56: then put(file,"+");
57: end if;
58: put(file,cim);
59: put(file,"*i)");
60: end if;
61: end Write;
62:
63: procedure Write ( file : in file_type; d : in Degrees; pow : in Power ) is
64:
65: sb : Symbol;
66:
67: begin
68: for i in d'range loop
69: if d(i) /= 0
70: then put(file,"*");
71: sb := Symbol_Table.get(i);
72: Symbol_Table_io.put(file,sb);
73: if d(i) /= 1
74: then if pow = '^'
75: then put(file,"^");
76: else put(file,"**");
77: end if;
78: put(d(i),1);
79: end if;
80: end if;
81: end loop;
82: end Write;
83:
84: procedure put ( file : in file_type; t : in Term; pow : in Power ) is
85: begin
86: Write(file,t.cf);
87: if Sum(t.dg) /= 0
88: then Write(file,t.dg,pow);
89: end if;
90: end put;
91:
92: -- THE OUTPUT OPERATIONS :
93:
94: procedure put ( p : in Poly; pow : in Power ) is
95: begin
96: put(Standard_Output,p,pow);
97: end put;
98:
99: procedure put ( file : in file_type; p : in Poly; pow : in Power ) is
100:
101: procedure Write_Term ( t : in Term; continue : out boolean ) is
102: begin
103: put(file,t,pow);
104: continue := true;
105: end Write_Term;
106: procedure Write_Terms is new Visiting_Iterator(Write_Term);
107:
108: begin
109: Write_Terms(p);
110: end put;
111:
112: procedure put ( n : in natural; p : in Poly; pow : in Power ) is
113: begin
114: put(Standard_Output,n,p,pow);
115: end put;
116:
117: procedure put ( file : in file_type;
118: n : in natural; p : in Poly; pow : in Power ) is
119: begin
120: put(file,n); new_line(file);
121: put(file,p,pow);
122: end put;
123:
124: procedure put ( p : in Poly ) is
125: begin
126: put(Standard_Output,p);
127: end put;
128:
129: procedure put ( file : in file_type; p : in Poly ) is
130: begin
131: put(file,p,'*');
132: end put;
133:
134: procedure put_line ( p : in Poly ) is
135: begin
136: put_line(Standard_Output,p);
137: end put_line;
138:
139: procedure put_line ( file : in file_type; p : in Poly ) is
140: begin
141: put_line(file,p,'*');
142: end put_line;
143:
144: procedure put_line ( p : in Poly; pow : in Power ) is
145: begin
146: put_line(Standard_Output,p,pow);
147: end put_line;
148:
149: procedure put_line ( file : in file_type; p : in Poly; pow : in Power ) is
150:
151: procedure Write_Term ( t : in Term; continue : out boolean ) is
152: begin
153: put(file,t,pow);
154: new_line(file);
155: continue := true;
156: end Write_Term;
157: procedure Write_Terms is new Visiting_Iterator(Write_Term);
158:
159: begin
160: Write_Terms(p);
161: end put_line;
162:
163: procedure Display_Format is
164: begin
165: Standard_Complex_Polynomials_io.Display_Format;
166: end Display_Format;
167:
168: end Multprec_Complex_Polynomials_io;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>