class ListOfPtrs
================
  '
  sys bu 'buffer pointer
  int bl 'length of buffer
  int ni 'number of elements in list
  '
  method constructor()
  ====================
  end method
  '
  method destructor()
  ===================
  freememory bu
  bl=0 : ni=0
  end method
  '
  method append(sys p)
  ====================
  int bi=ni*sizeof sys
  ni++
  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
  end method
  '
  method ptr(int i) as sys
  ========================
  i-- 'base 0
  if i<ni then
    sys q at bu+i*sizeof sys
    return q
  end if
  end method
  '
end class
'
'TESTS
======
string s={"one","two","three"}
new ListOfPtrs st()
int i
for i=1 to 3
  st.append strptr s[i]
next
bstring t
for i=1 to 4
  strptr t=st.ptr(i)
  print t
next
del st
