view tango/example/external/GlueFlectioned.d @ 270:d9d5d59873d8 trunk

[svn r291] Fixed a bunch of the old Phobos tests to work with Tango. Branch statements now emit a new block after it. Fixed the _adSort runtime function had a bad signature. Added a missing dot prefix on compiler generated string tables for string switch. Fixed, PTRSIZE seems like it was wrong on 64bit, now it definitely gets set properly.
author lindquist
date Mon, 16 Jun 2008 16:01: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 );
}