diff --git a/net.hoc b/net.hoc index 5dd5de9..0aa2952 100644 --- a/net.hoc +++ b/net.hoc @@ -54,7 +54,7 @@ lam[0].ampalist(tmplist) connmap(mat,inplist,tmplist) lam[0].gabalist(tmplist) for lvtr(XO,&x,tmplist,inhv) { - XO.setlink(ininhp.link) + XO.setlink(ininhp.link, ininhp.nsyn, ininhp.maxsyn) XO.gmax(-1,-x) } diff --git a/presyn.inc b/presyn.inc index 41db209..9213735 100644 --- a/presyn.inc +++ b/presyn.inc @@ -21,8 +21,6 @@ CONSTRUCTOR { /* link allows postsyn cell to manipulate presyn list */ link = (double)((unsigned long)hoc_Ecalloc(1, sizeof(PreL))); hoc_malchk(); PRECAST->link2 = link; /* this can be queried to protect against error */ - PRECAST->nnpre = &nsyn; - PRECAST->mxpre = &maxsyn; nsyn = 0.; maxsyn = 0.; if (ifarg(2)) { diff --git a/proc.hoc b/proc.hoc index c5b363d..b569b8a 100644 --- a/proc.hoc +++ b/proc.hoc @@ -91,7 +91,7 @@ proc connmap () { local ii,jj,isz,osz,num if (num<0) { printf("CONNMAP ERROR: gmax must not be <0.: %d %d %g.\n",ii,jj,num) return } - XO.setlink(YO.link) + XO.setlink(YO.link, YO.nsyn, YO.maxsyn) XO.gmax(-1,num) } jj=jj+1 diff --git a/snsarr.inc b/snsarr.inc index 65116ac..9c5840d 100644 --- a/snsarr.inc +++ b/snsarr.inc @@ -114,9 +114,9 @@ PROCEDURE init_arrays(num) { } VERBATIM -static void hshake(SynS* ss, PreL* pl, int flag); +static void hshake(SynS* ss, PreL* pl, int flag, double* p_nsyn, double* p_maxsyn); ENDVERBATIM -: 2 arguments - index, presyn link +: 3 arguments - presyn link, presyn nsyn, presyn maxsyn PROCEDURE setlink() { VERBATIM { int ii, x, is_new; @@ -124,13 +124,10 @@ VERBATIM { double ptemp; PreL *ppsyn; - if (ifarg(2)) { - x = (int)*getarg(1); - ptemp = *getarg(2); /* pick up pointer */ - } else { - x = nsyn; - ptemp = *getarg(1); - } + x = nsyn; + ptemp = *getarg(1); + double* p_nsyn = getarg(2); + double* p_maxsyn = getarg(3); if (x >= maxsyn) { init_arrays(maxsyn+POSTINC); /* #DEFINE POSTINC 5 */ @@ -156,7 +153,7 @@ VERBATIM { is_new = 0; } - hshake(sns,ppsyn,is_new); + hshake(sns, ppsyn, is_new, p_nsyn, p_maxsyn); x *= (int)CHAINLEN; for (ii=x;ii < x + CHAINLEN;ii++) { @@ -179,16 +176,10 @@ ENDVERBATIM : manipulate the presynaptic list remotely VERBATIM -static void hshake(SynS* ss, PreL* pl, int flag) { +static void hshake(SynS* ss, PreL* pl, int flag, double* nn, double* mx) { /* ls will be a pointer to presyn cell's array of pointers */ /* flag == 1 if this is a brand new entry */ int ii; - double *nn; - double *mx; - - nn = pl->nnpre; /* pointer to presyn npre */ - mx = pl->mxpre; /* pointer to presyn maxpre */ - /* erase presyn pointer if this has been set before */ if (flag == 0) { /* an old entry */ /* fall out of loop if a pointer exists already */ diff --git a/snscode.hoc b/snscode.hoc index 0f8b588..42e254c 100644 --- a/snscode.hoc +++ b/snscode.hoc @@ -338,7 +338,7 @@ begintemplate POSTSYN } for k=0,mech_num-1 { // post, pre, listcnt, syncnt, mechcnt, precnt - mech[k].setlink($o1.object(rannum).link) + mech[k].setlink($o1.object(rannum).link, $o1.object(rannum).nsyn, $o1.object(rannum).maxsyn) if (setall) { mech[k].delay(-1,delay) // set most recent (index nsyn-1) mech[k].gmax(-1,gmax) diff --git a/snshead.inc b/snshead.inc index 92a01a0..59c0e76 100644 --- a/snshead.inc +++ b/snshead.inc @@ -51,8 +51,6 @@ typedef struct SynS { /* postsynaptic structure */ typedef struct PreL { int cpre; /* user code for info about presyn cell */ struct SynS **plst; /* will point to post for postsyn nrn*/ - double *nnpre; /* number of pointers currently there */ - double *mxpre; /* number permitted before realloc required */ double link2; /* a copy of the link information to confirm correct hook up */ } PreL;