Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/floating_integer_convertors.adb, Revision 1.1
1.1 ! maekawa 1: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
! 2:
! 3: package body Floating_Integer_Convertors is
! 4:
! 5: function Convert ( v : Standard_Integer_Vectors.Vector )
! 6: return Standard_Floating_Vectors.Vector is
! 7:
! 8: res : Standard_Floating_Vectors.Vector(v'range);
! 9:
! 10: begin
! 11: for i in res'range loop
! 12: res(i) := double_float(v(i));
! 13: end loop;
! 14: return res;
! 15: end Convert;
! 16:
! 17: function Convert ( v : Standard_Floating_Vectors.Vector )
! 18: return Standard_Integer_Vectors.Vector is
! 19:
! 20: res : Standard_Integer_Vectors.Vector(v'range);
! 21:
! 22: begin
! 23: for i in res'range loop
! 24: res(i) := integer(v(i));
! 25: end loop;
! 26: return res;
! 27: end Convert;
! 28:
! 29: function Convert ( l : Lists_of_Integer_Vectors.List )
! 30: return Lists_of_Floating_Vectors.List is
! 31:
! 32: res,res_last : Lists_of_Floating_Vectors.List;
! 33: tmp : Lists_of_Integer_Vectors.List := l;
! 34:
! 35: use Lists_of_Integer_Vectors;
! 36:
! 37: begin
! 38: while not Is_Null(tmp) loop
! 39: Lists_of_Floating_Vectors.Append(res,res_last,Convert(Head_Of(tmp).all));
! 40: tmp := Tail_Of(tmp);
! 41: end loop;
! 42: return res;
! 43: end Convert;
! 44:
! 45: function Convert ( l : Lists_of_Floating_Vectors.List )
! 46: return Lists_of_Integer_Vectors.List is
! 47:
! 48: res,res_last : Lists_of_Integer_Vectors.List;
! 49: tmp : Lists_of_Floating_Vectors.List := l;
! 50:
! 51: use Lists_of_Floating_Vectors;
! 52:
! 53: begin
! 54: while not Is_Null(tmp) loop
! 55: Lists_of_Integer_Vectors.Append(res,res_last,Convert(Head_Of(tmp).all));
! 56: tmp := Tail_Of(tmp);
! 57: end loop;
! 58: return res;
! 59: end Convert;
! 60:
! 61: function Convert ( l : Arrays_of_Integer_Vector_Lists.Array_of_Lists )
! 62: return Arrays_of_Floating_Vector_Lists.Array_of_Lists is
! 63:
! 64: res : Arrays_of_Floating_Vector_Lists.Array_of_Lists(l'range);
! 65:
! 66: begin
! 67: for i in l'range loop
! 68: res(i) := Convert(l(i));
! 69: end loop;
! 70: return res;
! 71: end Convert;
! 72:
! 73: function Convert ( l : Arrays_of_Floating_Vector_Lists.Array_of_Lists )
! 74: return Arrays_of_Integer_Vector_Lists.Array_of_Lists is
! 75:
! 76: res : Arrays_of_Integer_Vector_Lists.Array_of_Lists(l'range);
! 77:
! 78: begin
! 79: for i in l'range loop
! 80: res(i) := Convert(l(i));
! 81: end loop;
! 82: return res;
! 83: end Convert;
! 84:
! 85: function Convert ( m : Integer_Mixed_Subdivisions.Mixed_Cell )
! 86: return Floating_Mixed_Subdivisions.Mixed_Cell is
! 87:
! 88: res : Floating_Mixed_Subdivisions.Mixed_Cell;
! 89: use Integer_Mixed_Subdivisions;
! 90:
! 91: begin
! 92: res.nor := new Standard_Floating_Vectors.Vector'(Convert(m.nor.all));
! 93: res.pts :=
! 94: new Arrays_of_Floating_Vector_Lists.Array_of_Lists'(Convert(m.pts.all));
! 95: if m.sub = null
! 96: then res.sub := null;
! 97: else res.sub :=
! 98: new Floating_Mixed_Subdivisions.Mixed_Subdivision'(Convert(m.sub.all));
! 99: end if;
! 100: return res;
! 101: end Convert;
! 102:
! 103: function Convert ( m : Floating_Mixed_Subdivisions.Mixed_Cell )
! 104: return Integer_Mixed_Subdivisions.Mixed_Cell is
! 105:
! 106: res : Integer_Mixed_Subdivisions.Mixed_Cell;
! 107: use Floating_Mixed_Subdivisions;
! 108:
! 109: begin
! 110: res.nor := new Standard_Integer_Vectors.Vector'(Convert(m.nor.all));
! 111: res.pts :=
! 112: new Arrays_of_Integer_Vector_Lists.Array_of_Lists'(Convert(m.pts.all));
! 113: if m.sub = null
! 114: then res.sub := null;
! 115: else res.sub :=
! 116: new Integer_Mixed_Subdivisions.Mixed_Subdivision'(Convert(m.sub.all));
! 117: end if;
! 118: return res;
! 119: end Convert;
! 120:
! 121: function Convert ( s : Integer_Mixed_Subdivisions.Mixed_Subdivision )
! 122: return Floating_Mixed_Subdivisions.Mixed_Subdivision is
! 123:
! 124: res,res_last : Floating_Mixed_Subdivisions.Mixed_Subdivision;
! 125: tmp : Integer_Mixed_Subdivisions.Mixed_Subdivision := s;
! 126:
! 127: use Integer_Mixed_Subdivisions;
! 128:
! 129: begin
! 130: while not Is_Null(tmp) loop
! 131: Floating_Mixed_Subdivisions.Append(res,res_last,Convert(Head_Of(tmp)));
! 132: tmp := Tail_Of(tmp);
! 133: end loop;
! 134: return res;
! 135: end Convert;
! 136:
! 137: function Convert ( s : Floating_Mixed_Subdivisions.Mixed_Subdivision )
! 138: return Integer_Mixed_Subdivisions.Mixed_Subdivision is
! 139:
! 140: res,res_last : Integer_Mixed_Subdivisions.Mixed_Subdivision;
! 141: tmp : Floating_Mixed_Subdivisions.Mixed_Subdivision := s;
! 142:
! 143: use Floating_Mixed_Subdivisions;
! 144:
! 145: begin
! 146: while not Is_Null(tmp) loop
! 147: Integer_Mixed_Subdivisions.Append(res,res_last,Convert(Head_Of(tmp)));
! 148: tmp := Tail_Of(tmp);
! 149: end loop;
! 150: return res;
! 151: end Convert;
! 152:
! 153: end Floating_Integer_Convertors;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>