class QueueOfPtrs
=================
  '
  sys bu 'buffer pointer
  int bl 'length of buffer
  int bi 'input position in buffer
  int bo 'output position in buffer
  '
  method constructor()
  ====================
  end method
  '
  method destructor()
  ===================
  freememory bu
  bi=0 : bo=0 : bl=0
  end method
  '
  method in(sys p)
  ==================
  int i=bi+sizeof sys
  if i>bl then 'stretch buffer
    sys bp=bu
    int bq=bl
    bl=bl+256
    bu=getmemory bl
    if bp then copy bu,bp,bq : freememory bp
  end if
  sys q at bu+bi
  q=p
  bi=i  
  end method
  '
  method out() as sys
  ===================
  if bo<bi then
    sys q at bu+bo
    bo+=sizeof sys
    if bo=bi then
      bi=0 : bo=0 'clear queue
    end if
    return q
  end if
  end method
  '
end class
'
'TESTS
======
string s={"one","two","three"}
new QueueOfPtrs st()
int i
for i=1 to 3
  st.in strptr s[i]
next
bstring t
for i=1 to 4
  strptr t=st.out
  print t
next
del st
