/* instype.library C application

	Set your editor's TAB width to 3

	cc +p InsTypeTest.c
	as -cd CInterface.asm
	ln InsTypeTest.o InsTypeInterface.o -lcl32

	This program can only be run from the CLI. It gets the user's selection of
SAMP InstrumentType via the instype.library, and then converts the byte back
into a string to print to the CLI
*/

#include "functions.h"	  /* Manx C declarations */

#include "exec/tasks.h"
#include "exec/types.h"


/*-------------------------------defines---------------------------------*/

struct InsTypeBase	*InsTypeBase=0L;


/*----------------------------start of main()----------------------------*/

main( argc, argv )
LONG argc;
UBYTE *argv[];
{
	LONG	err;

 /* Open the instype lib */
	if( !(InsTypeBase=(struct InsTypeBase *)OpenLibrary("instype.library", 0L)) )
	{
		printf("Need the dissidents instype.library on boot disk\n");
		exit();
	}

	err = (LONG)GetInsType(0L);  /* Open it on WB screen because of zero. Normally,
									you would pass the ptr to your application's screen */

 /* Check for errors (negative numbers). Otherwise, a legit InstrumentType */
	if( err < 0 )
	{
		puts("Error in obtaining InstrumentType");
	}
	else
	{
		/* Get a string that describes that InstrumentType */
		puts( (UBYTE *)GetInsString(err) );
	}

	printf("\n");

	CloseLibrary( InsTypeBase );
	exit( FALSE );

}
