Esempio n. 1
0
// CONSTRUCTOR
//------------------------------------------------------------------------------
/*explicit*/ CachePlugin::CachePlugin( const AString & dllName ) :
	#if defined( __WINDOWS__ )
		m_DLL( nullptr ),
	#endif
		m_InitFunc( nullptr ),
		m_ShutdownFunc( nullptr ),
		m_PublishFunc( nullptr ),
		m_RetrieveFunc( nullptr ),
		m_FreeMemoryFunc( nullptr )
{
    #if defined( __WINDOWS__ )
        m_DLL = ::LoadLibrary( dllName.Get() );
        if ( !m_DLL )
        {
            FLOG_WARN( "Cache plugin '%s' load failed (0x%x).", dllName.Get(), ::GetLastError() );
            return;
        }

        m_InitFunc		= (CacheInitFunc)		GetFunction( "CacheInit",		"?CacheInit@@YA_NPEBD@Z" );
        m_ShutdownFunc	= (CacheShutdownFunc)	GetFunction( "CacheShutdown",	"?CacheShutdown@@YAXXZ"  );
        m_PublishFunc	= (CachePublishFunc)	GetFunction( "CachePublish",	"?CachePublish@@YA_NPEBDPEBX_K@Z" );
        m_RetrieveFunc	= (CacheRetrieveFunc)	GetFunction( "CacheRetrieve",	"?CacheRetrieve@@YA_NPEBDAEAPEAXAEA_K@Z" );
        m_FreeMemoryFunc= (CacheFreeMemoryFunc)	GetFunction( "CacheFreeMemory", "?CacheFreeMemory@@YAXPEAX_K@Z" );
    #elif defined( __APPLE__ )
        ASSERT( false ); // TODO:MAC Implement CachePlugin
    #elif defined( __LINUX__ )
        ASSERT( false ); // TODO:LINUX Implement CachePlugin
    #else
        #error Unknown platform
    #endif
}
Esempio n. 2
0
File: Dsl.cpp Progetto: CQiao/DSL
  void Statement::WriteToFile(FILE* fp, int indent)const
  {
#if _DEBUG
    int num = GetFunctionNum();
    Function* func1 = GetFunction(0);
    Function* func2 = GetFunction(1);
    if (num == 2 && NULL != func1 && NULL != func2 && func1->GetCall().GetParamClass() == Call::PARAM_CLASS_TERNARY_OPERATOR && func2->GetCall().GetParamClass() == Call::PARAM_CLASS_TERNARY_OPERATOR){
      ISyntaxComponent* pcomp0 = func1->GetCall().GetParam(0);
      ISyntaxComponent* pcomp1 = func1->GetStatement(0);
      ISyntaxComponent* pcomp2 = func2->GetStatement(0);
      if (NULL!=pcomp0 && NULL != pcomp1 && NULL != pcomp2){
        WriteComponent(fp, *pcomp0, indent);
        fwrite(" ? ", 3, 1, fp);
        WriteComponent(fp, *pcomp1, 0);
        fwrite(" : ", 3, 1, fp);
        WriteComponent(fp, *pcomp2, 0);
      }
    } else {
      for (int ix = 0; ix < num; ++ix){
        ISyntaxComponent& component = *GetFunction(ix);
        WriteComponent(fp, component, indent);
        if (ix < num - 1){
          fwrite("\n", 1, 1, fp);
        }
      }
    }
#endif
  }
