[BACK]Return to set_structure_io.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Product

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Product/set_structure_io.adb, Revision 1.1.1.1

1.1       maekawa     1: with Symbol_Table,Symbol_Table_io;       use Symbol_Table;
                      2: with Set_Structure;
                      3:
                      4: package body Set_Structure_io is
                      5:
                      6:   procedure get is
                      7:   begin
                      8:     Set_Structure_io.get(Standard_Input);
                      9:   end get;
                     10:
                     11:   procedure get ( file : in file_type ) is
                     12:
                     13:     ch : character;
                     14:     sb : symbol;
                     15:
                     16:   begin
                     17:     for i in 1..Set_Structure.Dimension loop
                     18:      -- Read sets for ith equation :
                     19:       for j in 1..Set_Structure.Number_of_Sets(i) loop
                     20:        -- Read the jth set of the ith equation :
                     21:        get(file,ch); while (ch = ' ') loop get(file,ch); end loop;
                     22:        if ch = '{'
                     23:         then loop
                     24:                 get(file,ch);
                     25:                while (ch = ' ') loop get(file,ch); end loop;
                     26:                exit when (ch = '}');
                     27:                 sb := (sb'range => ' ');
                     28:                 Symbol_Table_io.get(file,ch,sb,'}');
                     29:                Set_Structure.Add(i,j,Symbol_Table.Get(sb));
                     30:                exit when (ch = '}');
                     31:               end loop;
                     32:         end if;
                     33:       end loop;
                     34:     end loop;
                     35:   end get;
                     36:
                     37:   procedure put is
                     38:   begin
                     39:     Set_Structure_io.put(Standard_Output);
                     40:   end put;
                     41:
                     42:   procedure put ( file : in file_type ) is
                     43:
                     44:     n : natural := Set_Structure.Dimension;
                     45:     sb : Symbol;
                     46:
                     47:     procedure Write_set ( file : in file_type; i,j : in natural ) is
                     48:     begin
                     49:       put(file,'{');
                     50:       for k in 1..n  loop
                     51:        if Set_Structure.Is_In(i,j,k)
                     52:          then --Symbol_Table_io.put(file,Symbol_Table.Get(i));
                     53:               sb := Symbol_Table.Get(k);
                     54:               Symbol_Table_io.put(file,sb);
                     55:              put(file,' ');
                     56:        end if;
                     57:       end loop;
                     58:       put(file,'}');
                     59:     end Write_set;
                     60:
                     61:   begin
                     62:     for i in 1..n loop
                     63:       put(file,"     ");
                     64:       for j in 1..Set_Structure.Number_of_Sets(i) loop
                     65:        Write_set(file,i,j);
                     66:       end loop;
                     67:       new_line(file);
                     68:     end loop;
                     69:   end put;
                     70:
                     71: end Set_Structure_io;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>