Skip to content

Commit

Permalink
autotools cpp update: linux
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsavulescu committed Oct 13, 2020
1 parent 981d0b5 commit f99a341
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 67 deletions.
3 changes: 1 addition & 2 deletions src/memacs/redef.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ redef.h,v
*/

/*Publics by module*/

#define exit emacs_exit
#define exit(int) emacs_exit(int)

/*ANSI size = 250*/
#define ansibeep emacs_ansibeep
Expand Down
3 changes: 2 additions & 1 deletion src/nrnmpi/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
lib_LTLIBRARIES = libnrnmpi.la

nsrc=$(top_srcdir)/src
includes = -I$(nsrc)/oc -I@MUSIC_INCDIR@ -I$(nsrc)/ivos
includes = -I$(nsrc)/oc @NRN_REALTIME_INCLUDE@ -I@MUSIC_INCDIR@ -I$(nsrc)/ivos
AM_CPPFLAGS = $(includes)

libnrnmpi_la_SOURCES = nrnmpi.cpp bbsmpipack.cpp mpispike.cpp nrnrt.cpp

CXX = @MPICCnrnmpi@

if BUILD_NRNMPI_DYNAMIC

Expand Down
6 changes: 3 additions & 3 deletions src/nrnmpi/nrnmpi_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ extern void* hoc_Emalloc(size_t size);
extern void hoc_malchk();
extern void* hoc_Erealloc(void* buf, size_t size);

extern MPI_Comm nrnmpi_world_comm;
extern MPI_Comm nrnmpi_comm;

#if defined(__cplusplus)
}
#endif

extern MPI_Comm nrnmpi_world_comm;
extern MPI_Comm nrnmpi_comm;

#endif
2 changes: 2 additions & 0 deletions src/nrnoc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ libnrnoc_la_SOURCES = $(MODFILES_C) cabcode.cpp capac.cpp clamp.cpp eion.cpp
seclist.cpp method3.cpp hocprax.cpp secref.cpp ldifus.cpp hocusr.cpp nrnversion.cpp \
nrnversion.h nrntimeout.cpp passive0.cpp

libnrnoc_la_LIBADD = -lpthread

##
## The list of .c files which are actually built during the build procedure.
## These files should not be packaged in a distribution.
Expand Down
26 changes: 15 additions & 11 deletions src/nrnoc/nrnnoiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern "C" double nrn_random_pick(void *r) { return 0.; }

extern "C" int nrn_random_isran123(void *r, uint32_t *id1, uint32_t *id2, uint32_t *id3) { return 0.; }

void hoc_new_opoint() {}
void hoc_new_opoint(int) {}

int special_pnt_call(Object *ob, Symbol *sym, int narg) { return 0; }

Expand Down Expand Up @@ -100,25 +100,25 @@ void nrn_fihexec(int i)
{
}

void nrn_deliver_events(double tt)
void nrn_deliver_events(NrnThread*)
{
}

void nrn_record_init() {}

void nrn_play_init() {}

void fixed_record_continuous() {}
void fixed_record_continuous(NrnThread*) {}

void fixed_play_continuous() {}
void fixed_play_continuous(NrnThread*) {}

void nrniv_recalc_ptrs() {}

void nrn_recalc_ptrvector() {}

void nrn_extra_scatter_gather(int direction, int tid) {}

void nrn_update_ion_pointer(int type, Datum *d, int i, int j) {}
extern "C" void nrn_update_ion_pointer(int type, Datum *d, int i, int j) {}

void nrn_update_ps2nt() {}

