Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not store pointers to RANGE variable values #4

Merged
merged 1 commit into from Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions README
Expand Up @@ -46,3 +46,5 @@ Changelog
(see https://github.com/ModelDBRepository/12631/pull/3 )
passiv.mod: drop INDEPENDENT block for v
Required for upcoming NEURON 9.0.0
2023-04: Do not store pointers to RANGE variables.
Required for upcoming NEURON 9.0.0.
6 changes: 3 additions & 3 deletions network.hoc
Expand Up @@ -105,9 +105,9 @@ for ii=0,cols-1 { // go through the columns
col[ii].re[jj].inhib.conn(tmplist,conv,-1) // -1 maxdiv means ignore maxdiv
}
//*** stimulation to re cells
col[ii].re[jj].ampa.setlink(pg[0].link)
col[ii].re[jj].gabaa.setlink(pg[0].link)
col[ii].re[jj].inj.setlink(pg[0].link)
col[ii].re[jj].ampa.setlink(pg[0].link, pg[0].nsyn, pg[0].maxsyn)
col[ii].re[jj].gabaa.setlink(pg[0].link, pg[0].nsyn, pg[0].maxsyn)
col[ii].re[jj].inj.setlink(pg[0].link, pg[0].nsyn, pg[0].maxsyn)
}
}

Expand Down
2 changes: 0 additions & 2 deletions presyn.inc
Expand Up @@ -21,8 +21,6 @@ CONSTRUCTOR {
/* link allows postsyn cell to manipulate presyn list */
link = (double)((unsigned long)ecalloc(1, sizeof(PreL)));
PRECAST->link2 = link; /* this can be queried to protect against error */
PRECAST->nnpre = &nsyn;
PRECAST->mxpre = &maxsyn;
nsyn = 0.;
maxsyn = 0.;
if (ifarg(2)) {
Expand Down
25 changes: 8 additions & 17 deletions snsarr.inc
Expand Up @@ -114,23 +114,20 @@ PROCEDURE init_arrays(num) {
}

VERBATIM
static void hshake(SynS*, PreL*, int);
static void hshake(SynS*, PreL*, int, double*, double*);
ENDVERBATIM
: 2 arguments - index, presyn link
: 3 arguments - presyn link, presyn nsyn, presyn maxsyn
PROCEDURE setlink() {
VERBATIM {
int ii, x, new_;
SynS *sns;
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 */
Expand All @@ -156,7 +153,7 @@ VERBATIM {
new_ = 0;
}

hshake(sns,ppsyn,new_);
hshake(sns, ppsyn, new_, p_nsyn, p_maxsyn);

x *= (int)CHAINLEN;
for (ii=x;ii < x + CHAINLEN;ii++) {
Expand All @@ -181,15 +178,9 @@ ENDVERBATIM
VERBATIM
/* ls will be a pointer to presyn cell's array of pointers */
/* flag == 1 if this is a brand new entry */
static void hshake(SynS* ss, PreL* pl, int flag)
static void hshake(SynS* ss, PreL* pl, int flag, double* nn, double* mx)
{
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 */
Expand Down
2 changes: 1 addition & 1 deletion snscode.hoc
Expand Up @@ -382,7 +382,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)
Expand Down
2 changes: 0 additions & 2 deletions snshead.inc
Expand Up @@ -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;

Expand Down