Esempio n. 1
0
void GraphicsScene::
        mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
{
    DEBUG_EVENTS TaskTimer tt("GraphicsScene mouseReleaseEvent %s %d", vartype(*e).c_str(), e->isAccepted());
    QGraphicsScene::mouseReleaseEvent(e);
    DEBUG_EVENTS TaskTimer("GraphicsScene mouseReleaseEvent %s info %d", vartype(*e).c_str(), e->isAccepted()).suppressTiming();
}
Esempio n. 2
0
void
vari_def (void)
{
  firstentry = symtab_nextentry;
  match (VAR);
  {
    symtab_add (lexeme);
  }
  match (ID);
  while (lookahead == ',')
    {
      match (',');
      {
	symtab_add (lexeme);
      }
      match (ID);
    }
  match (':');
  vartype ();
  match (';');
  while (lookahead == ID)
    {
      match (ID);
      while (lookahead == ',')
	{
	  match (',');
	  match (ID);
	}
      match (':');
      vartype ();
      match (';');
    }
}
Esempio n. 3
0
bool GraphicsView::
        event ( QEvent * e )
{
    DEBUG_EVENTS TaskTimer tt("GraphicsView event %s %d", vartype(*e).c_str(), e->isAccepted());
    bool r = QGraphicsView::event(e);
    DEBUG_EVENTS TaskTimer("GraphicsView event %s info %d %d", vartype(*e).c_str(), r, e->isAccepted()).suppressTiming();
    return r;
}
Esempio n. 4
0
bool GraphicsScene::
        eventFilter(QObject* o, QEvent* e)
{
    DEBUG_EVENTS TaskTimer tt("GraphicsScene eventFilter %s %s %d", vartype(*o).c_str(), vartype(*e).c_str(), e->isAccepted());
    bool r = QGraphicsScene::eventFilter(o, e);
    DEBUG_EVENTS TaskTimer("GraphicsScene eventFilter %s %s info %d %d", vartype(*o).c_str(), vartype(*e).c_str(), r, e->isAccepted()).suppressTiming();
    return r;
}
Esempio n. 5
0
void GraphicsView::mouseMoveEvent(QMouseEvent *e)
{
    if (!hasFocus())
    {
        setFocus();
    }
    DEBUG_EVENTS TaskTimer tt("GraphicsView mouseMoveEvent %s %d", vartype(*e).c_str(), e->isAccepted());
    QGraphicsView::mouseMoveEvent(e);
    DEBUG_EVENTS TaskTimer("GraphicsView mouseMoveEvent %s info %d", vartype(*e).c_str(), e->isAccepted()).suppressTiming();
}
Esempio n. 6
0
void GraphicsScene::
        mouseMoveEvent(QGraphicsSceneMouseEvent *e)
{
    if (renderview_->model->render_settings.draw_cursor_marker)
        redraw();

    DEBUG_EVENTS TaskTimer tt("GraphicsScene mouseMoveEvent %s %d", vartype(*e).c_str(), e->isAccepted());
    QGraphicsScene::mouseMoveEvent(e);
    DEBUG_EVENTS TaskTimer("GraphicsScene mouseMoveEvent %s info %d", vartype(*e).c_str(), e->isAccepted()).suppressTiming();
}
Esempio n. 7
0
void ReadMatlabSettings::
checkIfReady()
{
    bool finished = function_->hasProcessCrashed() || function_->hasProcessEnded();

    string file = function_->isReady();
    if (file.empty() && !finished)
    {
        QTimer::singleShot(100, this, SLOT(checkIfReady()));
        return;
    }

    QByteArray ba;
    if (function_->getProcess())
        ba = function_->getProcess()->readAllStandardOutput();
    QString s( ba );
    s = s.trimmed();
    if (s.isEmpty())
        TaskInfo("ReadMatlabSettings %s: no output", function_->matlabFunction().c_str());
    else
        TaskInfo("ReadMatlabSettings %s: output: %s", function_->matlabFunction().c_str(), s.toLatin1().data());

    bool success = false;

    if (!file.empty()) try
        {
            switch (type_)
            {
            case MetaData_Settings:
                readSettings(file);
                break;
            case MetaData_Source:
                readSource(file);
                break;
            default:
                EXCEPTION_ASSERT( false );
                break;
            }
            success = true;
        }
        catch (const runtime_error& x)
        {
            TaskInfo("ReadMatlabSettings::%s %s", vartype(x).c_str(), x.what());
            s += "\n";
            s += vartype(x).c_str();
            s += ": ";
            s += x.what();
        }

    if (!success)
        emit failed( settings.scriptname().c_str(), s );

    if (deletethis_)
        delete this;
}
Esempio n. 8
0
File: parser2.c Progetto: tungvx/FSE
static AST typedecl() {
    Token *t = &tok;
    AST a=0;
    a = vartype();
    a = mod(a);
    return a; 
}
Esempio n. 9
0
/* tipos: type_def -> ID \= vartype */
void
type_def (void)
{
  match (ID);
  match ('=');
  vartype ();
}
Esempio n. 10
0
void Worker::
        loop_while_tasks()
  {
    while (!QThread::currentThread ()->isInterruptionRequested ())
      {
        Task task;

        {
            DEBUGINFO TaskTimer tt(boost::format("worker: get task %s %s") % vartype(*schedule_.get ()) % (computing_engine_?vartype(*computing_engine_):"(null)") );
            task = schedule_->getTask(computing_engine_);
        }

        if (task)
          {
            DEBUGINFO TaskTimer tt(boost::format("worker: running task %s") % task.expected_output());
            task.run();
            emit oneTaskDone();
          }
        else
          {
            DEBUGINFO TaskInfo("worker: back to sleep");
            // Wait for a new wakeup call
            break;
          }
      }
  }
