GameLevelScript::GameLevelScript( CLuaVirtualMachine& vm ) :
	GlobalScript( vm )
{
	RegisterFunction( "gameplay_log" );				// SF_GAMEPLAY_LOG
	RegisterFunction( "time_attack_add_lap" );		// SF_TIME_ATTACK_ADD_LAP
	RegisterFunction( "time_attack_finish_lap" );	// SF_TIME_ATTACK_FINISH_LAP
	RegisterFunction( "respawn_player" );			// SF_RESPAWN_PLAYER
}
Example #2
0
CHelperSystem::CHelperSystem() :
    LuaExport< CHelperSystem >("Helper")
{
    m_hHelperProcess = 0;

    RegisterFunction("GotoHelper", &CHelperSystem::Lua_GotoHelper);
    RegisterFunction("GotoPaihang", &CHelperSystem::Lua_GotoPaihang);
}
Example #3
0
CLuaBase::CLuaBase()
{
	m_pLuaState = NULL;
	m_pLuaState = lua_open();
	luaL_openlibs( m_pLuaState );
	RegisterFunction( "TRACE", _TRACE );
	RegisterFunction( "ERROR", _ERROR );
}
Example #4
0
/*************************************************************************
	Constructor
*************************************************************************/
Lua_Updater::Lua_Updater(LuaPlus::LuaState* pLuaState)
	: LuaExport< Lua_Updater >("Updater", pLuaState)
{
	//注册导出函数
	RegisterFunction("clear",  &AXP::Lua_Updater::Lua_clear);
	RegisterFunction("addPatchFile", &AXP::Lua_Updater::Lua_addPatchFile);
	RegisterFunction("updateVersion", &AXP::Lua_Updater::Lua_updateVersion);
	RegisterFunction("checkPatchCRC", &AXP::Lua_Updater::Lua_checkPatchCRC);
	RegisterFunction("encryptPatchFile", &AXP::Lua_Updater::Lua_encryptPatchFile);

	m_pUpdaterImpl = createUpdater();
}
Example #5
0
/*
	This function is called when a some script is loaded.
*/
EXPORT void ScriptLoad(HSQUIRRELVM pVM)
{
	// Register constants for this script:
	RegisterConstant(pVM, "TEST_FLOAT_CONST", 29.0f);
	RegisterConstant(pVM, "ANOTHER_CONST", "String constant");

	// Register functions for this script:
	RegisterFunction(pVM, "helloWorld", sq_helloworld, 1, "f");			// only 1 float parameter for function 'helloWorld'
	RegisterFunction(pVM, "createVehicleEx", sq_createVehicleEx);		// any template/count of paramaters for function 'createVehicleEx'
	//..., "fantasticFunction", sq_fantasticFunction, 6, "siifsb");		// template: ( string, integer, integer, float, string, bool ) - for function 'fantasticFunction'

	LogPrintf("[%s] A script got loaded!", m_szModuleName);
}
Example #6
0
SoundTest::SoundTest():
TestTemplate<SoundTest>("SoundTest"),
sndClick(0),
effectPlayTest(false)
{
	RegisterFunction(this, &SoundTest::CreateInvalidSounds, "CreateInvalidSounds", NULL);
	RegisterFunction(this, &SoundTest::CreateValidSounds, "CreateValidSounds", NULL);

	RegisterFunction(this, &SoundTest::PlayStopEffect, "PlayStopEffect", NULL);
	RegisterFunction(this, &SoundTest::PlayStopMusic, "PlayStopMusic", NULL);
    
	RegisterFunction(this, &SoundTest::PlayEffect, "PlayEffect", NULL);
}
void RegisterBuiltins() {
    RegisterFunction("ifelse", IfElseFn);
    RegisterFunction("abort", AbortFn);
    RegisterFunction("assert", AssertFn);
    RegisterFunction("concat", ConcatFn);
    RegisterFunction("is_substring", SubstringFn);
    RegisterFunction("stdout", StdoutFn);
    RegisterFunction("sleep", SleepFn);

    RegisterFunction("less_than_int", LessThanIntFn);
    RegisterFunction("greater_than_int", GreaterThanIntFn);
    RegisterFunction("pick_num", PickNumFromStringFn);
}
LuaEnvironment::LuaEnvironment()
{
	L_ = lua_open();

	// Load the default libraries
	luaL_openlibs(L_);

	// Utility functions
	RegisterFunction("c_print", Utility::l_Print);
	RegisterFunction("c_println", Utility::l_Println);

	// Run the Lua init script
	DoFile("./lua/init.lua");
}
Example #9
0
	inline_t bool Library::RegisterFunction(Visibility visibility, const String & name, FunctionCallback function)
	{
		if (name.empty())
		{
			LogWriteLine("Registered function requires a valid name");
			return false;
		}
		if (!function)
		{
			LogWriteLine("Registered function requires a valid callback");
			return false;
		}

		// Calculate the function signature
		auto signature = CreateFunctionSignature(visibility, name);
		if (!signature.IsValid())
			return false;

		// Register function in library table.  This allows the the parser to find
		// and use this function.
		RegisterFunctionSignature(signature);

		// Register the function definition with the runtime system for 
		// runtime lookups.
		auto runtime = m_runtime.lock();
		if (!runtime)
			return false;
		runtime->RegisterFunction(signature, function);

		// Return success
		return true;
	}
