/* =============== idCommonLocal::WriteConfiguration Writes key bindings and archived cvars to config file if modified =============== */ void idCommonLocal::WriteConfiguration() { // if we are quiting without fully initializing, make sure // we don't write out anything if ( !com_fullyInitialized ) { return; } if ( !( cvarSystem->GetModifiedFlags() & CVAR_ARCHIVE ) ) { return; } cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE ); // save to the profile idLocalUser * user = session->GetSignInManager().GetMasterLocalUser(); if ( user != NULL ) { user->SaveProfileSettings(); } #ifdef CONFIG_FILE // disable printing out the "Writing to:" message bool developer = com_developer.GetBool(); com_developer.SetBool( false ); WriteConfigToFile( CONFIG_FILE ); // restore the developer cvar com_developer.SetBool( developer ); #endif }
bool Test() { bool fail = false; int r; COutStream out; const char *script = "void Test() {} \n" "class A : I { void i(float) {} void a(int) {} float f; } \n" "class B : A { B(int) {} } \n" "interface I { void i(float); } \n" "float a; \n" "const float aConst = 3.141592f; \n" "I@ i; \n" "enum E { eval = 0, eval2 = 2 } \n" "E e; \n" "typedef float real; \n" "real pi = 3.14f; \n" "import void ImpFunc() from \"mod\"; \n"; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL); RegisterStdString(engine); float f; engine->RegisterTypedef("myFloat", "float"); engine->RegisterGlobalProperty("myFloat f", &f); engine->RegisterGlobalProperty("const float myConst", &f); engine->RegisterGlobalFunction("void func(int &in)", asFUNCTION(0), asCALL_GENERIC); engine->BeginConfigGroup("test"); engine->RegisterGlobalFunction("void func2()", asFUNCTION(0), asCALL_GENERIC); engine->EndConfigGroup(); engine->RegisterEnum("myEnum"); engine->RegisterEnumValue("myEnum", "value1", 1); engine->RegisterEnumValue("myEnum", "value2", 2); engine->RegisterFuncdef("void Callback(int a, int b)"); engine->RegisterInterface("MyIntf"); engine->RegisterInterfaceMethod("MyIntf", "void func() const"); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection("script", script); r = mod->Build(); if( r < 0 ) fail = true; WriteConfigToFile(engine, "AS_DEBUG/config.txt"); DumpModule(mod); // Save/Restore the bytecode and then test again for the loaded bytecode CBytecodeStream stream(__FILE__"1"); mod->SaveByteCode(&stream); mod = engine->GetModule("2", asGM_ALWAYS_CREATE); mod->LoadByteCode(&stream); DumpModule(mod); engine->Release(); return fail; }