// LibWrapperFuncs.cpp
//
// Wrapper functions that extract parameters out of the arg table and call the
// low-level functions that perform the real work.


#include "LibWrapperFuncs.h"
#include "LibCore.h"


// Func1Wrapper.
void Func1Wrapper(void* argTable, long& ioUserData)
{
	ioUserData;
	if (argTable != NULL) {
		//=====================
		// Get arguments
		PluginLibraryArgTable* theArgTable = static_cast<PluginLibraryArgTable*>(argTable);

		theArgTable->functionResult.argType = kLongArgType;
		theArgTable->functionResult.longValue = Func1();
	}
}


// Func2Wrapper.
void Func2Wrapper(void* argTable, long& ioUserData)
{
	ioUserData;
	if (argTable != NULL) {
		//=====================
		// Get arguments
		PluginLibraryArgTable* theArgTable = static_cast<PluginLibraryArgTable*>(argTable);

		long		arg1 = theArgTable->args[0].longValue;
		char*		arg2 = (char*) theArgTable->args[1].strValue;

		theArgTable->functionResult.argType = kIntegerArgType;
		theArgTable->functionResult.intValue = Func2(arg1, arg2);
	}
}


// Func3Wrapper.
void Func3Wrapper(void* argTable, long& ioUserData)
{
	ioUserData;
	if (argTable != NULL) {
		//=====================
		// Get arguments
		PluginLibraryArgTable* theArgTable = static_cast<PluginLibraryArgTable*>(argTable);

		long		arg1 = theArgTable->args[0].longValue;
		short		arg2 = theArgTable->args[1].intValue;
		char*		arg3 = (char*) theArgTable->args[2].strValue;

		theArgTable->functionResult.argType = kBooleanArgType;
		theArgTable->functionResult.boolValue = Func3(arg1, arg2, arg3);
	}
}
