/****h* Beast/BFS_ToUpperClass.c [1.0] ********
*
*	NAME
*	  BFS_ToUpperClass --
*
*	COPYRIGHT
*	  Maverick Software Development
*
*	AUTHOR
*	  Jacco van Weert
*
*	CREATION DATE
*	  3-Sep-96
*
*	MODIFICATION HISTORY
*
******************************************
*/

#include <BEAST:Include/proto/beast.h>
#include <proto/exec.h>
#include <utility/tagitem.h>

/**************************
 **** structure definitions
 ****/
#define BFS_ToUpperCLASS_NAME "BFS_ToUpperClass" 

/***************************
 **** The instance structure
 ****/
struct BFS_ToUpperInstance
{
#include "BFS_ToUpperClass.instance"
};

extern struct Library *BeastBase, *SysBase;
extern char  	       idString[], ClassName[];

#ifdef __SAS__
ULONG __asm Init_Class(void);
ULONG __asm Exit_Class(void);
#else
ULONG Init_Class(void);
ULONG Exit_Class(void);
#endif

	/**** These methods are defined as example... they are not needed ****/
rfcall (mth_ContentsInput,  BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList);

	/**** The name of the library ****/
char idString[]  = "BFS_ToUpperClass  ("__DATE__")\n\r\0";
	/**** The name of the class as defined in my_class.h ****/
char ClassName[] = BFS_ToUpperCLASS_NAME ;

struct BST_Class *BFS_ToUpperClass;

 long *enforce = 0x0000000;


/****** BFS_ToUpperClass/Init_Class [1.0]
*
*	NAME
*	  Init_Class
*
**********************************
*/
#ifdef __SAS__
ULONG __asm Init_Class(void)
#else
ULONG Init_Class(void)
#endif
{
  /*******************************************************************
   **** Define class.... use BST_MakeSubClass if there is a superclass
   ****/
  if (BFS_ToUpperClass = BST_MakeSubClass( ClassName, sizeof(struct BFS_ToUpperInstance ), "BST_BaseClass" ))
    {
      CLSS_AddMethod( BFS_ToUpperClass, (ULONG *)&mth_ContentsInput,  OBM_CONTENTSINPUT  );
      BST_AddClass(   BFS_ToUpperClass );
    }

  return( 0 );
}

/****** BFS_ToUpperClass/Exit_Class [1.0]
*
*	NAME
*	  Exit_Class
*
***********************************
*/
#ifdef __SAS__
ULONG __asm Exit_Class(void)
#else
ULONG Exit_Class(void)
#endif
{
  BST_RemoveClass( BFS_ToUpperClass );
  BST_FreeClass(   BFS_ToUpperClass );
  return( 0 );
}


/****** BFS_ToUpperClass/mth_ContentsInput [1.0]
*
*	NAME
*	  mth_ContentsInput
*
**************************************************
*/
rfcall (mth_ContentsInput, BST_MethodFlags MethodFlags, struct BST_Object *Object, struct TagItem *TagList)
{

  struct TagItem *cur_ti;
  
  if (cur_ti = BST_FindTagItem( BTA_MemBlock, TagList ))
    {
      char *buffer = (char *)cur_ti->ti_Data;
      if (cur_ti = BST_FindTagItem( BTA_MemSize, TagList ))
        {
          ULONG size = cur_ti->ti_Data;
          
          long counter;
          char kar;
          for( counter = 0; counter < size; counter++ )
            {
              kar = buffer[counter];
              if ((kar>='a') && (kar<='z')) kar += 'A'-'a';
              buffer[counter] = kar;
            }
        }
    }

  OBJ_ToOutput( Object, TagList, OBM_CONTENTSOUTPUT, 0 );

  return MethodFlags;
}

