File: [local] / OpenXM_contrib / PHC / Ada / Schubert / localization_posets_io.adb (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:33 2000 UTC (23 years, 8 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD Changes since 1.1: +0 -0
lines
Import the second public release of PHCpack.
OKed by Jan Verschelde.
|
with integer_io; use integer_io;
with Brackets_io; use Brackets_io;
with Standard_Natural_Vectors; use Standard_Natural_Vectors;
with Standard_Natural_Vectors_io; use Standard_Natural_Vectors_io;
package body Localization_Posets_io is
procedure put ( top,bottom : in Bracket; roco : in natural ) is
begin
put(Standard_Output,top,bottom,roco);
end put;
procedure put ( file : in file_type;
top,bottom : in Bracket; roco : in natural ) is
begin
put(file,"("); put(file,top);
put(file,","); put(file,bottom); put(file,","); put(file,roco,1);
put(file,")");
end put;
procedure put ( file : in file_type;
top,bottom : in Bracket; roco,label : in natural;
child_labels : in Link_to_Vector ) is
begin
put(file,"("); put(file,label,1); put(file,",");
put(file,top); put(file,",");
put(file,bottom); put(file,","); put(file,roco,1);
put(file,",{");
if child_labels /= null
then put(file,child_labels.all);
end if;
put(file,"}");
put(file,")");
end put;
procedure put ( root : in Node; lvl : in natural ) is
begin
put(Standard_Output,root,lvl);
end put;
procedure put ( file : in file_type; root : in Node; lvl : in natural ) is
lroot : Link_to_Node := new Node'(root);
lvlnd : Link_to_Node := Find_Node(lroot,lvl);
procedure Write_Node ( nd : in Node; continue : out boolean ) is
begin
put(file,nd.top,nd.bottom,nd.roco);
continue := true;
end Write_Node;
procedure Write_Siblings is new Enumerate_Siblings(Write_Node);
begin
if lvlnd /= null
then Write_Siblings(lvlnd.all);
end if;
end put;
procedure put ( poset : in Node ) is
begin
put(Standard_Output,poset);
end put;
procedure put ( file : in file_type; poset : in Node ) is
np : natural;
begin
if poset.level < 10
then np := 1;
else np := 2;
end if;
for i in 0..poset.level loop
put(file,"n = "); put(file,i,np); put(file," : ");
put(file,poset,i); new_line(file);
end loop;
end put;
procedure put ( poset : in Array_of_Nodes ) is
begin
put(Standard_Output,poset);
end put;
procedure put ( file : in file_type; poset : in Array_of_Nodes ) is
np : natural;
procedure Write_Node ( nd : in Node; continue : out boolean ) is
begin
put(file,nd.top,nd.bottom,nd.roco);
continue := true;
end Write_Node;
procedure Write_Siblings is new Enumerate_Siblings(Write_Node);
begin
if poset'last < 10
then np := 1;
else np := 2;
end if;
for i in poset'range loop
put(file,"n = "); put(file,i,np); put(file," : ");
-- put(file,"l = "); put(file,Number_of_Siblings(poset(i)),np);
-- put(file," : ");
if poset(i) /= null
then Write_Siblings(poset(i).all);
end if;
new_line(file);
end loop;
end put;
procedure put ( poset : in Array_of_Array_of_Nodes ) is
begin
put(Standard_Output,poset);
end put;
procedure put ( file : in file_type; poset : in Array_of_Array_of_Nodes ) is
np : natural;
lnd : Link_to_Node;
begin
if poset'last < 10
then np := 1;
else np := 2;
end if;
for i in poset'range loop
put(file,"n = "); put(file,i,np); put(file," : ");
if poset(i) /= null
then for j in poset(i)'range loop
lnd := poset(i)(j);
put(file,lnd.top,lnd.bottom,lnd.roco,lnd.label,lnd.child_labels);
end loop;
end if;
new_line(file);
end loop;
end put;
procedure put_roco ( poset : in Array_of_Array_of_Nodes ) is
begin
put_roco(Standard_Output,poset);
end put_roco;
procedure put_roco
( file : in file_type; poset : in Array_of_Array_of_Nodes ) is
np : natural;
lnd : Link_to_Node;
begin
if poset'last < 10
then np := 1;
else np := 2;
end if;
for i in poset'range loop
put(file,"n = "); put(file,i,np); put(file," : ");
if poset(i) /= null
then for j in poset(i)'range loop
lnd := poset(i)(j);
if lnd = null
then put(file," 0");
else put(file," "); put(file,lnd.roco,1);
end if;
end loop;
end if;
new_line(file);
end loop;
end put_roco;
end Localization_Posets_io;