/*
 * testclass - a stupidly simple progam to test the skeleton class
 *
 * Public Domain.
 *
 * Christian E. Hopps.
 *
 */

#include <skeleton.h>
#include <proto/exec.h>
#include <proto/utility.h>
#include <proto/intuition.h>

struct Library *IntuitionBase = NULL;
struct Library *UtilityBase = NULL;

void main(int argc, char **argv);

void main(int argc, char **argv)
{
	Class *SkeletonClass;
	Object *skel_obj;

	if(!( IntuitionBase = OpenLibrary("intuition.library",36) )) {
		return;
	} else if(!( UtilityBase = OpenLibrary("utility.library",36) )) {
		CloseLibrary(IntuitionBase);
		return;
	} else if(!( SkeletonClass = Skeleton_init() )) {
		CloseLibrary(IntuitionBase);
		CloseLibrary(UtilityBase);
		return;
	}
	/*
	 * Everything opened ok, try and get an object.
	 */

	if( skel_obj = NewObject(SkeletonClass,NULL,TAG_DONE) ) {
		/*
		 * Got it, now dispose of it.
		 */
		Write(Output(),"skeleton class loaded, removing.\n",33);
		DisposeObject(skel_obj);
	} else {
		/*
		 * Failed do a display beep.
		 */
		DisplayBeep(NULL);
	}

	Skeleton_free(SkeletonClass);
	CloseLibrary(UtilityBase);
	CloseLibrary(IntuitionBase);

	return;
}