Skip to content
New issue

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

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

Already on GitHub? # to your account

MOD-C-2-CPP: Compatibility fixed for NEURON 9.0, 8.2 and 8.1 #4

Merged
merged 5 commits into from
May 27, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 41 additions & 31 deletions misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <math.h>
#include <limits.h> /* contains LONG_MAX */
#include <time.h>
#include <sys/time.h>
#include <sys/time.h>
#include <float.h>
#include <pthread.h>
#include <stdint.h>

#if !defined(t)
#define _pval pval
Expand Down Expand Up @@ -54,69 +55,78 @@ typedef unsigned char ui1; /* one byte unsigned integer */
typedef char si1; /* one byte signed integer */
typedef unsigned short ui2; /* two byte unsigned integer */
typedef short si2; /* two byte signed integer */
typedef unsigned int ui4; /* four byte unsigned integer */
typedef int si4; /* four byte signed integer */
typedef float sf4; /* four byte signed floating point number */
typedef double sf8; /* eight byte signed floating point number */
typedef unsigned int ui4; /* four byte unsigned integer */
typedef int si4; /* four byte signed integer */
typedef float sf4; /* four byte signed floating point number */
typedef double sf8; /* eight byte signed floating point number */

extern double ERR,GET,SET,OK,NOP,ALL,NEG,POS,CHK,NOZ,GTH,GTE,LTH,LTE,EQU;
extern double EQV,EQW,EQX,NEQ,SEQ,RXP,IBE,EBI,IBI,EBE;

extern double *vector_newsize();
extern unsigned int dcrsz;
extern double *dcr;
extern double *dcrset(int);
extern unsigned int scrsz;
extern unsigned int *scr;
extern unsigned int *scrset(int);
extern unsigned int iscrsz;
extern int *iscr;
extern int *iscrset(int);
extern double BVBASE;
#ifndef NRN_VERSION_GTEQ_8_2_0
extern void vector_resize();
extern int vector_buffer_size(void*);
extern FILE* hoc_obj_file_arg(int narg);
extern void mcell_ran4_init(uint32_t idum);
extern int nrn_mlh_gsort(double* vec, int* base_ptr, int total_elems, int (*)(double, double));
extern Symbol *hoc_get_symbol(char *);
extern int hoc_is_tempobj(int narg);
extern int hoc_is_tempobj_arg(int narg);
Object* ivoc_list_item(Object*, int);
extern double* hoc_pgetarg();
extern void hoc_notify_iv();
extern double hoc_call_func(Symbol*, int narg);
extern FILE* hoc_obj_file_arg(int narg);
extern Object** hoc_objgetarg();
char *gargstr();
char** hoc_pgargstr();
extern void vector_resize();
extern int vector_instance_px();
extern void* vector_arg();
extern double* vector_vec();
extern int vector_buffer_size(void*);
extern double hoc_epsilon;
extern int stoprun;
extern void set_seed();
extern void dshuffle(double* x,int nx);
extern void mcell_ran4_init(u_int32_t);
extern double mcell_ran4(u_int32_t *idx1, double *x, unsigned int n, double range);
extern int nrn_mlh_gsort();
extern int ivoc_list_count(Object*);
extern Object* ivoc_list_item(Object*, int);
extern int list_vector_px2();
extern int hoc_is_double_arg(int narg);
extern int hoc_is_str_arg(int narg);
extern int hoc_is_object_arg(int narg);
extern int hoc_is_pdouble_arg(int narg);
extern Symbol *hoc_get_symbol(char *);
extern Symbol *hoc_lookup(const char*);
extern Point_process* ob2pntproc(Object*);

extern char* hoc_object_name(Object*);
extern int cmpdfn();
extern double nrn_event_queue_stats(double*);
extern void clear_event_queue();
#endif

double *list_vector_resize(Object *ob, int i, int sz);
int list_vector_px(Object *ob, int i, double** px);
extern int list_vector_px2 (Object *ob, int i, double** px, IvocVect** vv);
extern int list_vector_px3 (Object *ob, int i, double** px, IvocVect** vv);
extern int list_vector_px4 (Object *ob, int i, double** px, unsigned int n);
extern double *vector_newsize (IvocVect* vv, int n);
extern int IsList (Object* p);
int uniq2 (int n, double *x, double *y, double *z);

extern unsigned int dcrsz;
extern double *dcr;
extern double *dcrset(int);
extern unsigned int scrsz;
extern unsigned int *scr;
extern unsigned int *scrset(int);
extern unsigned int iscrsz;
extern int *iscr;
extern int *iscrset(int);
extern double BVBASE;
extern void dshuffle(double* x,int nx);
extern int cmpdfn(double, double);
extern int openvec(int, double **);
int list_vector_px();
double *list_vector_resize();
static void hxe() { hoc_execerror("",0); }
extern void FreeListVec(ListVec** pp);
extern ListVec* AllocListVec(Object* p);
extern ListVec* AllocILV(Object*, int, double *);
void FillListVec(ListVec* p,double dval);
void ListVecResize(ListVec* p,int newsz);
extern short *nrn_artcell_qindex_;
extern double nrn_event_queue_stats(double*);
extern void clear_event_queue();

static double sc[6];
static FILE* testout;
Expand Down
9 changes: 4 additions & 5 deletions misc.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ NEURON {
}

VERBATIM
#include "misc.h"

#include <unistd.h> /* F_OK */
#include <errno.h> /* errno */
#include <signal.h>
#include <sys/types.h> /* MUST REMEMBER THIS */
#include <time.h>
#include <stdio.h>
#include <limits.h>
extern int hoc_is_tempobj(int narg);
ENDVERBATIM

:* FUNCTION file_exist()
Expand All @@ -58,7 +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;
char *filename;

filename = gargstr(1);

Expand All @@ -85,7 +86,6 @@ FUNCTION sassign() {
VERBATIM
FILE *pipein;
char string[BUFSIZ], **strname, *syscall;
char** hoc_pgargstr();

strname = hoc_pgargstr(1);
syscall = gargstr(2);
Expand Down Expand Up @@ -217,8 +217,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
Expand Down
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ http://www.neuron.yale.edu) compiled with python enabled. To draw the
output you will need to have Matplotlib installed (
http://matplotlib.org/ ).

Instructions to run the model
Instructions to run the model
- unzip the file
- cd ca1dDemo
- nrnivmodl (compiles the NMODL files)
Expand Down Expand Up @@ -88,12 +88,18 @@ interested in (in milliseconds). However, the resulting figure will
not be identical to Fig. 11 in the publication.
----------------------------------------------------------------------

For questions/comments email:
For questions/comments email:
mohamed dot sherif dot md at gmail dot com
or
samn at neurosim dot downstate dot edu
or
robert dot mcdougal at yale dot edu

Changelog
---------

20160915 This updated version from the Lytton lab allows their models
which contain misc.mod and misc.h to compile on the mac.

20220523 Updated MOD files to contain valid C++ and be compatible with
the upcoming versions 8.2 and 9.0 of NEURON.
Loading