Ejemplo n.º 1
0
/// <summary>
///   Installs static functions described in specified table.
/// </summary>
/// <param name="pStart">Start address of function table</param>
/// <param name="cEntries">Number of entries in function table</param>
void InstallStaticFunctions(
    const FunEntry* const pStart,
    uint            const cEntries )
{
    const FunEntry* const pEnd = pStart + cEntries;
    for (const FunEntry* p = pStart; p < pEnd; p++)
    {
        Val cell = p->m_fname;

        Val fn;

        Val fname = cell;
        if (SetfCell* const p = cell->DynamicCast<SetfCell>())
        {
            fname = list(Qsetf, p->m_name);
            fn = p->m_function;
        }
        else if (Symbol* const p = cell->DynamicCast<Symbol>())
        {
            fn = p->m_function;
        }
        else
        {
            CAN_NOT_HAPPEN();
        }

        if (nil == fn)
        {
            Val fn = MakeWrapper(
                    fname,
                    p->m_iMin,
                    p->m_iMax,
                    p->m_iRest & 1,
                    p->m_iVals,
                    p->m_iRest & 2,
                    p->m_psz );

            if (setf_cell_p(cell))
            {
                cell->StaticCast<SetfCell>()->m_function = fn;
            }
            else
            {
                fname->StaticCast<Symbol>()->m_function = fn;
            }
        } // if
    } // for each entry
} // InstallStaticFunctions
Ejemplo n.º 2
0
MonoObject* DOMBase::GetJSWrapper() 
{	
	if (_JSWrapperWPtr != 0)
	{
		//printf ("%s:%d %s() Mono calling C code\n", __FILE__, __LINE__, __FUNCTION__);
		MonoObject* domwrapper = mono_gchandle_get_target(_JSWrapperWPtr);
		if (!domwrapper)
			FatalError("Cannot find the JS Wrapper object through the weak refrence");
		return domwrapper;
	}
	else
	{
		//printf ("%s:%d %s() Mono calling C code\n", __FILE__, __LINE__, __FUNCTION__);	
		MonoObject* wrapperObject = MakeWrapper(this, GetMakeWrapperIndex());
		_JSWrapperWPtr = mono_gchandle_new_weakref(wrapperObject, false);
		return wrapperObject;
	}
}
Ejemplo n.º 3
0
void          DlistPush (DlistHeadT* ths, PtrT data)
{
  DlistT* elem = MakeWrapper(ths,data);  
  DilistPush(ths, (PtrT) elem);  
}