view tango/example/external/GlueFlectioned.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
parents 1700239cab2e
children
line wrap: on
line source

import tango.core.Exception;
import cn.kuehne.flectioned;


TracedExceptionInfo traceHandler( void* ptr = null )
{
    class FlectionedTrace :
        TracedExceptionInfo
    {
        this( void* ptr = null )
        {
            if( ptr )
                m_trace = Trace.getTrace( cast(size_t) ptr );
            else
                m_trace = Trace.getTrace();
        }

        int opApply( int delegate( inout char[] ) dg )
        {
            int ret = 0;
            foreach( t; m_trace )
            {
                char[] buf = t.toString;
                ret = dg( buf );
                if( ret != 0 )
                    break;
            }
            return ret;
        }

    private:
        Trace[] m_trace;
    }

    return new FlectionedTrace( ptr );
}


static this()
{
    setTraceHandler( &traceHandler );
}