program ra_q;
{$APPTYPE CONSOLE}

uses
  Windows,
  LibV in '..\..\pascal\libv.pas',
  BQueue in '..\..\pascal\bqueue.pas';

type
	PSimpleBlock = ^TSimpleBlock;
	TSimpleBlock = record
    	i : integer;
        x : vec_t;
    end;

procedure	Dump(var Block:TSimpleBlock);
begin
	writeln('i=',Block.i,#9,'x=',Block.x);
end;

var
	Block	: TSimpleBlock;
	Fifo	: TBlockQueue;
	i 		: integer;
    
begin
	Fifo.Create(sizeof(TSimpleBlock));
	Fifo.SetMaxSize(4);
	for i:=0 to 3 do
    begin
    	Block.i:=i;
    	Block.x:=i/2;
    	writeln(Fifo.Push(Block));
    end;

	for i:=0 to 3 do
    begin
    	Fifo.GetBlock(Block,i);
    	Dump(Block);
    end;

   	for i:=10 to 11 do
    begin
    	Block.i:=i;
    	Block.x:=i/2;
    	writeln(Fifo.Push(Block));
    end;

	for i:=0 to 3 do
    begin
    	Fifo.GetBlock(Block,i);
    	Dump(Block);
    end;

	for i:=0 to 3 do
    begin
    	Block.i:=100+i;
    	Block.x:=1;
    	Fifo.SetBlock(Block,i);
    end;

	writeln;
    while Fifo.Pop(Block) do
    	Dump(Block);

	readln;
end.
