Skip to content

Commit

Permalink
cope with forward declared Prop
Browse files Browse the repository at this point in the history
  • Loading branch information
olupton committed Feb 17, 2023
1 parent 1784968 commit 46c7304
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions intf6.mod
Expand Up @@ -26,8 +26,12 @@ VERBATIM
#include <unistd.h>

#ifdef NRN_MECHANISM_DATA_IS_SOA
#define id0ptr(prop) static_cast<id0*>(prop->dparam[2].get<void*>())
#define get_dparam(prop) _nrn_mechanism_access_dparam(prop)
#define get_type(prop) _nrn_mechanism_get_type(prop)
#define id0ptr(prop) static_cast<id0*>(_nrn_mechanism_access_dparam(prop)[2].get<void*>())
#else
#define get_dparam(prop) prop->dparam
#define get_type(prop) prop->_type
#define id0ptr(prop) (*((id0**)&(prop->dparam[2])))
#endif

Expand Down Expand Up @@ -539,14 +543,14 @@ ENDVERBATIM
if (_lflag==2) ip->flag=-1;
idty=(double)(FOFFSET+ip->id)+1e-2*(double)ip->type+1e-3*(double)ip->inhib+1e-4;
for (i=0;i<ip->dvt && !stoprun;i++) if (ip->sprob[i]) {
(*pnt_receive[ip->dvi[i]->_prop->_type])(ip->dvi[i], wts, idty);
(*pnt_receive[get_type(ip->dvi[i]->_prop)])(ip->dvi[i], wts, idty);
// restore pointers each time
#ifdef NRN_MECHANISM_DATA_IS_SOA
neuron::legacy::set_globals_from_prop(_pnt->_prop, _ml_real, _ml, _iml);
#else
_p=_pnt->_prop->param;
#endif
_ppvar=_pnt->_prop->dparam;
_ppvar = get_dparam(_pnt->_prop);
ip=IDP;
}
return; // else see if destination has been reached
Expand Down Expand Up @@ -1314,14 +1318,14 @@ PROCEDURE callback (fl) {
if(wsetting==1.0 && jp->syw1 && jp->syw2) {wts[2]=jp->syw1[i]; wts[3]=jp->syw2[i]; } // non-MATRIX weights?
idtflg = idty + (1e-5 * jp->syns[i]);
// if(1) printf("s = %g : flg = %.10f\n",(1e-5*jp->syns[i]),idtflg);
if (jp->sprob[i]) (*pnt_receive[jp->dvi[i]->_prop->_type])(jp->dvi[i], wts, idtflg);
if (jp->sprob[i]) (*pnt_receive[get_type(jp->dvi[i]->_prop)])(jp->dvi[i], wts, idtflg);
// restore pointers
#ifdef NRN_MECHANISM_DATA_IS_SOA
neuron::legacy::set_globals_from_prop(upnt->_prop, _ml_real, _ml, _iml);
#else
_p=upnt->_prop->param;
#endif
_ppvar=upnt->_prop->dparam;
_ppvar = get_dparam(upnt->_prop);
i++;
if (i>=jp->dvt) return 0; // ran out
ddel=jp->del[i]-del0; // delays are relative to event; use difference in delays
Expand Down

0 comments on commit 46c7304

Please sign in to comment.