Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/compiler/target-cpu/fragments/c-wrappers.in
ViewVC logotype

View of /branches/vis15/src/compiler/target-cpu/fragments/c-wrappers.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4631 - (download) (annotate)
Sun Sep 25 00:15:30 2016 UTC (2 years, 9 months ago) by jhr
File size: 3170 byte(s)
  Working on merge: bug fixes
extern "C" uint32_t @PREFIX@_num_strands (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
#if defined(DIDEROT_TARGET_SEQUENTIAL)
    return w->_strands.num_alive();
#elif defined(DIDEROT_TARGET_PARALLEL)
#endif
}

extern "C" uint32_t @PREFIX@_num_active_strands (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
#if defined(DIDEROT_TARGET_SEQUENTIAL)
    return w->_strands.num_active();
#elif defined(DIDEROT_TARGET_PARALLEL)
#endif
}

extern "C" uint32_t @PREFIX@_num_stable_strands (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
#if defined(DIDEROT_TARGET_SEQUENTIAL)
    return w->_strands.num_stable();
#elif defined(DIDEROT_TARGET_PARALLEL)
#endif
}

extern "C" @BOOLTY@ @PREFIX@_any_errors (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    return (w->_errors->errNum > 0);
}

extern "C" char *@PREFIX@_get_errors (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    char *msg = biffMsgStrGet (w->_errors);
    biffMsgClear (w->_errors);
    return msg;
}

extern "C" @PREFIX@_world_t *@PREFIX@_new_world ()
{
    @PREFIX@::world *w = new (std::nothrow) @PREFIX@::world();
#ifndef DIDEROT_NO_INPUTS
    if (w != nullptr) {
        init_defined_inputs (w);
        init_defaults (w->_globals);
    }
#endif
    return reinterpret_cast<@PREFIX@_world_t *>(w);
}

extern "C" @BOOLTY@ @PREFIX@_init_world (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
#ifndef DIDEROT_NO_INPUTS
    if (check_defined(w)) {
        return true;
    }
#endif
    return static_cast<@BOOLTY@>(w->init());
}

extern "C" @BOOLTY@ @PREFIX@_create_strands (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    return static_cast<@BOOLTY@>(w->create_strands());
}

extern "C" uint32_t @PREFIX@_run (@PREFIX@_world_t *wrld, uint32_t maxNSteps)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    return w->run(maxNSteps);
}

extern "C" void @PREFIX@_shutdown (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    delete w;
}

extern "C" void @PREFIX@_set_verbose (@PREFIX@_world_t *wrld, @BOOLTY@ mode)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    w->_verbose = (mode ? true : false);
}

extern "C" @BOOLTY@ @PREFIX@_get_verbose (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    return static_cast<@BOOLTY@>(w->_verbose);
}

#ifdef DIDEROT_TARGET_PARALLEL

void @PREFIX@_set_num_workers (@PREFIX@_world_t *wrld, uint32_t nw)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    if (nw == 0)
        w->_sched->_numWorkers = w->_sched->_numHWCores;
    else
        w->_sched->_numWorkers = nw;
}

uint32_t @PREFIX@_get_num_workers (@PREFIX@_world_t *wrld)
{
    @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
    return w->_sched->_numWorkers;
}

#endif /* DIDEROT_TARGET_PARALLEL */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0