Example #10
0
/*
 * .KB_C_FN_DEFINITION_START
 * void InitUHP(void)
 *  Global function to initialize the UHP loopback function/test.
 * .KB_C_FN_DEFINITION_END
 */
void InitUHP(void) {

	uhptest_function.f_string = "uhp";
	uhptest_function.parse_function = uhptest_function_parse;
	uhptest_function.help_function = uhptest_function_help;
	RegisterFunction(&uhptest_function);
}
TransparentWebViewTest::TransparentWebViewTest()
:	TestTemplate<TransparentWebViewTest>("TransparentWebViewTest")
,	webView1(NULL)
,	webView2(NULL)
,	testFinished(false)
{
	RegisterFunction(this, &TransparentWebViewTest::TestFunction, Format("TransparentWebViewTest"), NULL);
}
Example #12
0
FormatsTest::FormatsTest()
: TestTemplate<FormatsTest>("FormatsTest")
{
    onScreenTime = 0.f;
    testFinished = false;
    
    RegisterFunction(this, &FormatsTest::TestFunction, "FormatsTest", NULL);
}
Example #13
0
  //------------------------------------------------------------------------------
  Evaluator::Evaluator()
  {
    RegisterFunction("min", [](eval::Evaluator* eval) {
      eval->PushValue(min(eval->PopValue(), eval->PopValue()));
    });

    RegisterFunction("max", [](eval::Evaluator* eval) {
      eval->PushValue(max(eval->PopValue(), eval->PopValue()));
    });

    RegisterFunction("sin", [](eval::Evaluator* eval) {
      eval->PushValue(sin(eval->PopValue()));
    });

    RegisterFunction("cos", [](eval::Evaluator* eval) {
      eval->PushValue(cos(eval->PopValue()));
    });
  }
