
/*
 *	Function	AllocIntuiText
 *	Programmer	N.d'Alterio
 *	Date		23/09/95
 *
 *  Synopsis:	Allocates an IntuiText structure and intialises it
 *		to a standard structure passed as an argument.
 *		The text string is filled with spaces for text 
 *		blanking purposes.
 *		The IntuiText structure may be freeded using 
 *		FreeIntuiText.
 *
 *  Arguments:	struct IntuiText *base_it	IntuiText structure to
 *						initialise new structure with.
 *
 *  Returns:	struct IntuiText *		Allocated IntuiText structure.
 *		NULL				If error.
 *
 *  Variables:	 i				Loop var.
 *		*it				IntuiText structure created.
 * 
 *  Functions:	AllocMem			Allocate memory (EXEC)
 *		FreeMem				Free memory (EXEC)
 *
 *  $Id: AllocIntuiText.c 1.1 1995/09/23 16:43:05 daltern Exp $
 *
 */

#include "SpoolWatch.h"

struct IntuiText *AllocIntuiText( struct IntuiText *base_it )

{

  register int i;

  struct IntuiText *it;

  if ( it = (struct IntuiText *)AllocMem( sizeof( struct IntuiText ), MEMF_ANY | MEMF_CLEAR ) ) {

/*
 *   Allocate memory for text string.
 */

	if ( it->IText = (char *)AllocMem( FULLINFO_LEN * sizeof( char ), MEMF_ANY | MEMF_CLEAR ) ) {

/*
 *   Intialise allocate IntuiText structure.
 */

		it->FrontPen  = base_it->FrontPen;
		it->BackPen   = base_it->BackPen;
		it->DrawMode  = base_it->DrawMode;
		it->ITextFont = base_it->ITextFont;

/*
 *   Set text string to blank.
 */

		for ( i = 0; i < (FULLINFO_LEN-1); i++ ) it->IText[i] = ' ';

	} else {

		FreeMem( it, sizeof( struct IntuiText ) );
		it = NULL;

        }   /* end if it->IText */ 

  }   /* end if it */

  return it;

}   /* end function AllocIntuiText */


/*========================================================================*
                        END FUNCTION AllocIntuiText
 *========================================================================*/
