Previous 199869 Revisions Next

r34639 Tuesday 27th January, 2015 at 00:43:04 UTC by Couriersud
Promote osd_getenv from osdlib.h to osdcore.h. Change return type to
"const char*". Fixes netlist compile.
[src/emu/netlist/analog]nld_ms_gauss_seidel.h
[src/osd]osdcore.h
[src/osd/modules/lib]osdlib.h osdlib_macosx.c osdlib_os2.c osdlib_unix.c osdlib_win32.c
[src/osd/modules/sync]work_osd.c
[src/osd/sdl]sdldir.c sdlfile.c

trunk/src/emu/netlist/analog/nld_ms_gauss_seidel.h
r243150r243151
2121      , m_lp_fact(0)
2222      , m_gs_fail(0)
2323      , m_gs_total(0)
24      {}
24      {
25           const char *p = osd_getenv("NETLIST_STATS");
26           if (p != NULL)
27               m_log_stats = (bool) atoi(p);
28           else
29               m_log_stats = false;
30      }
2531
2632   virtual ~netlist_matrix_solver_gauss_seidel_t() {}
2733
r243150r243151
3541   nl_double m_lp_fact;
3642   int m_gs_fail;
3743   int m_gs_total;
44   bool m_log_stats;
3845
3946};
4047
r243150r243151
4552template <int m_N, int _storage_N>
4653void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
4754{
48#if 1
49    if (this->m_stat_calculations == 0)
50      return;
51   printf("==============================================\n");
52   printf("Solver %s\n", this->name().cstr());
53   printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
54   printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
55   printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
56    printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
57   printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
58            this->m_stat_calculations,
59            this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
60         this->m_gs_fail,
61            100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
62            (double) this->m_gs_total / (double) this->m_stat_calculations);
63#endif
55    if (this->m_stat_calculations != 0 && m_log_stats)
56    {
57        printf("==============================================\n");
58        printf("Solver %s\n", this->name().cstr());
59        printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
60        printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
61        printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
62        printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
63        printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
64                this->m_stat_calculations,
65                this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
66                this->m_gs_fail,
67                100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
68                (double) this->m_gs_total / (double) this->m_stat_calculations);
69    }
6470}
6571
6672template <int m_N, int _storage_N>
trunk/src/osd/modules/lib/osdlib.h
r243150r243151
4747void osd_process_kill(void);
4848
4949/*-----------------------------------------------------------------------------
50    osd_getenv: return pointer to environment variable
51
52    Parameters:
53
54        name  - name of environment variable
55
56    Return value:
57
58        pointer to value
59-----------------------------------------------------------------------------*/
60char *osd_getenv(const char *name);
61
62/*-----------------------------------------------------------------------------
6350    osd_setenv: set environment variable
6451
6552    Parameters:
trunk/src/osd/modules/lib/osdlib_macosx.c
r243150r243151
3232//  osd_getenv
3333//============================================================
3434
35char *osd_getenv(const char *name)
35const char *osd_getenv(const char *name)
3636{
3737    return getenv(name);
3838}
trunk/src/osd/modules/lib/osdlib_os2.c
r243150r243151
2929//  osd_getenv
3030//============================================================
3131
32char *osd_getenv(const char *name)
32const char *osd_getenv(const char *name)
3333{
3434    return getenv(name);
3535}
trunk/src/osd/modules/lib/osdlib_unix.c
r243150r243151
2828//  osd_getenv
2929//============================================================
3030
31char *osd_getenv(const char *name)
31const char *osd_getenv(const char *name)
3232{
3333    return getenv(name);
3434}
trunk/src/osd/modules/lib/osdlib_win32.c
r243150r243151
4747//  osd_getenv
4848//============================================================
4949
50char *osd_getenv(const char *name)
50const char *osd_getenv(const char *name)
5151{
5252    return getenv(name);
5353}
trunk/src/osd/modules/sync/work_osd.c
r243150r243151
173173   osd_work_queue *queue;
174174   int osdthreadnum = 0;
175175   int allocthreadnum;
176   char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
176   const char *osdworkqueuemaxthreads = osd_getenv(ENV_WORKQUEUEMAXTHREADS);
177177
178178   // allocate a new queue
179179   queue = (osd_work_queue *)osd_malloc(sizeof(*queue));
r243150r243151
612612   }
613613   else
614614   {
615      char *procsoverride;
616615      int numprocs = 0;
617616
618617      // if the OSDPROCESSORS environment variable is set, use that value if valid
619618      // note that we permit more than the real number of processors for testing
620      procsoverride = osd_getenv(ENV_PROCESSORS);
619      const char *procsoverride = osd_getenv(ENV_PROCESSORS);
621620      if (procsoverride != NULL && sscanf(procsoverride, "%d", &numprocs) == 1 && numprocs > 0)
622621         return MIN(4 * physprocs, numprocs);
623622
trunk/src/osd/osdcore.h
r243150r243151
196196
197197
198198/*-----------------------------------------------------------------------------
199    osd_getenv: return pointer to environment variable
200
201    Parameters:
202
203        name  - name of environment variable
204
205    Return value:
206
207        pointer to value
208-----------------------------------------------------------------------------*/
209const char *osd_getenv(const char *name);
210
211
212/*-----------------------------------------------------------------------------
199213    osd_get_physical_drive_geometry: if the given path points to a physical
200214        drive, return the geometry of that drive
201215
trunk/src/osd/sdl/sdldir.c
r243150r243151
152152
153153   if (tmpstr[0] == '$')
154154   {
155      char *envval;
155
156156      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
157157
158158      strcpy(envstr, tmpstr);
r243150r243151
165165
166166      envstr[i] = '\0';
167167
168      envval = osd_getenv(&envstr[1]);
168      const char *envval = osd_getenv(&envstr[1]);
169169      if (envval != NULL)
170170      {
171171         j = strlen(envval) + strlen(tmpstr) + 1;
trunk/src/osd/sdl/sdlfile.c
r243150r243151
176176   // does path start with an environment variable?
177177   if (tmpstr[0] == '$')
178178   {
179      char *envval;
180179      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
181180
182181      strcpy(envstr, tmpstr);
r243150r243151
189188
190189      envstr[i] = '\0';
191190
192      envval = osd_getenv(&envstr[1]);
191        const char *envval = osd_getenv(&envstr[1]);
193192      if (envval != NULL)
194193      {
195194         j = strlen(envval) + strlen(tmpstr) + 1;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team