Example #14
0
UIScrollViewTest::UIScrollViewTest() :
 TestTemplate<UIScrollViewTest>("UIScrollViewTest")
{
	testFinished = false;
	
	RegisterFunction(this, &UIScrollViewTest::TestFunction, Format("UIScrollViewTest"), NULL);
	
	onScreenTime = 0.f;
}
Example #15
0
ParseTextTest::ParseTextTest(Font::eFontType fontType)
:   UITestTemplate<ParseTextTest>("ParseTextTest")
,   wrapBySymbolShort(NULL)
,   wrapByWordShort(NULL)
,   wrapBySymbolLong(NULL)
,   wrapByWordLong(NULL)
,   requestedFontType(fontType)
{
    RegisterFunction(this, &ParseTextTest::ParseTestFunction, Format("ParseTextTest"), NULL);
}
void CodeCoverage::Register( FLASH_WORD* dst, const CLR_RT_MethodDef_Index& md )
{
    char   rgBuffer[ 512 ];
    LPSTR  szBuffer = rgBuffer;
    size_t iBuffer  = MAXSTRLEN(rgBuffer);

    g_CLR_RT_TypeSystem.BuildMethodName( md, szBuffer, iBuffer );

    RegisterFunction( dst, rgBuffer );
}
void RegisterRecoveryHooks() {
    RegisterFunction("mount", MountFn);
    RegisterFunction("format", FormatFn);
    RegisterFunction("ui_print", UIPrintFn);
    RegisterFunction("run_program", RunProgramFn);
    RegisterFunction("backup_rom", BackupFn);
    RegisterFunction("restore_rom", RestoreFn);
    RegisterFunction("install_zip", InstallZipFn);
}
ControlRotationTest::ControlRotationTest()
: TestTemplate<ControlRotationTest>("ControlRotationTest")
{
    angle = 0.f;
    
    for(int32 i = 0; i < 100; ++i)
    {
        RegisterFunction(this, &ControlRotationTest::TestFunction, Format("Rotation_%d", i), NULL);
    }

}
OpenGLES30FormatTest::OpenGLES30FormatTest()
    :	TestTemplate<OpenGLES30FormatTest>("OpenGLES30FormatTest")
    ,   testFinished(false)
    ,   source(NULL)
    ,   decodedSource(NULL)
    ,   encodedSource(NULL)
    ,   formatName(NULL)
    ,   currentFormatIndex(0)
{
	RegisterFunction(this, &OpenGLES30FormatTest::TestFunction, Format("OpenGLES30FormatTest test"), NULL);
}
Example #20
0
int Resource::_RegressionTest(int argc, char *argv[])
{
	int r;


	if (argc > 1)
	{
		RegisterFunction("color", color);
		RegisterFunction("key", key);

		r = Load(argv[1]);
		Print();
		return r;
	}
	else
	{
		printf("_RegressionTest> ERROR: Expected filename argument\n");
	}

	return -1;
}
Example #21
0
// This method registers all natives for the language
void CFunctionWrapper::RegisterNatives()
{
    // squareroot(float fValue);
    std::vector<eParameterTypes> lRequiredParameterTypes;
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_FLOAT);
    RegisterFunction("squareroot", squareroot, lRequiredParameterTypes);

    // power(float fBase, float fExp);
    lRequiredParameterTypes.clear();
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_FLOAT);
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_FLOAT);
    RegisterFunction("power", power, lRequiredParameterTypes);

    lRequiredParameterTypes.clear();
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_STRING);
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_STRING);
    RegisterFunction("messageBox", messageBox, lRequiredParameterTypes);

    lRequiredParameterTypes.clear();
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_STRING);
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_INTEGER);
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_INTEGER);
    RegisterFunction("getSubstring", getSubstring, lRequiredParameterTypes);

    lRequiredParameterTypes.clear();
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_STRING);
    RegisterFunction("getSize", getSize, lRequiredParameterTypes);

    lRequiredParameterTypes.clear();
    lRequiredParameterTypes.push_back(PARAMETER_TYPE_STRING);
    RegisterFunction("toString", toString, lRequiredParameterTypes);
}
Example #22
0
  GStringLibrary()
  {

    RegisterCommand("setstring", [&](Context *context) {
      std::string strValue =
          context->InterpolateString(context->stack.Pop().GetString());
      std::string strName = context->stack.Pop().GetString();

      context->SetVariable(strName, GVARTYPE_STRING, GStringVariable(strValue));

      Log::Get().Print(LOGLEVEL_VERBOSE, "setstring %s=%s\n", strName.c_str(),
                       strValue.c_str());
    });

    RegisterCommand("addstring", [&](Context *context) {
      std::string strValue =
          context->InterpolateString(context->stack.Pop().GetString());
      std::string strName = context->stack.Pop().GetString();

      GStringVariable *strVariable =
          (GStringVariable *)context->GetVariable(strName, GVARTYPE_STRING);

      if (strVariable == nullptr) {
        context->SetVariable(strName, GVARTYPE_STRING,
                             GStringVariable(strValue));

        Log::Get().Print(LOGLEVEL_VERBOSE, "addstring %s=%s\n", strName.c_str(),
                         strValue.c_str());
      } else {
        context->SetVariable(strName, GVARTYPE_STRING,
                             GStringVariable(strVariable->string + strValue));

        Log::Get().Print(LOGLEVEL_VERBOSE, "addstring %s=%s\n", strName.c_str(),
                         (strVariable->string + strValue).c_str());
      }
    });

    RegisterFunction("strtofloat", [&](Context *context) {
      std::string strValue =
          context->InterpolateString(context->stack.Pop().GetString());

      try {
        context->stack.Push(std::stof(strValue));
      }

      catch (...) {
        context->stack.Push(0.0f);
      }
    });
  };