Esempio n. 3
0
void ScriptFile::AddEventHandler(Object* sender, StringHash eventType, const String& handlerName)
{
    if (!compiled_)
        return;
    
    if (!sender)
    {
        LOGERROR("Null event sender for event " + String(eventType) + ", handler " + handlerName);
        return;
    }
    
    String declaration = "void " + handlerName + "(StringHash, VariantMap&)";
    asIScriptFunction* function = GetFunction(declaration);
    if (!function)
    {
        declaration = "void " + handlerName + "()";
        function = GetFunction(declaration);
        if (!function)
        {
            LOGERROR("Event handler function " + handlerName + " not found in " + GetName());
            return;
        }
    }
    
    SubscribeToEvent(sender, eventType, HANDLER_USERDATA(ScriptFile, HandleScriptEvent, (void*)function));
}
wxString wxStringFormatter::DoFunction(wxString func, wxString block)
{
	wxLogDebug("DoFunction: " + block);
	if(GetFunction(func))
	{
		return GetFunction(func)->Parse(ReplaceSymbols(block));
	}
	return func + block;
}
Esempio n. 5
0
    DiagNativeStackFrame::DiagNativeStackFrame(
        ScriptFunction* function,
        int byteCodeOffset,
        void* stackAddr,
        void *codeAddr,
        int frameIndex) :
        DiagStackFrame(frameIndex),
        m_function(function),
        m_byteCodeOffset(byteCodeOffset),
        m_stackAddr(stackAddr),
        m_localVarSlotsOffset(InvalidOffset),
        m_localVarChangedOffset(InvalidOffset)
    {
        Assert(m_stackAddr != NULL);
        AssertMsg(m_function && m_function->GetScriptContext() && m_function->GetScriptContext()->IsInDebugMode(),
            "This only supports functions in debug mode.");

        FunctionEntryPointInfo * entryPointInfo = GetFunction()->GetEntryPointFromNativeAddress((DWORD_PTR)codeAddr);
        if (entryPointInfo)
        {
            m_localVarSlotsOffset = entryPointInfo->localVarSlotsOffset;
            m_localVarChangedOffset = entryPointInfo->localVarChangedOffset;
        }
        else
        {
            AssertMsg(FALSE, "Failed to get entry point for native address. Most likely the frame is old/gone.");
        }
        OUTPUT_TRACE(Js::DebuggerPhase, L"DiagNativeStackFrame::DiagNativeStackFrame: e.p(addr %p)=%p varOff=%d changedOff=%d\n", codeAddr, entryPointInfo, m_localVarSlotsOffset, m_localVarChangedOffset);
    }
