diff --git a/intf_.mod b/intf_.mod index a0d8d28..a6e8f8c 100644 --- a/intf_.mod +++ b/intf_.mod @@ -19,7 +19,6 @@ ENDCOMMENT VERBATIM extern void* vector_arg(); extern FILE* hoc_obj_file_arg(int narg); -extern int list_vector_px(Object *ob, int i, double** px); extern int list_vector_px2 (Object *ob, int i, double** px, void** vv); extern Object** hoc_objgetarg(); extern int ivoc_list_count(Object*); @@ -184,7 +183,7 @@ CONSTRUCTOR { if (ifarg(1)) { lid=(int) *getarg(1); } else { lid= UINT_MAX; } if (ifarg(2)) { lty=(int) *getarg(2); } else { lty= -1; } if (ifarg(3)) { lco=(int) *getarg(3); } else { lco= -1; } - _p_sop = (void*)ecalloc(1, sizeof(id0)); + _p_sop = (double*)ecalloc(1, sizeof(id0)); ip = IDP; ip->id=lid; ip->type=lty; ip->col=lco; ip->invl0 = ip->record = ip->jitter = ip->input = 0; // all flags off @@ -541,7 +540,7 @@ PROCEDURE vers () { :** val(t,tstart) fills global vii[] to pass values back to record() (called from record()) VERBATIM -double val (double xx, double ta) { +void val(double xx, double ta) { vii[1]=VAM*EXP(-(xx - ta)/tauAM); vii[2]=VNM*EXP(-(xx - ta)/tauNM); vii[3]=VGA*EXP(-(xx - ta)/tauGA); @@ -557,7 +556,7 @@ ENDVERBATIM :** valps(t,tstart) like val but builds voltages for pop spike VERBATIM -double valps (double xx, double ta) { +void valps(double xx, double ta) { vii[1]=VAM*EXP(-(xx - ta)/tauAM); vii[2]=VNM*EXP(-(xx - ta)/tauNM); vii[3]=VGA*EXP(-(xx - ta)/tauGA); @@ -572,11 +571,14 @@ PROCEDURE record () { VERBATIM { int k; double ti; vp = SOP; - if (tg>=t) return; - if (vp->p >= vp->size) { if (errflag) return; + if (tg>=t) return 0; + if (vp->p >= vp->size) { + if (errflag) return 0; printf("**** WARNING out of recording room for INTF type%d id%d at %g****\n",IDP->type,IDP->id,t); printf("**************** WARNING: No further WARNINGS ****************\n"); - errflag=1; return; } + errflag=1; + return 0; + } for (ti=tg;ti<=t && vp->p < vp->size;ti+=vdt,vp->p++) { val(ti,tg); vp->vvo[0][vp->p]=ti; @@ -594,7 +596,9 @@ PROCEDURE recspk (x) { VERBATIM { int k; vp = SOP; record(); - if (vp->p >= vp->size || vp->vvo[6]==0) return; + if (vp->p >= vp->size || vp->vvo[6]==0) { + return 0; + } vp->vvo[0][vp->p-1]=_lx; vp->vvo[6][vp->p-1]=spkht; // the spike tg=_lx; @@ -677,11 +681,11 @@ PROCEDURE trvsp () { VERBATIM int i, flag; - double ind, t0; + double ind, t0_local; ip=IDP; flag=(int) *getarg(1); if (subsvint==0.) {printf("trvsp"); return(0.);} - ind=isp[0]; t0=vsp[0]; + ind=isp[0]; t0_local=vsp[0]; if (flag==1) { for (i=0; i0 && k+j=t) { return; + } else if (twg>=t) { + return 0; } else { for (ti=twg,k=(int)floor((twg-rebeg)/vdt+0.5);ti<=t && k #include #include +#ifndef NRN_VERSION_GTEQ_8_2_0 +extern FILE* hoc_obj_file_arg(int narg); +#endif ENDVERBATIM :* FUNCTION file_exist() @@ -56,10 +59,7 @@ VERBATIM errno else will get a nrnoc error. Seems to be a problem even if I don't include */ - char *gargstr(), *filename; - - filename = gargstr(1); - + char* filename = gargstr(1); if (*filename && !access(filename, F_OK)) { _lfile_exist = 1; @@ -77,19 +77,18 @@ PROCEDURE sassign() { VERBATIM FILE *pipein; char string[BUFSIZ], **strname, *syscall; - char** hoc_pgargstr(); - strname = hoc_pgargstr(1); syscall = gargstr(2); if( !(pipein = popen(syscall, "r"))) { fprintf(stderr,"System call failed\n"); - return; + return 0; } if (fgets(string,BUFSIZ,pipein) == NULL) { fprintf(stderr,"System call did not return a string\n"); - pclose(pipein); return; + pclose(pipein); + return 0; } /* assign_hoc_str(strname, string, 0); */ @@ -112,17 +111,20 @@ VERBATIM if ( !(outfile = fopen("dassign","w"))) { fprintf(stderr,"Can't open output file dassign\n"); - return; + return 0; } if( !(pipein = popen(syscall, "r"))) { fprintf(stderr,"System call failed\n"); - fclose(outfile); return; + fclose(outfile); + return 0; } if (fscanf(pipein,"%lf",&num) != 1) { fprintf(stderr,"System call did not return a number\n"); - fclose(outfile); pclose(pipein); return; + fclose(outfile); + pclose(pipein); + return 0; } fprintf(outfile,"%s=%g\n",strname,num); @@ -176,8 +178,7 @@ ENDVERBATIM PROCEDURE fspitchar(c) { VERBATIM { - FILE* f, *hoc_obj_file_arg(); - f = hoc_obj_file_arg(2); + FILE* f = hoc_obj_file_arg(2); fprintf(f, "%c", (int)_lc); } ENDVERBATIM @@ -223,8 +224,7 @@ ENDVERBATIM FUNCTION hocgetc() { VERBATIM { - FILE* f, *hoc_obj_file_arg(); - f = hoc_obj_file_arg(1); + FILE* f = hoc_obj_file_arg(1); _lhocgetc = (double)getc(f); } ENDVERBATIM diff --git a/readme.html b/readme.html index c627bfd..c4202b2 100644 --- a/readme.html +++ b/readme.html @@ -28,4 +28,9 @@ in addition to the graph, a panel is launched that allows you to look at several other voltage traces that were recorded during the run + +Changelog +--------- +2022-05: Updated MOD files to contain valid C++ and be compatible + with the upcoming versions 8.2 and 9.0 of NEURON. diff --git a/stats.mod b/stats.mod index 41b19dc..e29ca0a 100644 --- a/stats.mod +++ b/stats.mod @@ -31,7 +31,6 @@ ASSIGNED { } VERBATIM #include #include -#include /* contains MAXLONG */ #include extern double BVBASE; extern double* hoc_pgetarg(); @@ -46,9 +45,6 @@ extern double hoc_epsilon; extern void set_seed(); extern int ivoc_list_count(Object*); extern Object* ivoc_list_item(Object*, int); -extern int list_vector_px2(); -int list_vector_px(); -int list_vector_resize(); static void hxe() { hoc_execerror("",0); } typedef struct BVEC { @@ -484,8 +480,6 @@ FUNCTION gammln (xx) { FUNCTION betai(a,b,x) { VERBATIM { double bt; - double gammln(),betacf(); - if (_lx < 0.0 || _lx > 1.0) {printf("Bad x in routine BETAI\n"); hxe();} if (_lx == 0.0 || _lx == 1.0) bt=0.0; else diff --git a/vecst.mod b/vecst.mod index f567b6d..5bc7839 100644 --- a/vecst.mod +++ b/vecst.mod @@ -91,9 +91,9 @@ PARAMETER { ASSIGNED { RES } VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 #include #include -#include // contains MAXLONG #include extern double* hoc_pgetarg(); extern double hoc_call_func(Symbol*, int narg); @@ -111,10 +111,11 @@ extern Object* ivoc_list_item(Object*, int); extern int hoc_is_double_arg(int narg); extern char* hoc_object_name(Object*); char ** hoc_pgargstr(); -static int ismono1(); -int list_vector_px(); -int list_vector_px2(); -int list_vector_resize(); +#endif +static int ismono1 (double *x, int n, int flag); +int list_vector_px(Object *ob, int i, double** px); +int list_vector_px2 (Object *ob, int i, double** px, void** vv); +int list_vector_resize (Object *ob, int i, int sz); static double sc[6]; static void hxe() { hoc_execerror("",0); } @@ -147,6 +148,7 @@ static double ident(void* vv) { nx = vector_instance_px(vv, &x); bsz=vector_buffer_size(vv); printf("Obj*%x Dbl*%x Size: %d Bufsize: %d\n",vv,x,nx,bsz); + return 0.0; } ENDVERBATIM @@ -495,8 +497,7 @@ VERBATIM static double iwr(void* vv) { int i, j, nx; double *x; - FILE* f, *hoc_obj_file_arg(); - f = hoc_obj_file_arg(1); + FILE* f = hoc_obj_file_arg(1); nx = vector_instance_px(vv, &x); if (nx>scrsz) { if (scrsz>0) { free(scr); scr=(unsigned int *)NULL; } @@ -515,8 +516,7 @@ VERBATIM static double ird(void* vv) { int i, j, nx, n; double *x; - FILE* f, *hoc_obj_file_arg(); - f = hoc_obj_file_arg(1); + FILE* f = hoc_obj_file_arg(1); nx = vector_instance_px(vv, &x); fread(&n,sizeof(int),1,f); // size if (n>scrsz) { @@ -544,7 +544,7 @@ VERBATIM static double fread2(void* vv) { int i, j, nx, n, type, maxsz; double *x; - FILE* fp, *hoc_obj_file_arg(); + FILE* fp; BYTEHEADER fp = hoc_obj_file_arg(1); @@ -583,6 +583,7 @@ static double fread2(void* vv) { } free((char *)xf); } else hoc_execerror("Type unsupported in fread2 ", 0); + return 0.0; } ENDVERBATIM @@ -615,6 +616,7 @@ static double vfill (void* vv) { nx = vector_instance_px(vv, &x); nv1 = vector_arg_px(1, &v1); for (i=0;i0 && kVRRY) hoc_execerror("ERR: keyind can only handle VRRY vectors", 0); num = i-1; // number of vectors to be picked apart for (i=0;itemplate != ob2->template) { +#define ctemplate template +#ifdef NRN_VERSION_GTEQ_8_2_0 +#if NRN_VERSION_GTEQ(9, 0, 0) +#undef ctemplate +#define ctemplate ctemplate +#endif +#endif + if (!ob2 || ob1->ctemplate != ob2->ctemplate) { +#undef ctemplate return 0; } return 1;