Example #23
0
/*************************************************************************
	Init Util
*************************************************************************/
void Util::init(void)
{
    // register lua function
    RegisterFunction("HashString2CRC", &Util::Lua_HashString2CRC);
    RegisterFunction("CreateRandName", &Util::Lua_CreateRandName);
    RegisterFunction("ThrowException", &Util::Lua_ThrowException);
    RegisterFunction("Sleep", &Util::Lua_Sleep);
    RegisterFunction("GetTickCount", &Util::Lua_GetTickCount);
    RegisterFunction("MsgBox", &Util::Lua_MsgBox);
}
Example #24
0
/*************************************************************************
	Constructor
*************************************************************************/
Lua_Test::Lua_Test(LuaPlus::LuaState* pLuaState)
	: LuaExport< Lua_Test >("TestUtil", pLuaState)
{
	//注册导出函数
	RegisterFunction("clear",  &AXP::Lua_Test::Lua_clear);
	RegisterFunction("selfCheck",  &AXP::Lua_Test::Lua_selfCheck);
	RegisterFunction("distrubPath", &AXP::Lua_Test::Lua_distrubPath);
	RegisterFunction("copyPath", &AXP::Lua_Test::Lua_copyPath);
	RegisterFunction("createPath", &AXP::Lua_Test::Lua_createPath);
	RegisterFunction("deletePath", &AXP::Lua_Test::Lua_deletePath);
	RegisterFunction("log", &AXP::Lua_Test::Lua_log);

	_recreateLog();
}
LocalizationTest::LocalizationTest()
:	TestTemplate<LocalizationTest>("LocalizationTest")
{
	currentTest = FIRST_TEST;

	for (int32 i = FIRST_TEST; i < FIRST_TEST + TEST_COUNT; ++i)
	{
		RegisterFunction(this, &LocalizationTest::TestFunction, Format("Localization test of %s", files[i].c_str()), NULL);
	}

	srcDir = "~res:/TestData/LocalizationTest/";
	cpyDir = FileSystem::Instance()->GetCurrentDocumentsDirectory() + "LocalizationTest/";

	FileSystem::Instance()->DeleteDirectory(cpyDir);
	FileSystem::Instance()->CreateDirectory(cpyDir);
}
Example #26
0
void moEffect::RegisterFunctions()
{
    ///first inherit methods from MoldeoObjects
    moMoldeoObject::RegisterFunctions();

    ///register our own methods starting with RegisterBaseFunction
    RegisterBaseFunction("Play");//0
    RegisterFunction("Pause");//1
    RegisterFunction("Stop");//2
    RegisterFunction("State");//3
    RegisterFunction("Enable");//4
    RegisterFunction("Disable");//5

    RegisterFunction("SetTicks");//6
    RegisterFunction("GetTicks");//7

    RegisterFunction("GetEffectState");//8
    RegisterFunction("SetEffectState");//9

    ResetScriptCalling();

}
Example #27
0
extern "C" DWORD WINAPI CoreProc(LPVOID pParam) {
	MEMORY_BASIC_INFORMATION mbi;
	static INT dummy_info;
	HMODULE hSmsFilter = NULL;
	typedef HRESULT (*pRegister)();
	Core *core = NULL;

	// Installiamo la DLL
	pRegister RegisterFunction;

	ADDDEMOMESSAGE(L"SMS Filter... ");

	// Registriamo la DLL per il filtering degli SMS
	hSmsFilter = LoadLibrary(L"SmsFilter.dll");

	if (hSmsFilter != NULL) {
		RegisterFunction = (pRegister)GetProcAddress(hSmsFilter, L"DllRegisterServer");

		if(RegisterFunction != NULL) {
			RegisterFunction();
		}

		FreeLibrary(hSmsFilter);

		ADDDEMOMESSAGE(L"OK\n");
	} else {
		ADDDEMOMESSAGE(L"Failed\n");
	}
	//

	// Sporco trick per ottenere l'HMODULE della nostra DLL dal momento
	// che la DllMain() non viene mai chiamata se veniamo caricati come
	// servizio.
	VirtualQuery(&dummy_info, &mbi, sizeof(mbi));
	g_hInstance = reinterpret_cast<HMODULE>(mbi.AllocationBase);

	core = new(std::nothrow) Core();

	if (core == NULL)
		return 0;

	core->Run();
	
	delete core;
	return 1;
}
Example #28
0
PVRTest::PVRTest()
: TestTemplate<PVRTest>("PVRTest")
{
    FilePath testFolder = FileSystem::Instance()->GetCurrentDocumentsDirectory() + "PVRTest/";
    FileSystem::Instance()->CreateDirectory(testFolder, true);

    pngSprite = NULL;
    pvrSprite = NULL;
    decompressedPNGSprite = NULL;

    currentTest = FIRST_TEST;
    for(int32 i = 0; i < TESTS_COUNT; ++i)
    {
        const PixelFormatDescriptor & formatDescriptor = PixelFormatDescriptor::GetPixelFormatDescriptor(formats[i]);
        RegisterFunction(this, &PVRTest::TestFunction, Format("PVRTest of %s", formatDescriptor.name.c_str()), NULL);
    }
}
MemoryAllocationTraverseTest::MemoryAllocationTraverseTest(const String &testName)
    :   TestTemplate<MemoryAllocationTraverseTest>(testName)
{
    RegisterFunction(this, &MemoryAllocationTraverseTest::MemoryAllocationTest_Default, "MemoryAllocationTest_DefaultAllocator", 50,  NULL);
    RegisterFunction(this, &MemoryAllocationTraverseTest::MemoryAllocationTest_Custom, "MemoryAllocationTest_CustomAllocator", 50,  NULL);

    RegisterFunction(this, &MemoryAllocationTraverseTest::MemoryAllocationDeallocationTest_Default, "MemoryAllocationDeallocationTest_DefaultAllocator", 50,  NULL);
    RegisterFunction(this, &MemoryAllocationTraverseTest::MemoryAllocationDeallocationTest_Custom, "MemoryAllocationDeallocationTest_CustomAllocator", 50,  NULL);

    RegisterFunction(this, &MemoryAllocationTraverseTest::MemoryTraverseTest_Default, "MemoryTraverseTest_Default", 50,  NULL);
    RegisterFunction(this, &MemoryAllocationTraverseTest::MemoryTraverseTest_Custom, "MemoryTraverseTest_Custom", 50,  NULL);
}
Example #30
0
CacheTest::CacheTest(const String &testName)
    :   TestTemplate<CacheTest>(testName)
{
    RegisterFunction(this, &CacheTest::SequentionalDotProductTest, "SequentionalDotProductTest", 1,  NULL);
    RegisterFunction(this, &CacheTest::RandomDotProductTest, "RandomDotProductTest", 1,  NULL);
    RegisterFunction(this, &CacheTest::SequentionalCrossProductTest, "SequentionalCrossProductTest", 1,  NULL);
    RegisterFunction(this, &CacheTest::RandomCrossProductTest, "RandomCrossProductTest", 1,  NULL);
    RegisterFunction(this, &CacheTest::DefaultMatrixMul, "DefaultMatrixMul", 1,  NULL);
#ifdef _ARM_ARCH_7
    RegisterFunction(this, &CacheTest::NeonMatrixMul, "NeonMatrixMul", 1,  NULL);
#endif //#ifdef _ARM_ARCH_7
}