From 99ae597e4214e8d690267a84c319f1893bf6984a Mon Sep 17 00:00:00 2001 From: Fernando Pereira Date: Mon, 16 May 2022 19:24:43 +0200 Subject: [PATCH 1/3] Fix vecst mod for nrn90 compat --- vecst.mod | 56 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/vecst.mod b/vecst.mod index a9e32df..0f94e1f 100644 --- a/vecst.mod +++ b/vecst.mod @@ -80,6 +80,8 @@ VERBATIM /* #include /* contains MAXLONG */ #include /* contains MAXLONG */ #include + +#ifndef NRN_VERSION_GTEQ_8_2_0 extern double* hoc_pgetarg(); extern double hoc_call_func(Symbol*, int narg); extern FILE* hoc_obj_file_arg(int narg); @@ -87,6 +89,7 @@ extern void vector_resize(); extern int vector_instance_px(); extern void* vector_arg(); extern double hoc_epsilon; +#endif ENDVERBATIM :* v1.slope(num) does a linear regression to find the slope, assuming num=timestep of vector @@ -335,7 +338,7 @@ static double fewind(void* vv) { for (j=0;jscrsz) { @@ -379,7 +382,7 @@ static double findx(void* vv) { } for (j=0,i=0;jscrsz) { @@ -542,7 +545,7 @@ VERBATIM static double ird(void* vv) { int i, j, nx, n; double *x; - FILE* f, *hoc_obj_file_arg(); + FILE* f; f = hoc_obj_file_arg(1); nx = vector_instance_px(vv, &x); fread(&n,sizeof(int),1,f); // size @@ -552,9 +555,9 @@ static double ird(void* vv) { scr=(int *)ecalloc(scrsz, sizeof(int)); } if (n!=nx) { - nx=vector_buffer_size(vv); + nx=vector_buffer_size((IvocVect*)vv); if (n<=nx) { - vector_resize(vv, n); nx=n; + vector_resize((IvocVect*)vv, n); nx=n; } else { printf("%d > %d :: ",n,nx); hoc_execerror("Vector max capacity too small for ird ", 0); @@ -573,15 +576,15 @@ static double insct(void* vv) { int i, j, k, nx, nv1, nv2, maxsz; double *x, *v1, *v2; nx = vector_instance_px(vv, &x); - maxsz=vector_buffer_size(vv); - vector_resize(vv, maxsz); + maxsz=vector_buffer_size((IvocVect*)vv); + vector_resize((IvocVect*)vv, maxsz); nv1 = vector_arg_px(1, &v1); nv2 = vector_arg_px(2, &v2); for (i=0,k=0;imaxsz) { printf("\tinsct WARNING: ran out of room: %d<%d\n",maxsz,k); - } else { vector_resize(vv, k); } + } else { vector_resize((IvocVect*)vv, k); } return (double)k; } ENDVERBATIM @@ -593,8 +596,8 @@ static double cull(void* vv) { int i, j, k, nx, nv1, nv2, maxsz, flag; double *x, *v1, *v2; nx = vector_instance_px(vv, &x); - maxsz=vector_buffer_size(vv); - vector_resize(vv, maxsz); + maxsz=vector_buffer_size((IvocVect*)vv); + vector_resize((IvocVect*)vv, maxsz); nv1 = vector_arg_px(1, &v1); nv2 = vector_arg_px(2, &v2); for (i=0,k=0;imaxsz) { printf("\tcull WARNING: ran out of room: %d<%d\n",maxsz,k); - } else { vector_resize(vv, k); } + } else { vector_resize((IvocVect*)vv, k); } return (double)k; } ENDVERBATIM @@ -617,14 +620,14 @@ static double redundout(void* vv) { double *x, *v1, val; if (ifarg(2)) indflag=1; else indflag=0; nx = vector_instance_px(vv, &x); - maxsz=vector_buffer_size(vv); - vector_resize(vv, maxsz); + maxsz=vector_buffer_size((IvocVect*)vv); + vector_resize((IvocVect*)vv, maxsz); nv1 = vector_arg_px(1, &v1); val=v1[0]; x[0]=(indflag?0:val); for (j=1,i=1;i0 && kth) { /* ? passing thresh */ @@ -987,7 +993,7 @@ static double xing(void* vv) { if (f==1) { f=0; } /* just passed going down */ } } - vector_resize(vv, j); + vector_resize((IvocVect*)vv, j); return (double)i; } ENDVERBATIM @@ -1180,9 +1186,9 @@ static double smgs(void* vv) { points = (int)((high-low)/step+hoc_epsilon); if (nsum!=points) { - maxsz=vector_buffer_size(vv); + maxsz=vector_buffer_size((IvocVect*)vv); if (points<=maxsz) { - vector_resize(vv, nsum); nsum=points; + vector_resize((IvocVect*)vv, nsum); nsum=points; } else { printf("%d > %d :: ",points,maxsz); hoc_execerror("Vector max capacity too small in smgs ", 0); From f5a98fb4de7708fcb8787076594179f01e1fa5f3 Mon Sep 17 00:00:00 2001 From: Pramod S Kumbhar Date: Wed, 18 May 2022 12:26:49 +0200 Subject: [PATCH 2/3] other mod file changes for successfull compilation --- pointer.inc | 2 +- ppsav.inc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pointer.inc b/pointer.inc index 7bfe0d3..36c4f6d 100644 --- a/pointer.inc +++ b/pointer.inc @@ -15,7 +15,7 @@ ASSIGNED { PROCEDURE setptr() { VERBATIM - { extern Object** hoc_objgetarg(); + { extern Object** hoc_objgetarg(int); p = (double)(unsigned long)*hoc_objgetarg(1); } ENDVERBATIM diff --git a/ppsav.inc b/ppsav.inc index ac43c9c..dbb5b04 100644 --- a/ppsav.inc +++ b/ppsav.inc @@ -36,7 +36,7 @@ extern double* vector_vec(); extern int vector_capacity(); extern void* vector_arg(); extern double* hoc_pgetarg(); -extern Object** hoc_objgetarg(); +extern Object** hoc_objgetarg(int); extern char* hoc_object_name(Object*); double *a1, *a2, *a3; Object *tvec, *tmpvec; @@ -46,7 +46,7 @@ ENDVERBATIM PROCEDURE recval () { VERBATIM { void* vv; int i, size; double* px; - if (savnum==0) { return; } + if (savnum==0) { return 0; } vv = *((void**)(&space0)); if (! vv) { hoc_execerror("ERR: no time vector defined for PP::recval.\n",0); } @@ -85,7 +85,7 @@ VERBATIM { void** vv; - if (! ifarg(1)) { savnum=0; return; + if (! ifarg(1)) { savnum=0; return 0; } if (ifarg(3)) { /* nice place to save time */ From 1dded181f470e545074a8e6e0b4a3d188ef3abc9 Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Fri, 20 May 2022 17:09:46 +0200 Subject: [PATCH 3/3] Cleanup for merge. --- README | 7 ++++++- matrix.mod | 7 ++++++- pointer.inc | 8 +++++++- ppsav.inc | 2 ++ vecst.mod | 5 ++--- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/README b/README index a527c68..d4976e0 100644 --- a/README +++ b/README @@ -19,6 +19,9 @@ III mswin pc. target simulation shown in jnsci18_6444F6B.jpg +Changelog +--------- + 20120112 cad.mod and gababS.mod updated to use derivimplicit and cnexp in place of euler and cadecay.mod switched to derivimplicit as per http://www.neuron.yale.edu/phpbb/viewtopic.php?f=28&t=592 @@ -29,4 +32,6 @@ be called with the same number of arguments with which the function is declared. A net_send() call had a flag parameter added to it to satisfy this. The results of the auto-launch demo simulation are unchanged. - \ No newline at end of file + +20220520: Updated MOD files to contain valid C++ and be compatible with + the upcoming versions 8.2 and 9.0 of NEURON. diff --git a/matrix.mod b/matrix.mod index fc3a0f3..b62b939 100644 --- a/matrix.mod +++ b/matrix.mod @@ -34,6 +34,12 @@ PARAMETER { MATRIX_INSTALLED=0 } +VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 +extern double hoc_call_func(Symbol*, int narg); +#endif +ENDVERBATIM + :* mat.outprod(x,y) // mat = outer product of vectors x and y VERBATIM static double outprod(void* vv) { @@ -84,7 +90,6 @@ VERBATIM static double spltp(void* vv) { int ii, jj, nstpr, nstpo, nw, npr, npo, flag, cnt; double *stpr, *stpo, *w, *pr, *po; - extern double hoc_call_func(Symbol*, int narg); char func[4] = "ltp"; Symbol* s = hoc_lookup(func); diff --git a/pointer.inc b/pointer.inc index 36c4f6d..db6cc19 100644 --- a/pointer.inc +++ b/pointer.inc @@ -13,9 +13,15 @@ ASSIGNED { p } +VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 +extern Object** hoc_objgetarg(int); +#endif +ENDVERBATIM + PROCEDURE setptr() { VERBATIM - { extern Object** hoc_objgetarg(int); + { p = (double)(unsigned long)*hoc_objgetarg(1); } ENDVERBATIM diff --git a/ppsav.inc b/ppsav.inc index dbb5b04..be840bc 100644 --- a/ppsav.inc +++ b/ppsav.inc @@ -32,12 +32,14 @@ ASSIGNED { } VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 extern double* vector_vec(); extern int vector_capacity(); extern void* vector_arg(); extern double* hoc_pgetarg(); extern Object** hoc_objgetarg(int); extern char* hoc_object_name(Object*); +#endif double *a1, *a2, *a3; Object *tvec, *tmpvec; char str[100]; diff --git a/vecst.mod b/vecst.mod index 0f94e1f..59a04f3 100644 --- a/vecst.mod +++ b/vecst.mod @@ -77,7 +77,6 @@ ASSIGNED { RES } VERBATIM #include #include -/* #include /* contains MAXLONG */ #include /* contains MAXLONG */ #include @@ -471,7 +470,7 @@ static double slct(void* vv) { int i, j, k, m, n, ni, nk, na, nv[10], num, fl; double *ind, *key, *arg, *vvo[10]; ni = vector_instance_px(vv, &ind); // vv is ind - for (i=0;ifarg(i);i++); i--; // drop back by one to get numarg() + for (i=0;ifarg(i);i++) {} i--; // drop back by one to get numarg() if (i>12) hoc_execerror("ERR: vecst::slct can only handle 10 vectors", 0); num = i-2; /* number of vectors to be picked apart */ for (i=0;i10) hoc_execerror("ERR: keyind can only handle 9 vectors", 0); num = i-1; /* number of vectors to be picked apart */ for (i=0;i