#include <ncbi.h>
#include <asn.h>
#include <gishlib.h>

/*****************************************************************************
*
*   AsnReadBuf()
*   	generalized readvalue
*
*****************************************************************************/
size_t LIBCALL AsnReadBuf (AsnIoPtr aip, AsnTypePtr atp, CharPtr PNTR bufp, size_t PNTR bufmax, CharPtr (*falloc)PROTO((Nlm_VoidPtr ctx, Nlm_CharPtr bufp, size_t cpysize, size_t newsize)), VoidPtr ctx)

{
	if (! aip->read_id)
		AsnIoErrorMsg(aip, 103, aip->linenumber);
	aip->read_id = FALSE;
	
	if (aip->type & ASNIO_TEXT)
		return AsnTxtReadBuf(aip, atp, bufp, bufmax, falloc, ctx);
	else if (aip->type & ASNIO_BIN)
		return AsnBinReadBuf(aip, atp, bufp, bufmax, falloc, ctx);

	return -1;
}