Esempio n. 6
0
void CreateTimer(ScriptValue &s, ScriptValue *args) {
	if (args[1].intVal < 1 || args[1].intVal > (1<<30)) {
		return;
	}
	ObjectValue *obj;
	int function = GetFunction(&args[0], &args[3], obj);
	if (function < 0) return;
	int index = FindTimerSpace();
	if (index == -1) {
		if (obj) obj->Release();
		return;
	}
	if (!(timers[index].slowTimer = (Timer*) malloc(sizeof(Timer)))) {
		if (obj) obj->Release();
		timers[index].type = KILLED_TIMER;
		return;
	}
	timers[index].obj = obj;
	timers[index].type = SLOW_TIMER;
	timers[index].function = function;
	timers[index].slowTimer->Init(SlowTimerProc, (void*)(size_t)index, args[1].intVal, RUN_ALWAYS, 0, SAVE_NONE);
	if (timers[index].slowTimer->timerMode != RUN_ALWAYS) {
		timers[index].Kill();
	}
	else {
		CreateIntValue(s, index+1);
		if (args[2].intVal == 0) {
			timers[index].slowTimer->lastRun = time64i();
			timers[index].slowTimer->ChangeDelay(timers[index].slowTimer->delay);
		}
	}
}
Esempio n. 7
0
void CreateFastTimer(ScriptValue &s, ScriptValue *args) {
	if (args[1].intVal < 10 || args[1].intVal > 3600000) {
		return;
	}
	ObjectValue *obj;
	int function = GetFunction(&args[0], &args[3], obj);
	if (function < 0) return;

	int index = FindTimerSpace();
	if (index == -1) {
		if (obj) obj->Release();
		return;
	}
	timers[index].type = FAST_TIMER;
	timers[index].obj = obj;
	timers[index].function = function;
	timers[index].fastTimer.active = 0;
	timers[index].fastTimer.id = index+10;
	timers[index].fastTimer.delay = args[1].i32;
	if (!timers[index].Start(1)) {
		timers[index].Kill();
	}
	else {
		CreateIntValue(s, index+1);
		if (args[2].intVal)
			RunTimerFunction(timers[index].function, timers[index].obj, index+1);
	}
}
Esempio n. 8
0
extern "C" void NSMain(const v8::FunctionCallbackInfo<v8::Value>& args)
{
	auto isolate = args.GetIsolate();

	auto len = args.Length();

	if (len != 5)
	{
		auto errMsg = v8::String::NewFromUtf8(isolate, "Wrong number of arguments (expected 5)");
		auto err = v8::Exception::Error(errMsg);
		isolate->ThrowException(err);
		return;
	}

	auto exports = args[1].As<v8::Object>();

	auto ft = v8::FunctionTemplate::New(isolate, AddFuncCallback);
	auto ctx = isolate->GetCurrentContext();
	auto maybeFunc = ft->GetFunction(ctx);
	if (maybeFunc.IsEmpty())
	{
		auto errMsg = v8::String::NewFromUtf8(isolate, "Cannot create 'add' function");
		auto err = v8::Exception::Error(errMsg);
		isolate->ThrowException(err);
		return;
	}

	auto func = maybeFunc.ToLocalChecked();

	auto propName = v8::String::NewFromUtf8(isolate, "add");
	auto result = exports->Set(ctx, propName, func);
}
Esempio n. 9
0
static VALUE
pkcs11_C_GetMechanismList(VALUE self, VALUE slot_id)
{
  CK_RV rv;
  CK_C_GetMechanismList func;
  CK_MECHANISM_TYPE_PTR types;
  CK_ULONG count;
  VALUE ary;
  CK_ULONG i;

  ary = rb_ary_new();
  GetFunction(self, C_GetMechanismList, func);
  CallFunction(C_GetMechanismList, func, rv, NUM2HANDLE(slot_id), NULL_PTR, &count);
  if (rv != CKR_OK) pkcs11_raise(self,rv);
  if (count == 0) return ary;

  types = (CK_MECHANISM_TYPE_PTR)malloc(sizeof(CK_MECHANISM_TYPE)*count);
  if (!types) rb_sys_fail(0);
  CallFunction(C_GetMechanismList, func, rv, NUM2HANDLE(slot_id), types, &count);
  if (rv != CKR_OK){
    free(types);
    pkcs11_raise(self,rv);
  }
  for (i = 0; i < count; i++)
    rb_ary_push(ary, HANDLE2NUM(*(types+i)));
  free(types);

  return ary;
}
Esempio n. 10
0
/*
============
idScriptObject::SetSyncCallback
============
*/
void idScriptObject::SetSyncCallback( const char *name, const char* functionName ) {
	const sdProgram::sdFunction* function = GetFunction( functionName );
	if ( !function ) {
		gameLocal.Warning( "idScriptObject::SetSyncCallback Unknown Function '%s'", functionName );
		return;
	}

	if ( typeObject == NULL ) {
		gameLocal.Warning( "idScriptObject::SetSyncCallback No Script Object" );
		return;
	}

	byte* data = NULL;
	typeObject->GetVariable( name, &data );
	if ( data == NULL ) {
		gameLocal.Warning( "idScriptObject::SetSyncCallback Unknown Field '%s'", name );
	}

	for ( int k = 0; k < NSM_NUM_MODES; k++ ) {
		for ( int j = 0; j < networkFields[ k ].fields.Num(); j++ ) {
			if ( networkFields[ k ].fields[ j ].data == data ) {
				networkFields[ k ].fields[ j ].callback = function;
				return;
			}
		}
	}
	gameLocal.Warning( "idScriptObject::SetSyncCallback No Synced Field Named '%s' Found", name );
}
Esempio n. 11
0
/*
============
idScriptObject::GetConstructor
============
*/
const function_t *idScriptObject::GetConstructor( void ) const
{
	const function_t *func;
	
	func = GetFunction( "init" );
	return func;
}
Esempio n. 12
0
/*
============
idScriptObject::GetDestructor
============
*/
const function_t *idScriptObject::GetDestructor( void ) const
{
	const function_t *func;
	
	func = GetFunction( "destroy" );
	return func;
}
Esempio n. 13
0
void ScrollComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);

	//shared with the rest of the entity
	m_vecDisplacement = m_vecChildPos = CL_Vec2f(0,0);
	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
	//vars in our component namespace
	m_pBoundsRect = &GetVarWithDefault("boundsRect", CL_Rectf(0, 0, 0,0))->GetRect();
	m_pScrollStyle = &GetVarWithDefault("scrollStyle", uint32(STYLE_MOMENTUM))->GetUINT32();
	
	//only used for "momentum style"
	m_pFriction = &GetVarWithDefault("friction", 0.1f)->GetFloat();
	m_pMaxScrollSpeed = &GetVarWithDefault("maxScrollSpeed", float(7))->GetFloat();
	m_pPowerMod = &GetVarWithDefault("powerMod", float(0.15))->GetFloat();
	m_progressVar = GetVar("progress2d");
	m_pEnforceFingerTracking = &GetVarWithDefault("fingerTracking", uint32(0))->GetUINT32();
	m_pSwipeDetectDistance = &GetVarWithDefault("swipeDetectDistance", 25.0f)->GetFloat();
	m_pDontScrollUntilSwipeDetected = &GetVarWithDefault("dontScrollUntilSwipeDetected", uint32(0))->GetUINT32();
	m_pEatAllInput = &GetVarWithDefault("eatAllInput", uint32(0))->GetUINT32();

	GetParent()->GetFunction("OnOverStart")->sig_function.connect(1, boost::bind(&ScrollComponent::OnOverStart, this, _1));
	GetParent()->GetFunction("OnOverEnd")->sig_function.connect(1, boost::bind(&ScrollComponent::OnOverEnd, this, _1));
	GetParent()->GetFunction("OnOverMove")->sig_function.connect(1, boost::bind(&ScrollComponent::OnOverMove, this, _1));
	GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ScrollComponent::OnUpdate, this, _1));
	GetFunction("SetProgress")->sig_function.connect(1, boost::bind(&ScrollComponent::SetProgress, this, _1));
}
Esempio n. 14
0
static VALUE
pkcs11_C_GetSlotList(VALUE self, VALUE presented)
{
  CK_ULONG ulSlotCount;
  CK_SLOT_ID_PTR pSlotList;
  CK_RV rv;
  CK_C_GetSlotList func;
  CK_ULONG i;
  VALUE ary = rb_ary_new();

  GetFunction(self, C_GetSlotList, func);
  CallFunction(C_GetSlotList, func, rv, CK_FALSE, NULL_PTR, &ulSlotCount);
  if (rv != CKR_OK) pkcs11_raise(self,rv);
  pSlotList = (CK_SLOT_ID_PTR)malloc(ulSlotCount*sizeof(CK_SLOT_ID));
  CallFunction(C_GetSlotList, func, rv, RTEST(presented) ? CK_TRUE : CK_FALSE, pSlotList, &ulSlotCount);
  if (rv != CKR_OK) {
    free(pSlotList);
    pkcs11_raise(self,rv);
  }
  for (i = 0; i < ulSlotCount; i++)
    rb_ary_push(ary, HANDLE2NUM(pSlotList[i]));
  free(pSlotList);

  return ary;
}
void
TestFunctionEquality
	(
	const JCharacter* fileName
	)
{
	std::ifstream input(fileName);

	TestVarList theVarList(input);

	JFunction* f1 = NULL;
	JFunction* f2 = NULL;
	while (1)
		{
		if (!GetFunction(input, &theVarList, &f1))
			{
			break;
			}
		else if (f1 == NULL)
			{
			continue;
			}

		if (!GetFunction(input, &theVarList, &f2))
			{
			jdelete f1;
			break;
			}
		else if (f2 == NULL)
			{
			jdelete f1;
			continue;
			}

		if (*f1 == *f2)
			{
			(JGetUserNotification())->DisplayMessage("These functions are the same");
			}
		else
			{
			(JGetUserNotification())->DisplayMessage("These functions are not the same");
			}

		jdelete f1;
		jdelete f2;
		}
}
Esempio n. 16
0
    Module * ModuleFactory::createModule(const char * path) const {
        Info << "Loading " << path;
        void *hDLL;
        //do not add extension. It is handled by LoadSharedLibrary.
        hDLL = LoadSharedLibrary(path);
        if (hDLL == 0)
            return NULL;
        Instance instanciate = (Instance)GetFunction(hDLL, "create");
        Destroy destroy = (Destroy)GetFunction(hDLL, "destroy");
        if (instanciate == 0 || destroy == 0)
            return NULL;

        Module * module = instanciate();
        module->setCleanLibraryCallback(new CleanLibraryCallBack(hDLL, destroy));

        return module;
    }
