Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Product/sets_of_unknowns_io.adb, Revision 1.1
1.1 ! maekawa 1: with integer_io; use integer_io;
! 2: with Symbol_Table,Symbol_Table_io; use Symbol_Table;
! 3:
! 4: package body Sets_of_Unknowns_io is
! 5:
! 6: procedure get ( s : in out Set ) is
! 7: begin
! 8: get(Standard_Input,s);
! 9: end get;
! 10:
! 11: procedure get ( file : in file_type; s : in out Set ) is
! 12:
! 13: ch : character;
! 14: continue : boolean;
! 15:
! 16: procedure Read_Symbol ( cont : out boolean ) is
! 17: begin
! 18: loop
! 19: get(file,ch);
! 20: exit when ch /= ' ';
! 21: end loop;
! 22: if ch = '}'
! 23: then cont := false;
! 24: else declare
! 25: sb : symbol;
! 26: nb : natural;
! 27: begin
! 28: sb := (sb'range => ' ');
! 29: Symbol_Table_io.get(file,ch,sb,'}');
! 30: nb := Symbol_Table.Get(sb);
! 31: if nb = 0
! 32: then Symbol_Table.Add(sb,nb);
! 33: end if;
! 34: Add(s,nb);
! 35: end;
! 36: cont := (ch /= '}');
! 37: end if;
! 38: end Read_Symbol;
! 39:
! 40: begin
! 41: loop
! 42: get(file,ch);
! 43: exit when ch = '{' or ch = '}';
! 44: end loop;
! 45: if ch = '{'
! 46: then loop
! 47: Read_Symbol(continue);
! 48: exit when not continue;
! 49: end loop;
! 50: end if;
! 51: end get;
! 52:
! 53: procedure put ( s : in Set ) is
! 54: begin
! 55: put(Standard_Output,s);
! 56: end put;
! 57:
! 58: procedure put ( file : in file_type; s : in Set ) is
! 59:
! 60: standard : boolean := (Symbol_Table.Number = 0);
! 61:
! 62: procedure Write_Element ( i: in natural ) is
! 63: begin
! 64: if standard
! 65: then put(file,'x'); put(file,i,2);
! 66: if i >= 10
! 67: then put(file,' ');
! 68: end if;
! 69: else Symbol_Table_io.put(file,Symbol_Table.Get(i));
! 70: put(file,' ');
! 71: end if;
! 72: end Write_Element;
! 73:
! 74: begin
! 75: text_io.put(file,"{");
! 76: for i in 1..Dimension(s) loop
! 77: if Is_In(s,i)
! 78: then Write_Element(i);
! 79: end if;
! 80: end loop;
! 81: text_io.put(file,"}");
! 82: end put;
! 83:
! 84: end Sets_of_Unknowns_io;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>