-
Notifications
You must be signed in to change notification settings - Fork 2
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
NEURON 9 compatibility #2
Changes from all commits
e810529
3350de0
49bc9c8
f733b00
8f8c7ea
8172231
90175cc
12463d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prototype changed because function was not returning any value (and we saw undefined behaviour in some cases). |
||
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
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; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
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; | ||
pramodk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
double ind, t0_local; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the above resolved conversation explaining why |
||
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; i<vspn; i++) { | ||
if (isp[i]!=ind) { | ||
|
@@ -693,11 +697,12 @@ PROCEDURE trvsp () | |
} else if (flag==2) { | ||
for (i=0; i<vspn; i++) { | ||
if (isp[i]!=ind) { | ||
vsp[i-1]=t0+subsvint; | ||
ind=isp[i]; t0=vsp[i]; | ||
vsp[i-1] = t0_local + subsvint; | ||
ind = isp[i]; | ||
t0_local = vsp[i]; | ||
} | ||
} | ||
vsp[vspn-1]=t0+subsvint; | ||
vsp[vspn-1] = t0_local + subsvint; | ||
} else {printf("trvsp flag %d not recognized\n",flag); hxe();} | ||
ENDVERBATIM | ||
} | ||
|
@@ -1085,7 +1090,8 @@ PROCEDURE wrecord (te) { | |
for (j= -max;j<=max && k+j>0 && k+j<wwsz;j++) { | ||
wwo[wrp][k+j] += scale*_t_Psk[j+max]; // direct copy from the Psk table | ||
} | ||
} else if (twg>=t) { return; | ||
} else if (twg>=t) { | ||
return 0; | ||
} else { | ||
for (ti=twg,k=(int)floor((twg-rebeg)/vdt+0.5);ti<=t && k<wwsz;ti+=vdt,k++) { | ||
valps(ti,twg); // valps() for pop spike calculation | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,9 @@ VERBATIM | |
#include <time.h> | ||
#include <stdio.h> | ||
#include <limits.h> | ||
#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 <errno.h> */ | ||
|
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
} | ||
|
||
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; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for all return type changes |
||
|
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ ASSIGNED { } | |
VERBATIM | ||
#include <stdlib.h> | ||
#include <math.h> | ||
#include <values.h> /* contains MAXLONG */ | ||
#include <sys/time.h> | ||
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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not used |
||
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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrong prototypes and not requried |
||
|
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,9 +91,9 @@ PARAMETER { | |
ASSIGNED { RES } | ||
|
||
VERBATIM | ||
#ifndef NRN_VERSION_GTEQ_8_2_0 | ||
#include <stdlib.h> | ||
#include <math.h> | ||
#include <values.h> // contains MAXLONG | ||
#include <sys/time.h> | ||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct prototypes |
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for all return type changes |
||
} | ||
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;i<nx;i++) x[i]=v1[i%nv1]; | ||
return 0.0; | ||
} | ||
ENDVERBATIM | ||
|
||
|
@@ -799,6 +801,7 @@ static double vscl(double *x, double n) { | |
r=max-min; // range | ||
sf = (b-a)/r; // scaling factor | ||
for (i=0;i<n;i++) x[i]=(x[i]-min)*sf+a; | ||
return 0.0; | ||
} | ||
ENDVERBATIM | ||
|
||
|
@@ -812,6 +815,7 @@ static double scl(void* vv) { | |
if (nx!=nsrc) { hoc_execerror("scl:Vectors not same size: ", 0); } | ||
for (i=0;i<nx;i++) x[i]=src[i]; | ||
vscl(x,nx); | ||
return 0.0; | ||
} | ||
ENDVERBATIM | ||
|
||
|
@@ -834,6 +838,7 @@ static double sccvlv(void* vv) { | |
vscl(tmp,j-1); | ||
for (k=0;k<j;k++) x[i]+=filt[k]*tmp[k]; | ||
} | ||
return 0.0; | ||
} | ||
ENDVERBATIM | ||
|
||
|
@@ -890,6 +895,7 @@ static double cvlv (void* vv) { | |
if (k>0 && k<nsrc-1) x[i]+=filt[j]*src[k]; | ||
} | ||
} | ||
return 0.0; | ||
} | ||
ENDVERBATIM | ||
|
||
|
@@ -987,7 +993,7 @@ static double keyind(void* vv) { | |
int i, j, k, ni, nk, nv[VRRY], num; | ||
double *ind, *key, *vvo[VRRY]; | ||
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>VRRY) hoc_execerror("ERR: keyind can only handle VRRY vectors", 0); | ||
num = i-1; // number of vectors to be picked apart | ||
for (i=0;i<num;i++) { | ||
|
@@ -1087,6 +1093,7 @@ static double bpeval(void* vv) { | |
} else { | ||
for (i=0;i<n;i++) vo[i]=outp[i]*(1.-1.*outp[i])*del[i]; | ||
} | ||
return 0.0; | ||
} | ||
ENDVERBATIM | ||
|
||
|
@@ -2033,7 +2040,15 @@ FUNCTION isojt () { | |
Object *ob1, *ob2; | ||
ob1 = *hoc_objgetarg(1); ob2 = *hoc_objgetarg(2); | ||
if (!ob1) if (!ob2) return 1; else return 0; | ||
if (!ob2 || ob1->template != 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as |
||
return 0; | ||
} | ||
return 1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was not used in this file