Esempio n. 17
0
void Dollar::InitInstance(Isolate* iso, v8::Handle<v8::Object> & target)
{
	auto tmpl = Local<FunctionTemplate>::New(iso, _Template);
	// create an instance of dollar object and make a property
	auto dollar = tmpl->GetFunction()->NewInstance();
	// target->SetAccessor(String::NewFromUtf8(iso, "$"), jsGetter, 0, dollar);
	target->Set(String::NewFromUtf8(iso, "$"), dollar);
}
Esempio n. 18
0
//////////////////////////////////////////////////////////////////////
//
// ClParser::internVarCell
//
//  o Returns %rd of VARDEF instruction.
//  o Returns %rd of UPVAR instruction in pFun for pVar->
//
Register*
ClParser::internVarCell(Variable* pVar)
{
    Register* pCell = ir_find_variable(GetFunction(), pVar);
    if (NULL == pCell)
    {
        pCell = new Register();

        Function* pUser = GetFunction();

        ir_insert_insn(
            new UpVarDefInsn(pCell, pVar),
            pUser->GetEntryInsn()->GetNext() );
    } // if

    return pCell;
} // ClParser::internVarCell
Esempio n. 19
0
    Var * DiagNativeStackFrame::GetSlotOffsetLocation(RegSlot slotId, bool allowTemp)
    {
        Assert(GetFunction() != NULL);

        int32 slotOffset;
        if (GetFunction()->GetSlotOffset(slotId, &slotOffset, allowTemp))
        {
            Assert(m_localVarSlotsOffset != InvalidOffset);
            slotOffset = m_localVarSlotsOffset + slotOffset;

            // We will have the var offset only (which is always the Var size. With TypeSpecialization, below will change to accommodate double offset.
            return (Js::Var *)(((char *)m_stackAddr) + slotOffset);
        }

        Assert(false);
        return NULL;
    }
