/* Automatically generated by
	VMPluginCodeGenerator VMMaker.oscog-eem.1950 uuid: b4089b49-1494-49d2-8966-57cba5c92194
   from
	EventsHandlerPlugin EventsHandlerPlugin-EstebanLorenzano.1 uuid: 1516ba00-d8f9-4928-93cf-a46ad8e46d70
 */
static char __buildInfo[] = "EventsHandlerPlugin EventsHandlerPlugin-EstebanLorenzano.1 uuid: 1516ba00-d8f9-4928-93cf-a46ad8e46d70 " __DATE__ ;



#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/* Default EXPORT macro that does nothing (see comment in sq.h): */
#define EXPORT(returnType) returnType

/* Do not include the entire sq.h file but just those parts needed. */
#include "sqConfig.h"			/* Configuration options */
#include "sqVirtualMachine.h"	/*  The virtual machine proxy definition */
#include "sqPlatformSpecific.h"	/* Platform specific definitions */

#define true 1
#define false 0
#define null 0  /* using 'null' because nil is predefined in Think C */
#ifdef SQUEAK_BUILTIN_PLUGIN
# undef EXPORT
# define EXPORT(returnType) static returnType
#endif

#include "sqMemoryAccess.h"


/*** Function Prototypes ***/
EXPORT(const char*) getModuleName(void);
EXPORT(sqInt) primitiveHasPlugin(void);
EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);


/*** Variables ***/

#if !defined(SQUEAK_BUILTIN_PLUGIN)
static sqInt (*argumentCountOf)(sqInt methodPointer);
static sqInt (*popthenPush)(sqInt nItems, sqInt oop);
static sqInt (*primitiveMethod)(void);
static sqInt (*trueObject)(void);
#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
extern sqInt argumentCountOf(sqInt methodPointer);
extern sqInt popthenPush(sqInt nItems, sqInt oop);
extern sqInt primitiveMethod(void);
extern sqInt trueObject(void);
extern
#endif
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
	"EventsHandlerPlugin EventsHandlerPlugin-EstebanLorenzano.1 (i)"
#else
	"EventsHandlerPlugin EventsHandlerPlugin-EstebanLorenzano.1 (e)"
#endif
;



/*	Note: This is hardcoded so it can be run from Squeak.
	The module name is used for validating a module *after*
	it is loaded to check if it does really contain the module
	we're thinking it contains. This is important! */

	/* InterpreterPlugin>>#getModuleName */
EXPORT(const char*)
getModuleName(void)
{
	return moduleName;
}


/*	Just answer true, letting image know we're here */

	/* EventsHandlerPlugin>>#primitiveHasPlugin */
EXPORT(sqInt)
primitiveHasPlugin(void)
{
	popthenPush(1 + (argumentCountOf(primitiveMethod())), trueObject());
	return 0;
}


/*	Note: This is coded so that it can be run in Squeak. */

	/* InterpreterPlugin>>#setInterpreter: */
EXPORT(sqInt)
setInterpreter(struct VirtualMachine*anInterpreter)
{
    sqInt ok;

	interpreterProxy = anInterpreter;
	ok = ((interpreterProxy->majorVersion()) == (VM_PROXY_MAJOR))
	 && ((interpreterProxy->minorVersion()) >= (VM_PROXY_MINOR));
	if (ok) {

#if !defined(SQUEAK_BUILTIN_PLUGIN)
		argumentCountOf = interpreterProxy->argumentCountOf;
		popthenPush = interpreterProxy->popthenPush;
		primitiveMethod = interpreterProxy->primitiveMethod;
		trueObject = interpreterProxy->trueObject;
#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */
	}
	return ok;
}


#ifdef SQUEAK_BUILTIN_PLUGIN

static char _m[] = "EventsHandlerPlugin";
void* EventsHandlerPlugin_exports[][3] = {
	{(void*)_m, "getModuleName", (void*)getModuleName},
	{(void*)_m, "primitiveHasPlugin\000\377", (void*)primitiveHasPlugin},
	{(void*)_m, "setInterpreter", (void*)setInterpreter},
	{NULL, NULL, NULL}
};

#else /* ifdef SQ_BUILTIN_PLUGIN */


#endif /* ifdef SQ_BUILTIN_PLUGIN */
