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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4238, Wed Jul 20 18:19:17 2016 UTC revision 4239, Wed Jul 20 18:19:49 2016 UTC
# Line 1  Line 1 
1  // C wrapper for run method  extern "C" uint32_t @PREFIX@_num_strands (@PREFIX@_world_t *wrld)
 extern "C" uint32_t @PREFIX@run (@PREFIX@world_t *wrld, uint32_t max_nsteps)  
2  {  {
3      wrld->run (max_nsteps);      @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
4    #if defined(DIDEROT_TARGET_SEQUENTIAL)
5        return w->_nstable + w->_nactive;
6    #elif defined(DIDEROT_TARGET_PARALLEL)
7    #endif
8  }  }
9    
10    extern "C" uint32_t @PREFIX@_num_active_strands (@PREFIX@_world_t *wrld)
11    {
12        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
13    #if defined(DIDEROT_TARGET_SEQUENTIAL)
14        return w->_nactive;
15    #elif defined(DIDEROT_TARGET_PARALLEL)
16    #endif
17    }
18    
19    extern "C" uint32_t @PREFIX@_num_stable_strands (@PREFIX@_world_t *wrld)
20    {
21        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
22    #if defined(DIDEROT_TARGET_SEQUENTIAL)
23        return w->_nstable;
24    #elif defined(DIDEROT_TARGET_PARALLEL)
25    #endif
26    }
27    
28    extern "C" @BOOLTY@ @PREFIX@_any_errors (@PREFIX@_world_t *wrld)
29    {
30        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
31        return (w->_errors->errNum > 0);
32    }
33    
34    extern "C" char *@PREFIX@_get_errors (@PREFIX@_world_t *wrld)
35    {
36        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
37        char *msg = biffMsgStrGet (w->_errors);
38        biffMsgClear (w->_errors);
39        return msg;
40    }
41    
42    extern "C" @PREFIX@_world_t *@PREFIX@_new_world ()
43    {
44        @PREFIX@::world *w = new @PREFIX@::world();
45        return reinterpret_cast<@PREFIX@_world_t *>(w);
46    }
47    
48    extern "C" @BOOLTY@ @PREFIX@_init_world (@PREFIX@_world_t *wrld)
49    {
50        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
51        return static_cast<@BOOLTY@>(w->init());
52    }
53    
54    extern "C" @BOOLTY@ @PREFIX@_initially (@PREFIX@_world_t *wrld)
55    {
56        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
57        return static_cast<@BOOLTY@>(w->initially());
58    }
59    
60    extern "C" uint32_t @PREFIX@_run (@PREFIX@_world_t *wrld, uint32_t maxNSteps)
61    {
62        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
63        return w->run(maxNSteps);
64    }
65    
66    extern "C" void @PREFIX@_shutdown (@PREFIX@_world_t *wrld)
67    {
68        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
69        delete w;
70    }
71    
72    extern "C" void @PREFIX@_set_verbose (@PREFIX@_world_t *wrld, @BOOLTY@ mode)
73    {
74        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
75        w->_verbose = (mode ? true : false);
76    }
77    
78    extern "C" @BOOLTY@ @PREFIX@_get_verbose (@PREFIX@_world_t *wrld)
79    {
80        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
81        return static_cast<@BOOLTY@>(w->_verbose);
82    }
83    
84    #ifdef DIDEROT_TARGET_PARALLEL
85    
86    void @PREFIX@_set_num_workers (@PREFIX@_world_t *wrld, uint32_t nw)
87    {
88        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
89        if (nw == 0)
90            w->sched->numWorkers = w->sched->cpuInfo.numHWCores;
91        else
92            w->sched->numWorkers = nw;
93    }
94    
95    uint32_t @PREFIX@_get_num_workers (@PREFIX@_world_t *wrld)
96    {
97        @PREFIX@::world *w = reinterpret_cast<@PREFIX@::world *>(wrld);
98        return w->sched->numWorkers;
99    }
100    
101    #endif /* DIDEROT_TARGET_PARALLEL */

Legend:
Removed from v.4238  
changed lines
  Added in v.4239

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