class Buffer
============
  '
  bstring prbuf
  int prpos, int prblen, prslen
  '
  method in(string s)
  ===================
  prslen=len(s)
  if prpos+prslen>prblen then
    prbuf+=nuls 0x4000 + prslen*2 : prblen=len(prbuf)
  end if
  mid prbuf,prpos+1,s
  prpos+=prslen
  end method
  '
  method empty()
  ==============
  prblen=0 : prpos=0 : del prbuf
  end method
  '
  method out() as string
  ======================
  method=left prbuf,prpos
  empty()
  end method
  '
  end class

'TESTS
======
buffer b
b.in "hello "
b.in "World!"
print b.out 'Hello World!
print b.out '(empty)