Esempio n. 11
0
void QtEventWorker::
        loop_while_tasks()
  {
    // the only events sent to this thread are wakeup() or termination events,
    // in order to not pile up a never ending queue make sure to process events as they come
    while (!QCoreApplication::hasPendingEvents ())
      {
        Timer work_timer;
        Signal::Processing::Task task;

        {
            DEBUGINFO TaskTimer tt(boost::format("worker: get task %s %s") % vartype(*schedule_.get ()) % (computing_engine_?vartype(*computing_engine_):"(null)") );
            task = schedule_->getTask(computing_engine_);
        }

        if (task)
          {
            DEBUGINFO TaskTimer tt(boost::format("worker: running task %s") % task.expected_output());
            task.run();
            active_time_since_start_ += work_timer.elapsed ();
            ltf_tasks_.tick ();
            emit oneTaskDone();
          }
        else
          {
            DEBUGINFO Log("worker: back to sleep");
            // Wait for a new wakeup call
            break;
          }

        // run loop at least once to simplify testing when aborting a worker right away
        if (QThread::currentThread ()->isInterruptionRequested ())
            break;
      }
  }
Esempio n. 12
0
void SaweTestClass::
        exec()
{
    TaskTimer ti("%s::%s", vartype(*this).c_str(), __FUNCTION__, NULL);

    Sawe::Application::global_ptr()->exec();
}
Esempio n. 13
0
int UnitTest::
        test(bool rethrow_exceptions)
{
    try {
        Timer(); // Init performance counting
        TaskTimer tt("Running tests");

        RUNTEST(Tfr::FreqAxis);
        RUNTEST(Tfr::StftDesc);
        RUNTEST(Tfr::DummyTransform);
        RUNTEST(Tfr::DummyTransformDesc);
        RUNTEST(Tfr::TransformOperationDesc);

    } catch (const ExceptionAssert& x) {
        if (rethrow_exceptions)
            throw;

        char const * const * f = boost::get_error_info<boost::throw_file>(x);
        int const * l = boost::get_error_info<boost::throw_line>(x);
        char const * const * c = boost::get_error_info<ExceptionAssert::ExceptionAssert_condition>(x);
        std::string const * m = boost::get_error_info<ExceptionAssert::ExceptionAssert_message>(x);

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s:%d: %s. %s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % (f?*f:0) % (l?*l:-1) % (c?*c:0) % (m?*m:0) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (const exception& x) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % vartype(x) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (...) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("Not an std::exception\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % boost::current_exception_diagnostic_information () % lastname ).c_str());
        fflush(stderr);
        return 1;
    }

    printf("\n OK\n\n");
    return 0;
}
Esempio n. 14
0
pBuffer SourceBase::
        readChecked( const Interval& I )
{
    TIME_SOURCEBASE TaskTimer tt("%s::readChecked( %s )", vartype(*this).c_str(), I.toString().c_str());

    EXCEPTION_ASSERT( I.count() );

    pBuffer r = read(I);

    // Check if read returned the first sample in interval I
    Interval i(I.first, I.first + 1);
    if ((i & r->getInterval()) != i)
    {
        TaskTimer tt("%s::readChecked( %s ) got %s", vartype(*this).c_str(), I.toString().c_str(), r->getInterval ().toString ().c_str ());
        EXCEPTION_ASSERT_EQUALS( i & r->getInterval(), i );
    }

    return r;
}
Esempio n. 15
0
File: parser2.c Progetto: tungvx/FSE
static AST rettype(){
    Token *t = &tok;
    AST a=0;

    switch (t->sym) {
	case tVOID:    a = make_AST_name("void"); break;
	default:     return vartype(); 
    }
    gettoken();
    return a;
}
Esempio n. 16
0
/* parâmetros: parm -> [VAR] ID {, ID} : vartype */
void
parm (void)
{
  if (lookahead == VAR)
    match (VAR);
  match (ID);
  while (lookahead == ',')
    {
      match (',');
      match (ID);
    }
  match (':');
  vartype ();
}
Esempio n. 17
0
pBuffer SourceBase::
        zeros( const Interval& I )
{
    EXCEPTION_ASSERT( I.count() );

    TIME_SOURCEBASE TaskTimer tt("%s.%s %s",
                  vartype(*this).c_str(), __FUNCTION__ ,
                  I.toString().c_str() );

    pBuffer r( new Buffer(I, sample_rate(), num_channels()) );
    // doesn't need to memset 0, will be set by the first initialization of a dataset
    //memset(r->waveform_data()->getCpuMemory(), 0, r->waveform_data()->getSizeInBytes1D());
    return r;
}
Esempio n. 18
0
QtEventWorker::
        QtEventWorker (Signal::ComputingEngine::ptr computing_engine, Signal::Processing::ISchedule::ptr schedule, bool wakeuprightaway)
    :
      computing_engine_(computing_engine),
      schedule_(schedule),
      thread_(new QTerminatableThread),
      exception_(new std::exception_ptr()),
      ltf_wakeups_("qteventworker wakeups"),
      ltf_tasks_("qteventworker tasks"),
      active_time_since_start_(0)
{
    EXCEPTION_ASSERTX(QThread::currentThread ()->eventDispatcher (),
                      "Worker uses a QThread with an event loop. The QEventLoop requires QApplication");

    qRegisterMetaType<std::exception_ptr>("std::exception_ptr");
    qRegisterMetaType<Signal::ComputingEngine::ptr>("Signal::ComputingEngine::ptr");

    // Create terminated_exception_
    try {
        // To make caught_exception() non-zero if the thread is terminated even
        // though no exact information about the crash reason is stored. The
        // log file might contain more details.
        BOOST_THROW_EXCEPTION(QtEventWorker::TerminatedException());
    } catch (...) {
        terminated_exception_ = std::current_exception ();
    }

    // Start the worker thread as an event based background thread
    thread_->setParent (this);
    thread_->setObjectName (QString("Worker %1").arg (computing_engine
                            ? vartype(*computing_engine).c_str ()
                            : "(null)"));
    thread_->start (QThread::IdlePriority);
    moveToThread (thread_);

    connect (thread_, SIGNAL(finished()), SLOT(finished()));

    if (wakeuprightaway)
    {
        // Initial check to see if work can begin right away
        wakeup (); // will be dispatched to execute in thread_
    }
}
Esempio n. 19
0
pBuffer SourceBase::
        readFixedLength( const Interval& I )
{
    TIME_SOURCEBASE TaskTimer tt("%s.%s %s",
                  vartype(*this).c_str(), __FUNCTION__ ,
                  I.toString().c_str() );

    // Try a simple read
    pBuffer p = readChecked( I );
    if (I == p->getInterval())
        return p;

    // Didn't get exact result, prepare new Buffer
    pBuffer r( new Buffer(I, p->sample_rate(), p->number_of_channels ()) );

    for (int c=0; c<r->number_of_channels (); ++c)
    {
    #ifndef USE_CUDA
        // Allocate cpu memory and prevent calling an unnecessary clear by flagging the store as up-to-date
        CpuMemoryStorage::WriteAll<3>( r->getChannel (c)->waveform_data() );
    #else
        if (p->getChannel (c)->waveform_data()->HasValidContent<CudaGlobalStorage>())
            CudaGlobalStorage::WriteAll<3>( r->getChannel (c)->waveform_data() );
        else
            CpuMemoryStorage::WriteAll<3>( r->getChannel (c)->waveform_data() );
    #endif
    }

    Intervals sid(I);

    while (sid)
    {
        if (!p)
            p = readChecked( sid.fetchFirstInterval() );

        sid -= p->getInterval();
        TIME_SOURCEBASE_LINE((*r) |= *p); // Fill buffer
        p.reset();
    }

    return r;
}
Esempio n. 20
0
 /* tipos de variáveis: 
  *
  *           vartype ->  ARRAY \[ range {; range} \] OF vartype
  *                       | INTEGER
  *                       | REAL
  *                       | DOUBLE
  *                       | BOOLEAN
  *                       | STRING [ \[ INTCTE \] ]
  *                       | CHAR
  */
void
vartype (void)
{
  int i;
  switch (lookahead)
    {
    case ARRAY://array
      match (ARRAY);
      match ('[');
      range ();
      while (lookahead == ',')
	{
	  match (',');
	  range ();
	}
      match (']');
      match (OF);
      vartype ();
      break;
    case STRING://string
      match (STRING);
      if (lookahead == '[')
	{
	  match ('[');
	  match (INTCTE);
	  match (']');
	}
      break;
    case INTEGER://inteiro
    case REAL://real
    case DOUBLE://double real
    case BOOLEAN://booleano
    case CHAR://char
      for (i = firstentry; i < symtab_nextentry; i++)
	{
	  symtab[i].objtype = SMPLVAR;
	  symtab[i].valtype = lookahead;
	}
      match (lookahead);
    }
}
Esempio n. 21
0
QtEventWorkerFactory::
        ~QtEventWorkerFactory()
{
    try {
        notifier_->quit_and_wait ();

        //terminate_workers ();
    } catch (const std::exception& x) {
        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("\nQtEventWorkers::~QtEventWorkers destructor swallowed exception: %s\n"
                                  "%s\n\n")
                    % vartype(x) % boost::diagnostic_information(x)).c_str());
        fflush(stderr);
    } catch (...) {
        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("\nQtEventWorkers::~QtEventWorkers destructor swallowed a non std::exception\n"
                                  "%s\n\n")
                    % boost::current_exception_diagnostic_information ()).c_str());
        fflush(stderr);
    }
}
Esempio n. 22
0
void WaveformBlockFilterDesc::
        test()
{
    // It should instantiate CwtBlockFilter for different engines.
    {
        Heightmap::MergeChunkDesc::ptr mcd(new WaveformBlockFilterDesc);
        MergeChunk::ptr mc = mcd.read ()->createMergeChunk (0);

        EXCEPTION_ASSERT( !mc );

        Signal::ComputingCpu cpu;
        mc = mcd.read ()->createMergeChunk (&cpu);
        EXCEPTION_ASSERT( mc );
        EXCEPTION_ASSERT_EQUALS( vartype(*mc.get ()), "Heightmap::TfrMappings::WaveformBlockFilter" );

        Signal::ComputingCuda cuda;
        mc = mcd.read ()->createMergeChunk (&cuda);
        EXCEPTION_ASSERT( !mc );

        Signal::ComputingOpenCL opencl;
        mc = mcd.read ()->createMergeChunk (&opencl);
        EXCEPTION_ASSERT( !mc );
    }
}
Esempio n. 23
0
void WorkerCrashLogger::
        worker_quit(std::exception_ptr e, Signal::ComputingEngine::ptr ce)
{
    DEBUG TaskInfo ti(boost::format("WorkerCrashLogger::worker_quit %s") % (e?"normally":"with exception"));
    if (consume_exceptions_)
      {
        workers_.write ()->removeComputingEngine(ce);
      }

    try
      {
        if (e)
          {
            rethrow_exception(e);
          }

      }
    catch ( const boost::exception& x)
      {
        x << Workers::crashed_engine(ce) << Workers::crashed_engine_typename(ce?vartype(*ce):"(null)");

        log(x);
      }
}
Esempio n. 24
0
void GraphicsView::timerEvent(QTimerEvent *e){
    DEBUG_EVENTS TaskTimer tt("GraphicsView timerEvent %s %d", vartype(*e).c_str(), e->isAccepted());
    QGraphicsView::timerEvent(e);
    DEBUG_EVENTS TaskTimer("GraphicsView timerEvent %s info %d", vartype(*e).c_str(), e->isAccepted()).suppressTiming();
}
Esempio n. 25
0
int UnitTest::
        test(bool rethrow_exceptions)
{
    try {
        Timer(); // Init performance counting
        TaskTimer tt("Running tests");

        RUNTEST(DataStorageString);
        RUNTEST(Factor);
        RUNTEST(GeometricAlgebra);
        RUNTEST(GlFrameBuffer);
        RUNTEST(glinfo);
        RUNTEST(glProjection);
#ifdef LEGACY_OPENGL
        RUNTEST(GlSyncObjectMutex);
#endif
        RUNTEST(GlTextureRead);
        RUNTEST(neat_math);
        RUNTEST(ResampleTexture);
        RUNTEST(Float16Compressor);

    } catch (const ExceptionAssert& x) {
        if (rethrow_exceptions)
            throw;

        char const * const * f = boost::get_error_info<boost::throw_file>(x);
        int const * l = boost::get_error_info<boost::throw_line>(x);
        char const * const * c = boost::get_error_info<ExceptionAssert::ExceptionAssert_condition>(x);
        std::string const * m = boost::get_error_info<ExceptionAssert::ExceptionAssert_message>(x);

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s:%d: %s. %s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % (f?*f:0) % (l?*l:-1) % (c?*c:0) % (m?*m:0) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (const exception& x) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % vartype(x) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (...) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("Not an std::exception\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % boost::current_exception_diagnostic_information () % lastname ).c_str());
        fflush(stderr);
        return 1;
    }

    printf("\n OK\n\n");
    return 0;
}
Esempio n. 26
0
/*retorno: rettype -> vartype */
void
rettype (void)
{
  vartype ();
}
Esempio n. 27
0
int UnitTest::
        test(bool rethrow_exceptions)
{
    try {
        Timer(); // Init performance counting
        TaskTimer tt("Running tests");

        RUNTEST(Heightmap::TfrMapping);
        RUNTEST(Heightmap::Update::UpdateProducer);
        RUNTEST(Heightmap::Update::UpdateProducerDesc);
        RUNTEST(Heightmap::TfrMappings::StftBlockFilter);
        RUNTEST(Heightmap::TfrMappings::StftBlockFilterDesc);
        RUNTEST(Heightmap::TfrMappings::CwtBlockFilter);
        RUNTEST(Heightmap::TfrMappings::CwtBlockFilterDesc);
        RUNTEST(Heightmap::TfrMappings::WaveformBlockFilter);
        RUNTEST(Heightmap::TfrMappings::WaveformBlockFilterDesc);
        RUNTEST(Heightmap::TfrMappings::CepstrumBlockFilter);
        RUNTEST(Heightmap::TfrMappings::CepstrumBlockFilterDesc);

    } catch (const ExceptionAssert& x) {
        if (rethrow_exceptions)
            throw;

        char const * const * f = boost::get_error_info<boost::throw_file>(x);
        int const * l = boost::get_error_info<boost::throw_line>(x);
        char const * const * c = boost::get_error_info<ExceptionAssert::ExceptionAssert_condition>(x);
        std::string const * m = boost::get_error_info<ExceptionAssert::ExceptionAssert_message>(x);

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s:%d: %s. %s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % (f?*f:0) % (l?*l:-1) % (c?*c:0) % (m?*m:0) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (const exception& x) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % vartype(x) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (...) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("Not an std::exception\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % boost::current_exception_diagnostic_information () % lastname ).c_str());
        fflush(stderr);
        return 1;
    }

    printf("\n OK\n\n");
    return 0;
}
Esempio n. 28
0
string DummyTransformDesc::
        toString() const
{
    return vartype(*this);
}
Esempio n. 29
0
std::string ChangeToolCommand::
        toString()
{
    return newTool ? vartype(*newTool) : "No tool in " + vartype(*selector->parentTool());
}
Esempio n. 30
0
int UnitTest::
        test(bool rethrow_exceptions)
{
    try {
        Timer(); // Init performance counting
        TaskTimer tt("Running tests");

        RUNTEST(Backtrace);
        RUNTEST(ExceptionAssert);
        RUNTEST(PrettifySegfault);
        RUNTEST(Timer);
        RUNTEST(shared_state_test);
        RUNTEST(VerifyExecutionTime);
        RUNTEST(spinning_barrier);
        RUNTEST(locking_barrier);
        RUNTEST(shared_state_traits_backtrace);

    } catch (const ExceptionAssert& x) {
        if (rethrow_exceptions)
            throw;

        char const * const * f = boost::get_error_info<boost::throw_file>(x);
        int const * l = boost::get_error_info<boost::throw_line>(x);
        char const * const * c = boost::get_error_info<ExceptionAssert::ExceptionAssert_condition>(x);
        std::string const * m = boost::get_error_info<ExceptionAssert::ExceptionAssert_message>(x);

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s:%d: %s. %s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % (f?*f:0) % (l?*l:-1) % (c?*c:0) % (m?*m:0) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (const exception& x) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % vartype(x) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (...) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("Not an std::exception\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % boost::current_exception_diagnostic_information () % lastname ).c_str());
        fflush(stderr);
        return 1;
    }

    printf("\n OK\n\n");
    return 0;
}