#ifndef RMFBuffer_H
#define RMFBuffer_H

#include "sysdep.h"
#include "memory.h"

typedef struct RMFBuffer_str *RMFBuffer;

#ifdef __STDC__
extern RMFBuffer RMFBuffer_create(char *, unsigned);
extern char * RMFBuffer_get_next_chunk(RMFBuffer, int);  
extern NORET  RMFBuffer_destroy_chunk(RMFBuffer, char *);
extern NORET  RMFBuffer_destroy(RMFBuffer);
extern char * RMFBuffer_copy_of_buff(RMFBuffer);
extern NORET  RMFBuffer_append(RMFBuffer,char *);
extern NORET  RMFBuffer_append_char(RMFBuffer,int);
extern int    RMFBuffer_length_of_string(RMFBuffer);
#else
extern RMFBuffer RMFBuffer_create();
extern char * RMFBuffer_get_next_chunk();
extern NORET  RMFBuffer_destroy_chunk();
extern NORET  RMFBuffer_destroy();
extern char * RMFBuffer_copy_of_buff();
extern NORET  RMFBuffer_append();
extern NORET  RMFBuffer_append_char();
extern int    RMFBuffer_length_of_string();
#endif

#endif

/***************************************************
  The create function takes a null terminated string and a Chunks
  number which is the amount of memory to allocate when the buffer
  runs out of space.  The buffer is copied.  Each chunck you
  get via get_next_chunk is copied and must be destroyed with the
  appropriate function.  Thew chunks are NOT terminated with the character
  you were chunking to if the chunking character was
  found but theey will be storred in buffers long enough for you to manually
  the terminating NULL with the chunking character and then a NULL.  If the
  EOF  was reached beforehand then all that was encountered up to
  the EOF is returned  

  A Chunk can be gotton by either copy_of_buffer or get next chunk and
  should be destroyed with destroy_chunk.
*/
