/* methodsup.h */

/****************************************************************************
 *
 *  Copyright (C) 2000-2001 Eli-Jean R. Leyssens, aka Pervect of Topix
 *
 *  This file is part of the CodePressor package.
 *
 *  CodePressor is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  CodePressor is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with CodePressor; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 *
 *  Eli-Jean R. Leyssens can be reached via email at eli@dnd.utwente.nl
 *  snail: E-J.R. Leyssens, Schivelbeinerstr. 5, 10439 Berlin, Germany
 *
 ***************************************************************************/

#ifndef _METHODSUP_
#define _METHODSUP_

// Append 'Extend' bytes from pbPart into the buffer (lppbDepack, lpSize), reallocing the buffer if needed
bool MethodSupport_ExtendDepackCodeWithPart( byte ** lppbDepack, int * lpSize, byte * pbPart, int Extend);

// Append 'Bits' bits from 'Value' into the buffer
void MethodSupport_InsertIntoStream( bits ** lppdwStream, bits * pdwStreamCache, int * lpCacheCount, bits Value, int Bits);

// Flush pending bits to output buffer, returning byte-aligned end address
byte * MethodSupport_FlushStream( bits ** lppdwStream, bits * pdwStreamCache, int * lpCacheCount);

// Encode the 8-bit value 'Value' using the 'nice' encoding (requiring either 5 or 9 bits of output space)
void MethodSupport_InsertNiceByte( bits ** lppdwStream, bits * pdwStreamCache, int * lpCacheCount, bits Value);

#endif // _METHODSUP_
