uses vaznik,crt;




Procedure NakresliStavBufferu(t:TRingbuf);
var a,b:byte;
begin
{GotoXY(1,1);}
for a:=0 to t.velikost-1 do
    begin
    if a=t.aktin then b:=4 else b:=7;
    TextColor(b);
    if t.pole[a]=#0 then write('.') else write(t.pole[a]);
    end;
TextColor(7);
writeln('      (',t.aktin,' : ',t.obsazeno,')');
end;


const st:pchar = 'Ahoj';
      tt:pchar = 'svete';
      uu:pchar = '12345';
      vv:pchar = 'ABCDEFGHIJKLMN';

      p:pchar = '                              '; {prostor pro data}

var ring:TRingbuf;
    a:longint;


begin
writeln;

ring.Init(10);Fillchar(ring.pole^,ring.velikost,0);
NakresliStavBufferu(ring);

ring.Vloz(st^,4);
NakresliStavBufferu(ring);

ring.Vloz(tt^,5);
NakresliStavBufferu(ring);


ring.Vloz(uu^,3);
NakresliStavBufferu(ring);

{ring.Vloz(vv^,9);
NakresliStavBufferu(ring);}


a:=ring.CtiPosl(p^);
p[a]:=#0;
writeln(p);


a:=ring.CtiBuffer(p^);
p[a]:=#0;
writeln(p);



writeln;
readln;
end.
