File : lin-io-vinci.adb


with Ada.Text_IO;

package body Lin.IO.Vinci is

  package Txt_Rep_IO is new Ada.Text_IO.Float_IO(Rep);

  procedure WriteVinci(Name,Comment: in String; A: in RMatPtr) is
    use Ada.Text_IO, Txt_Rep_IO;
    M:  constant Integer := A'Last(1);
    D1: constant Integer := 1+A'Last(2);
    F: File_Type;
  begin
    Put_Line("writing " & Name);
    Create(F,Out_File,Name);
    Put_Line(F,Comment);
    Put_Line(F,"H-representation");
    Put_Line(F,"begin");
    Put_Line(F,M'Img & " " & D1'Img & " real");

    for I in A'Range(1) loop
      for J in A'Range(2) loop
        Put(F,A(I,J),2,16,4);
        Put(F," ");
      end loop;
      New_Line(F);
    end loop;

    Put_Line(F,"end");
    Close(F);
  end WriteVinci;

  procedure WriteVinci(Name: in String; A: in RMatPtr) is
  begin
    WriteVinci(Name,"",A);
  end WriteVinci;

end Lin.IO.Vinci;