From 46c73040e264b0225afc4c865fe55f8f46afc6bf Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Fri, 17 Feb 2023 16:55:18 +0100 Subject: [PATCH] cope with forward declared Prop --- intf6.mod | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/intf6.mod b/intf6.mod index 49372a4..5bf1bb1 100644 --- a/intf6.mod +++ b/intf6.mod @@ -26,8 +26,12 @@ VERBATIM #include #ifdef NRN_MECHANISM_DATA_IS_SOA -#define id0ptr(prop) static_cast(prop->dparam[2].get()) +#define get_dparam(prop) _nrn_mechanism_access_dparam(prop) +#define get_type(prop) _nrn_mechanism_get_type(prop) +#define id0ptr(prop) static_cast(_nrn_mechanism_access_dparam(prop)[2].get()) #else +#define get_dparam(prop) prop->dparam +#define get_type(prop) prop->_type #define id0ptr(prop) (*((id0**)&(prop->dparam[2]))) #endif @@ -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;idvt && !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 @@ -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