Esempio n. 20
0
static void body (LexState *ls, expdesc *e, int needself, int line) {
  /* body ->  `(' parlist `)' chunk END */  

#ifdef LUA_UTILITIES_NET
  char szFuncName1[256];
  char szFuncName2[256];
#endif

  FuncState new_fs;
  open_func(ls, &new_fs);
  new_fs.f->linedefined = line;

#ifdef LUA_UTILITIES_NET
  szFuncName1[0] = 0;
  szFuncName2[0] = 0;
  TryGetFunctionName(ls->t.seminfo.ts, szFuncName1, 256);
#endif

  checknext(ls, '(');
  if (needself) {
    new_localvarliteral(ls, "self", 0);
    adjustlocalvars(ls, 1);
  }
  parlist(ls);
  checknext(ls, ')');
  chunk(ls);    
  
#ifdef LUA_UTILITIES_NET
  if (szFuncName1[0] == 0)
	TryGetFunctionName(ls->t.seminfo.ts, szFuncName2, 256);
#endif
  
  new_fs.f->lastlinedefined = ls->linenumber;
  check_match(ls, TK_END, TK_FUNCTION, line);
  close_func(ls);

#ifdef LUA_UTILITIES_NET
  // Use the correct function name based on values obtained
  if (szFuncName1[0] == 0)
	  GetFunction(szFuncName2, ls, new_fs.f);
  else
	  GetFunction(szFuncName1, ls, new_fs.f);
#endif

  pushclosure(ls, &new_fs, e);
}
Esempio n. 21
0
void n32016_build_matrix()
{
   uint32_t Index;

   for (Index = 0; Index < 256; Index++)
   {
      FunctionLookup[Index] = GetFunction(Index);
   }
}
Esempio n. 22
0
/*
============
idScriptObject::CallEvent
============
*/
void idScriptObject::CallEvent( const char* name ) {
	const sdProgram::sdFunction* function = GetFunction( name );
	if ( function == NULL ) {
		return;
	}

	sdScriptHelper h1;
	CallNonBlockingScriptEvent( function, h1 );
}
Esempio n. 23
0
gmThread::State gmThread::Sys_PopStackFrame(const gmuint8 * &a_ip, const gmuint8 * &a_cp)
{
  if(m_frame == NULL)
  {
    m_machine->GetLog().LogEntry("stack underflow");
    return SYS_EXCEPTION;
  }

  // Write barrier old local objects
  {
    gmGarbageCollector* gc = m_machine->GetGC();
    if( !gc->IsOff() )
    {
      for(int index = m_base-2; index < m_top; ++index)
      {
        if(m_stack[index].IsReference())
        {
          gmObject * object = GM_MOBJECT(m_machine, m_stack[index].m_value.m_ref);
          gc->WriteBarrier(object);
        }
      }
    }
  }

  gmStackFrame * frame = m_frame->m_prev;
  if( frame == NULL ) // Final frame, we will exit now
  {
    return KILLED; // Don't clean up stack, let the machine reset it as state changes to killed (so Exit callback can examine valid thread contents)
  }
  a_ip = m_frame->m_returnAddress;
  // Copy old tos to new tos
  m_stack[m_base - 2] = m_stack[m_top - 1];
  m_top = m_base - 1;
  m_base = m_frame->m_returnBase;
  m_machine->Sys_FreeStackFrame(m_frame);
  m_frame = frame;

  // Update instruction and code pointers
  GM_ASSERT(GetFunction()->m_type == GM_FUNCTION);
  gmFunctionObject * fn = (gmFunctionObject *) GM_MOBJECT(m_machine, GetFunction()->m_value.m_ref);
  a_cp = (const gmuint8 *) fn->GetByteCode();

  return RUNNING;
}
Esempio n. 24
0
Engine::Engine(void* moduleHandle)
{
    m_End = false;
    m_GuiLib = LoadLib(".\\bin\\Debug\\Sentiment_SFMLGui");

    if(m_GuiLib != nullptr)
    {
        GUI_CONSTRUCTOR GuiConstructor = (GUI_CONSTRUCTOR) GetFunction(m_GuiLib, "CreateGui");
        if(GuiConstructor != nullptr)
            GuiConstructor(m_GuiManager);
        else
            throw std::runtime_error("Could not find token 'CreateGui' in Sentiment_SFMLGui.dll");
    }
    else
        throw std::runtime_error("Could not open Sentiment_SFMLGui.dll");

    m_RenderLib = LoadLib(".\\bin\\Debug\\Sentiment_OGL4-3Renderer");

    if(m_RenderLib != nullptr)
    {
        RENDERER_CONSTRUCTOR renderConstructor = (RENDERER_CONSTRUCTOR) GetFunction(m_RenderLib, "CreateRendererAndUtility");
        if(renderConstructor != nullptr)
            renderConstructor(m_Renderer, m_RenderUtility);
        else
            throw std::runtime_error("Could not find token 'CreateRendererAndUtility' in Sentiment_OGL4-3Renderer.dll");
    }
    else
        throw std::runtime_error("could not open Sentiment_OGL4-3Renderer");

    m_GameLib = LoadLib(".\\bin\\Debug\\game");
    if(m_GameLib != nullptr)
    {
        GAME_CONSTRUCTOR gameConstructor = (GAME_CONSTRUCTOR) GetFunction(m_GameLib, "CreateGame");
        if(gameConstructor != nullptr)
            gameConstructor(m_Game, this);
        else
            throw std::runtime_error("Could not find token 'CreateGame' in game.dll");
    }
    else
        throw std::runtime_error("Could not open game.dll");

    m_Game->Initialize();
    m_Game->Activate();
}
Esempio n. 25
0
void Plugin::Draw()
{
  if(m_library)
  {
    if(!m_DrawFunc)
      m_DrawFunc = GetFunction("Render");

    if(m_DrawFunc)
      m_DrawFunc();
  }
}
Esempio n. 26
0
void Plugin::Update()
{
  if(m_library)
  {
    if(!m_UpdateFunc)
      m_UpdateFunc = GetFunction("UpdatePlugin");

    if(m_UpdateFunc)
      m_UpdateFunc();
  }
}
Esempio n. 27
0
CLuaCFunction* CLuaCFunctions::AddFunction ( const char* szName, lua_CFunction f, bool bRestricted )
{
    ms_pFunctionPtrLow = Min < void* > ( ms_pFunctionPtrLow, (void*)f );
    ms_pFunctionPtrHigh = Max < void* > ( ms_pFunctionPtrHigh, (void*)f );

    // Already have a function by this name?
    CLuaCFunction* pFunction = GetFunction ( szName );
    if ( pFunction )
        return pFunction;

    // Already have a function by this address?
    pFunction = GetFunction ( f );
    if ( !pFunction )
    {
        pFunction = new CLuaCFunction ( szName, f, bRestricted );
        ms_Functions [ f ] = pFunction;
    }
    ms_FunctionsByName [ szName ] = pFunction;
    return pFunction;
}
Esempio n. 28
0
bool ScriptFile::Execute(const String& declaration, const VariantVector& parameters, bool unprepare)
{
    asIScriptFunction* function = GetFunction(declaration);
    if (!function)
    {
        LOGERROR("Function " + declaration + " not found in " + GetName());
        return false;
    }
    
    return Execute(function, parameters, unprepare);
}
Esempio n. 29
0
USERFCN2 Problem::GetUserFunction2()
{
  // load in the library function and cast appropriately before returning
  DOMElement* subroutineXML = GetSubroutineXML();
  string fEval =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("FEval")));
  string libName =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("LibName")));
  void* function = GetFunction(libName, fEval);
  return (USERFCN2) function;
}
Esempio n. 30
0
INITFCN Problem::GetInitFunction()
{
  // load in the library function and cast appropriately before returning
  DOMElement* subroutineXML = GetSubroutineXML();
  string init =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("Init")));
  string libName =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("LibName")));
  void* function = GetFunction(libName, init);
  return (INITFCN) function;
}