Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Symmetry/symbolic_symmetry_group_io.adb, Revision 1.1
1.1 ! maekawa 1: with integer_io; use integer_io;
! 2: with Communications_with_User; use Communications_with_User;
! 3: with Symbol_Table,Symbol_Table_io; use Symbol_Table;
! 4:
! 5: package body Symbolic_Symmetry_Group_io is
! 6:
! 7: procedure iget ( p : in out Permutation ) is
! 8:
! 9: -- DESCRIPTION ;
! 10: -- Auxiliary procedure to realize an interactive get.
! 11:
! 12: ok : boolean := false;
! 13: pp : Permutation(p'range) := (p'range => 0);
! 14: ans : character;
! 15:
! 16: begin
! 17: while not ok loop
! 18: get(Standard_Input,pp);
! 19: ok := Is_Permutation(pp);
! 20: if not ok
! 21: then put("is no permutation. Do you want to retry ? (y/n) ");
! 22: Ask_Yes_or_No(ans);
! 23: ok := (ans /= 'y');
! 24: end if;
! 25: end loop;
! 26: p := pp;
! 27: end iget;
! 28:
! 29: procedure get ( p : in out Permutation ) is
! 30: begin
! 31: iget(p);
! 32: end get;
! 33:
! 34: procedure get ( file : in file_type; p : in out Permutation ) is
! 35:
! 36: sb : Symbol;
! 37: ch : character;
! 38:
! 39: begin
! 40: for i in p'range loop
! 41: sb := (sb'range => ' ');
! 42: get(ch);
! 43: while ch = ' ' loop get(ch); end loop;
! 44: if ch = '-'
! 45: then get(ch);
! 46: Symbol_Table_io.get(file,ch,sb);
! 47: p(i) := -Symbol_Table.get(sb);
! 48: else Symbol_Table_io.get(file,ch,sb);
! 49: p(i) := Symbol_Table.get(sb);
! 50: end if;
! 51: end loop;
! 52: end get;
! 53:
! 54: procedure get ( l : in out List_of_Permutations; n,nb : in natural ) is
! 55:
! 56: p : Permutation(1..n) := (1..n => 0);
! 57: l2 : List_of_Permutations;
! 58:
! 59: begin
! 60: for i in 1..nb loop
! 61: iget(p);
! 62: Append(l,l2,p);
! 63: end loop;
! 64: end get;
! 65:
! 66: procedure get ( file : in file_type;
! 67: l : in out List_of_Permutations; n,nb : in natural ) is
! 68:
! 69: p : Permutation(1..n) := (1..n => 0);
! 70: l2 : List_of_Permutations;
! 71:
! 72: begin
! 73: for i in 1..nb loop
! 74: get(file,p);
! 75: if Is_Permutation(p)
! 76: then Append(l,l2,p);
! 77: end if;
! 78: end loop;
! 79: end get;
! 80:
! 81: procedure put ( p : in Permutation ) is
! 82: begin
! 83: put(Standard_Output,p);
! 84: end put;
! 85:
! 86: procedure put ( file : in file_type; p : in Permutation ) is
! 87:
! 88: sb : Symbol;
! 89:
! 90: begin
! 91: for i in p'range loop
! 92: put(file,' ');
! 93: if p(i) < 0
! 94: then put(file,'-');
! 95: sb := Symbol_Table.get(-p(i));
! 96: else sb := Symbol_Table.get(p(i));
! 97: end if;
! 98: Symbol_Table_io.put(file,sb);
! 99: end loop;
! 100: end put;
! 101:
! 102: procedure put ( l : in List_of_Permutations ) is
! 103: begin
! 104: put(Standard_Output,l);
! 105: end put;
! 106:
! 107: procedure put ( file : in file_type; l : in List_of_Permutations ) is
! 108:
! 109: temp : List_of_Permutations := l;
! 110:
! 111: begin
! 112: while not Is_Null(temp) loop
! 113: put(file,Permutation(Head_Of(temp).all));
! 114: new_line(file);
! 115: temp := Tail_Of(temp);
! 116: end loop;
! 117: end put;
! 118:
! 119: end Symbolic_Symmetry_Group_io;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>