Annotation of OpenXM_contrib/PHC/Ada/Schubert/localization_posets_io.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with Brackets_io; use Brackets_io;
3: with Standard_Natural_Vectors; use Standard_Natural_Vectors;
4: with Standard_Natural_Vectors_io; use Standard_Natural_Vectors_io;
5:
6: package body Localization_Posets_io is
7:
8: procedure put ( top,bottom : in Bracket; roco : in natural ) is
9: begin
10: put(Standard_Output,top,bottom,roco);
11: end put;
12:
13: procedure put ( file : in file_type;
14: top,bottom : in Bracket; roco : in natural ) is
15: begin
16: put(file,"("); put(file,top);
17: put(file,","); put(file,bottom); put(file,","); put(file,roco,1);
18: put(file,")");
19: end put;
20:
21: procedure put ( file : in file_type;
22: top,bottom : in Bracket; roco,label : in natural;
23: child_labels : in Link_to_Vector ) is
24: begin
25: put(file,"("); put(file,label,1); put(file,",");
26: put(file,top); put(file,",");
27: put(file,bottom); put(file,","); put(file,roco,1);
28: put(file,",{");
29: if child_labels /= null
30: then put(file,child_labels.all);
31: end if;
32: put(file,"}");
33: put(file,")");
34: end put;
35:
36: procedure put ( root : in Node; lvl : in natural ) is
37: begin
38: put(Standard_Output,root,lvl);
39: end put;
40:
41: procedure put ( file : in file_type; root : in Node; lvl : in natural ) is
42:
43: lroot : Link_to_Node := new Node'(root);
44: lvlnd : Link_to_Node := Find_Node(lroot,lvl);
45:
46: procedure Write_Node ( nd : in Node; continue : out boolean ) is
47: begin
48: put(file,nd.top,nd.bottom,nd.roco);
49: continue := true;
50: end Write_Node;
51: procedure Write_Siblings is new Enumerate_Siblings(Write_Node);
52:
53: begin
54: if lvlnd /= null
55: then Write_Siblings(lvlnd.all);
56: end if;
57: end put;
58:
59: procedure put ( poset : in Node ) is
60: begin
61: put(Standard_Output,poset);
62: end put;
63:
64: procedure put ( file : in file_type; poset : in Node ) is
65:
66: np : natural;
67:
68: begin
69: if poset.level < 10
70: then np := 1;
71: else np := 2;
72: end if;
73: for i in 0..poset.level loop
74: put(file,"n = "); put(file,i,np); put(file," : ");
75: put(file,poset,i); new_line(file);
76: end loop;
77: end put;
78:
79: procedure put ( poset : in Array_of_Nodes ) is
80: begin
81: put(Standard_Output,poset);
82: end put;
83:
84: procedure put ( file : in file_type; poset : in Array_of_Nodes ) is
85:
86: np : natural;
87:
88: procedure Write_Node ( nd : in Node; continue : out boolean ) is
89: begin
90: put(file,nd.top,nd.bottom,nd.roco);
91: continue := true;
92: end Write_Node;
93: procedure Write_Siblings is new Enumerate_Siblings(Write_Node);
94:
95: begin
96: if poset'last < 10
97: then np := 1;
98: else np := 2;
99: end if;
100: for i in poset'range loop
101: put(file,"n = "); put(file,i,np); put(file," : ");
102: -- put(file,"l = "); put(file,Number_of_Siblings(poset(i)),np);
103: -- put(file," : ");
104: if poset(i) /= null
105: then Write_Siblings(poset(i).all);
106: end if;
107: new_line(file);
108: end loop;
109: end put;
110:
111: procedure put ( poset : in Array_of_Array_of_Nodes ) is
112: begin
113: put(Standard_Output,poset);
114: end put;
115:
116: procedure put ( file : in file_type; poset : in Array_of_Array_of_Nodes ) is
117:
118: np : natural;
119: lnd : Link_to_Node;
120:
121: begin
122: if poset'last < 10
123: then np := 1;
124: else np := 2;
125: end if;
126: for i in poset'range loop
127: put(file,"n = "); put(file,i,np); put(file," : ");
128: if poset(i) /= null
129: then for j in poset(i)'range loop
130: lnd := poset(i)(j);
131: put(file,lnd.top,lnd.bottom,lnd.roco,lnd.label,lnd.child_labels);
132: end loop;
133: end if;
134: new_line(file);
135: end loop;
136: end put;
137:
138: procedure put_roco ( poset : in Array_of_Array_of_Nodes ) is
139: begin
140: put_roco(Standard_Output,poset);
141: end put_roco;
142:
143: procedure put_roco
144: ( file : in file_type; poset : in Array_of_Array_of_Nodes ) is
145:
146: np : natural;
147: lnd : Link_to_Node;
148:
149: begin
150: if poset'last < 10
151: then np := 1;
152: else np := 2;
153: end if;
154: for i in poset'range loop
155: put(file,"n = "); put(file,i,np); put(file," : ");
156: if poset(i) /= null
157: then for j in poset(i)'range loop
158: lnd := poset(i)(j);
159: if lnd = null
160: then put(file," 0");
161: else put(file," "); put(file,lnd.roco,1);
162: end if;
163: end loop;
164: end if;
165: new_line(file);
166: end loop;
167: end put_roco;
168:
169: end Localization_Posets_io;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>