Expand All @@ -135,7 +135,7 @@ extern "C" void net_event() { hoc_execerror("net_event only available in nrniv",

extern "C" void net_send() { hoc_execerror("net_send only available in nrniv", (char *) 0); }

void artcell_net_send() { hoc_execerror("net_send only available in nrniv", (char *) 0); }
extern "C" void artcell_net_send() { hoc_execerror("net_send only available in nrniv", (char *) 0); }

extern "C" void net_move() { hoc_execerror("net_move only available in nrniv", (char *) 0); }

Expand All @@ -147,7 +147,7 @@ void nrn_use_daspk(int i)

#if CVODE

void cvode_fadvance(double t)
extern "C" void cvode_fadvance(double t)
{
}

Expand All @@ -163,7 +163,7 @@ extern "C" void clear_event_queue() {}

void init_net_events() {}

void deliver_net_events() {}
void deliver_net_events(NrnThread*) {}

void hoc_reg_singlechan() {}

Expand Down Expand Up @@ -194,11 +194,11 @@ void nrn_daq_scanstart() {}

void nrn_multisplit_ptr_update() {}

void nrn_multisplit_bksub() { assert(0); }
void nrn_multisplit_bksub(NrnThread*) { assert(0); }

void nrn_multisplit_reduce_solve() { assert(0); }
void nrn_multisplit_reduce_solve(NrnThread*) { assert(0); }

void nrn_multisplit_triang() { assert(0); }
void nrn_multisplit_triang(NrnThread*) { assert(0); }

#if 1 || PARANEURON

Expand All @@ -208,6 +208,8 @@ double *nrn_classicalNodeB(Node *n) { return (double *) 0; }

#endif

extern "C" {

void *nrn_pool_create(long count, int itemsize) {
assert(0);
return nullptr;
Expand All @@ -222,6 +224,8 @@ void *nrn_pool_alloc(void *pool) {
return nullptr;
}

}

#if NRN_MUSIC
void nrnmusic_init(int* parg, char*** pargv){}
void nrnmusic_terminate(){}
Expand Down
10 changes: 5 additions & 5 deletions src/nrnpython/rxdmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
* names and arguments match the wrappers used in rxdmath.py
*/

double factorial(const double x)
extern "C" double factorial(const double x)
{
return tgamma(x+1.);
}


double degrees(const double radians)
extern "C" double degrees(const double radians)
{
return radians * (180. / M_PI);
}

void radians(const double degrees, double *radians)
extern "C" void radians(const double degrees, double *radians)
{
*radians = degrees * (M_PI / 180.);
}


double log1p(const double x)
extern "C" double log1p(const double x)
{
return log(x+1.);
}

double vtrap(const double x, const double y)
extern "C" double vtrap(const double x, const double y)
{
if(fabs(x/y) < 1e-6)
{
Expand Down
32 changes: 17 additions & 15 deletions src/oc/code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,21 +308,23 @@ static void frame_objauto_recover_on_err(Frame *ff) { /* only on error */
Here, stkp is the last+1 localobj slot pair on the stack.
*/
Datum *stkp = f->argn + 2 + sp->u.u_proc->nauto * 2;
for (i = sp->u.u_proc->nobjauto; i > 0; --i) {
Object *ob = stkp[-2 * i].obj;
hoc_obj_unref(ob);
/* Note that these AUTOOBJECT stack locations have an itemtype that
are left over from the previous stack usage of that location.
Regardless of that itemtype (e.g. OBJECTTMP), these did NOT
increment tobj_count so we need to guarantee that the subsequent
stack_obtmp_recover_on_err does not inadvertently free it again
by setting the itemtype to a non OBJECTTMP value. I hope this is
the only place where stack space was used in which no item type
was specified.
We are doing this here which happens rarely to avoid having to
set them when the stack obj pointers are zeroed.
*/
stkp[-2 * i + 1].i = 0;
if(sp->u.u_proc != 0) {
for (i = sp->u.u_proc->nobjauto; i > 0; --i) {
Object *ob = stkp[-2 * i].obj;
hoc_obj_unref(ob);
/* Note that these AUTOOBJECT stack locations have an itemtype that
are left over from the previous stack usage of that location.
Regardless of that itemtype (e.g. OBJECTTMP), these did NOT
increment tobj_count so we need to guarantee that the subsequent
stack_obtmp_recover_on_err does not inadvertently free it again
by setting the itemtype to a non OBJECTTMP value. I hope this is
the only place where stack space was used in which no item type
was specified.
We are doing this here which happens rarely to avoid having to
set them when the stack obj pointers are zeroed.
*/
stkp[-2 * i + 1].i = 0;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/oc/hocmodl.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern void hoc_model(), hoc_initmodel(), hoc_terminal(), hoc_prconst();
extern int *hoc_pindepindex;

static VoidFunc function[] = {
static VoidFunc functions[] = {
"model", hoc_model,
"initmodel", hoc_initmodel,
"terminal", hoc_terminal,
Expand Down
2 changes: 1 addition & 1 deletion src/oc/hocusr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void nrn_load_name_check(const char *name) {

static void arayinstal(Symbol *sp, int nsub, int sub1, int sub2, int sub3);

void hoc_spinit(void) /* install user variables and functions */
extern "C" void hoc_spinit(void) /* install user variables and functions */
{
int i;
Symbol *s;
Expand Down
2 changes: 1 addition & 1 deletion src/oc/mk_hocusr_h.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def process(type, names):

print('''
/* Functions */
static VoidFunc function[] = {
static VoidFunc functions[] = {
''')

for i in voidfun:
Expand Down
55 changes: 29 additions & 26 deletions src/oc/ocnoiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const char* path_prefix_to_libnrniv() { return NULL; }
#endif

#if !defined(SOME_IV)
#if defined(__cplusplus)
class IvocVect;
#else
#define IvocVect void
#endif
extern "C" {
/*ARGSUSED*/
int ivoc_list_look(Object* ob, Object* oblook, char* path, int depth)
{
Expand All @@ -76,41 +82,38 @@ void hoc_template_notify(Object* ob, int create) {}
#endif

/*ARGSUSED*/
int hoc_readcheckpoint(char* f) { return 0; }

/*ARGSUSED*/
extern "C" int vector_arg_px(int i, double** p) {
extern int vector_arg_px(int i, double** p) {
hoc_execerror("implemented in ivoc library", "vector_arg_px");
return 0;
}
int vector_capacity(void* v) {return 0;}
extern "C" void install_vector_method(const char* name, Pfrd_vp f) {}
extern "C" int vector_instance_px(void* vv, double** px){return 0;}
void vector_resize(void* v, void* n) {
int vector_capacity(IvocVect* v) {return 0;}
void install_vector_method(const char* name, Pfrd_vp f) {}
int vector_instance_px(void* vv, double** px){return 0;}
void vector_resize(IvocVect* v, int n) {
hoc_execerror("implemented in ivoc library", "vector_resize");
}
void vector_append(void* vv, double x) {}
void vector_delete(void* v) {}
void vector_append(IvocVect* vv, double x) {}
void vector_delete(IvocVect* v) {}

IvocVect *vector_arg(int i) { return nullptr; }
IvocVect *vector_new2(IvocVect *v) { return nullptr; }
Object **vector_pobj(IvocVect *v) { return (Object **) 0; }
double *vector_vec(IvocVect *v) {
hoc_execerror("implemented in ivoc library", "vector_vec");
return (double *) 0;
}

Object *ivoc_list_item(Object *list, int item) {
hoc_execerror("implemented in ivoc library", "ivoc_list_item");
return nullptr;
}
int ivoc_list_count(Object *list) { return 0; }
#if defined(__cplusplus)
class IvocVect;
#else
#define IvocVect void
#endif

IvocVect* vector_arg(int i) { return nullptr;}
IvocVect* vector_new2(void* v) { return nullptr;}
Object** vector_pobj(void* v) { return (Object**)0;}
double* vector_vec(void* v) {
hoc_execerror("implemented in ivoc library", "vector_vec");
return (double*)0;
}
#endif
/*ARGSUSED*/
int hoc_readcheckpoint(char* f) { return 0; }

extern "C" Object* ivoc_list_item(Object* list, int item) {
hoc_execerror("implemented in ivoc library", "ivoc_list_item");
return nullptr;
}
int ivoc_list_count(Object* list) { return 0; }
void bbs_done(void){}

Symbol* ivoc_alias_lookup(const char* name, Object* ob) {return (Symbol*)0;}
Expand Down
2 changes: 1 addition & 1 deletion src/oc/spinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ spinit.cpp,v
*/


void hoc_spinit(void) /* Dummy special init */
extern "C" void hoc_spinit(void) /* Dummy special init */
{
}

0 comments on commit f99a341

Please sign in to comment.