{program wiev_a_translated_fileascii_to_vector;  visiona un file asici tradotto
                                              in file di array 80x24}
program help{(nameout:str12);};


const
      stlen=25;
      const n_tab=20;
      int_len=12;
      r_u=6; r_d=4;
      n_campi=0;
      m_line=25;

TYPE
        strc=string[stlen];
        str8=string[8];
        str10=string[10];
        str12=string[12];
        str20=string[20];
        str25=string[25];
        str30=string[30];
        str50=string[50];
        str80=string[80];
        str160=string[160];
        str320=string[240];

        vet_scr=array[0..n_campi]of str20;

        boo=boolean;

      pagev=array[1..80,1..24] of char;

var aiuto:text;
    fileout:file of pagev;
    key,key2,tasto:char;
    video1,video2,video3:pagev;
    tommorow,code,i:integer;
    testo,testo2:str80;
    yesterday,nop:real;
    finish:boolean;

    ris:char;


    tab                       :array[1..n_tab] of strc;
    editor                    :file;
    data,articolo             :strc;
    tastog                    :char;
    ok,secret,level3,level4   :boo;
    debug                     :boo;

{$i tool}

procedure azzera(var video:pagev);
var x,y:integer;
begin
  for y:=1 to 24 do
    for x:=1 to 80 do
      video[x,y]:=' ';
end;



procedure display_page(video:pagev);
var x,y:integer;
begin
  clrscr;
  for y:=1 to 24 do
    for x:=1 to 80 do
      writexy(x,y,video[x,y]);
end;

begin
  debug:=false;
  menu(1,'VIEWLATE 1.0 - PROGRAMMA DI VISIONE FILES DI ARRAY 80X24');
      ris:='s';
      repeat
        nameout:='help.pag';
        get_name(10,12,'Nome del file vedere?',nameout);
        if not(esiste(nameout)) then
          begin
            message(' Non esiste archivio con questo nome',1,1);
            ris:='n';
          end
        else
          begin
            assign(fileout,nameout);
            reset(fileout);
          end;
      until  upcase(ris)='S';
  nop:=0;
  yesterday:=0;
  finish:=false;
  azzera(video1);
  i:=filesize(fileout)+1;
  tommorow:=1;
  if eof(fileout) then
    begin
      mid('archivio vuoto');
      stand_by;
    end
  else
    while (tommorow<>0) do
      begin
      if eof(fileout) then
          tommorow:=1;
      seek(fileout,tommorow-1);
      read(fileout,video1);
      display_page(video1);
      if debug then
        writexy(1,2,'Pag: '+sts(filepos(fileout))+'   ');
      tommorow:=tommorow+1;
      repeat
        get_int2(1,25,3,'Inserire: 0 per uscire, enter o numero pagina per continuare. Pag:',tommorow);
      until (tommorow>=0) and (tommorow<=i);
    end;
  close(fileout);
  mid('bye');
end;
