Skip to content
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

Improve header hygiene for cabcode.h. #2948

Merged
merged 11 commits into from
Aug 29, 2024
1 change: 1 addition & 0 deletions cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(HEADER_FILES_TO_INSTALL
nrniv/neuronapi.h
nrnmpi/nrnmpidec.h
nrnoc/cabvars.h
nrnoc/cabcode.h
nrnoc/md1redef.h
nrnoc/md2redef.h
nrnoc/membdef.h
Expand Down
26 changes: 5 additions & 21 deletions src/nrncvode/netcvode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
// define to 0 if do not wish use_min_delay_ to ever be 1
#define USE_MIN_DELAY 1

#include <stdlib.h>
#include <nrnmpi.h>
#include <errno.h>
#include <time.h>
#include <regex>
#include "cabcode.h"
#include "classreg.h"
#include "nrnoc2iv.h"
#include "parse.hpp"
#include "cvodeobj.h"
#include "hoclist.h"
Expand All @@ -19,7 +15,6 @@
#include "nrnneosm.h"
#include "datapath.h"
#include "objcmd.h"
#include "shared/sundialsmath.h"
#include "kssingle.h"
#include "ocnotify.h"
#include "utils/enumerate.h"
Expand All @@ -43,6 +38,10 @@
#include "utils/profile/profiler_interface.h"

#include <array>
#include <cerrno>
#include <cstdlib>
#include <ctime>
#include <regex>
#include <unordered_set>
#include <utility>

Expand All @@ -55,8 +54,6 @@ typedef void (*ReceiveFunc)(Point_process*, double*, double);
#define NVI_SUCCESS 0
#define PP2NT(pp) ((NrnThread*) ((pp)->_vnt))
#define PP2t(pp) (PP2NT(pp)->_t)
#define LOCK(m) /**/
#define UNLOCK(m) /**/
1uc marked this conversation as resolved.
Show resolved Hide resolved
// classical and when DiscreteEvent::deliver is already in the right thread
// via a future thread instance of NrnNetItem with its own tqe.
#define POINT_RECEIVE(type, tar, w, f) (*pnt_receive[type])(tar, w, f)
Expand All @@ -66,38 +63,25 @@ typedef void (*ReceiveFunc)(Point_process*, double*, double);

#include "membfunc.h"
extern void single_event_run();
extern void setup_topology(), v_setup_vectors();
extern int nrn_errno_check(int);
extern NetCvode* net_cvode_instance;
extern cTemplate** nrn_pnt_template_;
extern double t, dt;
extern void nrn_cvfun(double t, double* y, double* ydot);
extern void nrn_cleanup_presyn(PreSyn*);
#define nt_dt nrn_threads->_dt
#define nt_t nrn_threads->_t
extern void nrn_parent_info(Section*);
extern Object* nrn_sec2cell(Section*);
extern int nrn_sec2cell_equals(Section*, Object*);
extern ReceiveFunc* pnt_receive;
extern ReceiveFunc* pnt_receive_init;
extern short* nrn_is_artificial_; // should be bool but not using that type in c
extern short* nrn_artcell_qindex_;
int nrn_use_selfqueue_;
void nrn_pending_selfqueue(double tt, NrnThread*);
static void all_pending_selfqueue(double tt);
static void* pending_selfqueue(NrnThread*);
extern int hoc_araypt(Symbol*, int);
extern int hoc_stacktype();
void nrn_use_daspk(int);
extern int nrn_use_daspk_;
int linmod_extra_eqn_count();
extern int nrn_modeltype();
extern Symlist* hoc_built_in_symlist;
extern Symlist* hoc_top_level_symlist;
extern TQueue* net_cvode_instance_event_queue(NrnThread*);
extern hoc_Item* net_cvode_instance_psl();
extern std::vector<PlayRecord*>* net_cvode_instance_prl();
extern void nrn_update_ps2nt();
extern void nrn_use_busywait(int);
void* nrn_interthread_enqueue(NrnThread*);
extern void (*nrnthread_v_transfer_)(NrnThread*);
Expand Down
16 changes: 4 additions & 12 deletions src/nrncvode/occvode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <../../nrnconf.h>
#include <errno.h>
#include "hocdec.h"
#include "cabcode.h"
#include "nrn_ansi.h"
#include "nrndae_c.h"
#include "nrniv_mf.h"
Expand All @@ -12,16 +13,9 @@
#include "membfunc.h"
#include "nonvintblock.h"

#include <utility>
#include <cerrno>
#include <numeric>

extern void setup_topology(), v_setup_vectors();
extern void recalc_diam();
extern int nrn_errno_check(int);
// extern double t, dt;
#define nt_dt nrn_threads->_dt
#define nt_t nrn_threads->_t

extern Symlist* hoc_built_in_symlist;

#include "spmatrix.h"
extern double* sp13mat;
Expand All @@ -45,8 +39,6 @@ extern void (*nrn_multisplit_solve_)();
#endif

static Symbol* vsym; // for absolute tolerance
#define SETUP 1
#define USED 2
/*
CVODE expects dy/dt = f(y) and solve (I - gamma*J)*x = b with approx to
J=df/dy.
Expand Down
2 changes: 1 addition & 1 deletion src/nrniv/bbsavestate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ callback to bbss_early when needed.
*/

#include "bbsavestate.h"
#include "cabcode.h"
#include "classreg.h"
#include "nrncvode.h"
#include "nrnoc2iv.h"
Expand Down Expand Up @@ -201,7 +202,6 @@ typedef void (*ReceiveFunc)(Point_process*, double*, double);
#include "membfunc.h"
extern int section_count;
extern "C" void nrn_shape_update();
extern Section* nrn_section_exists(char* name, int index, Object* cell);
extern Section** secorder;
extern ReceiveFunc* pnt_receive;
extern NetCvode* net_cvode_instance;
Expand Down
3 changes: 0 additions & 3 deletions src/nrniv/impedanc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
#include <complex>
#include "nrnoc2iv.h"
#include "classreg.h"
#include <stdio.h>
#include "membfunc.h"
extern void setup_topology();
extern void recalc_diam();

typedef void (*Pfrv4)(int, Node**, double**, Datum**);

Expand Down
20 changes: 7 additions & 13 deletions src/nrniv/multisplit.cpp
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
#include <../../nrnconf.h>

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <InterViews/resource.h>
#include <vector>
#include "cabcode.h"
#include "nrn_ansi.h"
#include "nrndae_c.h"
#include "nrniv_mf.h"
#include <nrnoc2iv.h>
#include <nrnmpi.h>
#include <multisplit.h>
#include <unordered_map>

#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <memory>
#include <unordered_map>
#include <vector>

void nrnmpi_multisplit(Section*, double x, int sid, int backbone_style);
int nrn_multisplit_active_;

extern void setup_topology();
extern void (*nrn_multisplit_setup_)();
extern void* nrn_multisplit_triang(NrnThread*);
extern void* nrn_multisplit_reduce_solve(NrnThread*);
extern void* nrn_multisplit_bksub(NrnThread*);
extern double t;

void nrn_multisplit_ptr_update();
void nrnmpi_multisplit_clear();
void nrn_multisplit_nocap_v();
void nrn_multisplit_nocap_v_part1(NrnThread*);
void nrn_multisplit_nocap_v_part2(NrnThread*);
void nrn_multisplit_nocap_v_part3(NrnThread*);
void nrn_multisplit_adjust_rhs(NrnThread*);
extern void (*nrn_multisplit_solve_)();
static void multisplit_v_setup();
static void multisplit_solve();
Expand Down
3 changes: 1 addition & 2 deletions src/nrniv/neuronapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "../../nrnconf.h"
#include "hocdec.h"
#include "cabcode.h"
#include "nrniv_mf.h"
#include "nrnmpi.h"
#include "nrnmpiuse.h"
Expand Down Expand Up @@ -42,8 +43,6 @@ extern "C" void nrnpy_set_pr_etal(int (*cbpr_stdoe)(int, char*), int (*cbpass)()
int ivocmain_session(int, const char**, const char**, int start_session);
void simpleconnectsection();
extern Object* hoc_newobj1(Symbol*, int);
extern void nrn_change_nseg(Section*, int);
extern Section* section_new(Symbol* sym);
extern std::tuple<int, const char**> nrn_mpi_setup(int argc, const char** argv);

extern "C" {
Expand Down
12 changes: 4 additions & 8 deletions src/nrniv/nrnmenu.cpp
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@

#include <../../nrnconf.h>

#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>

#if HAVE_IV
#include "secbrows.h"
#include "ivoc.h"
#endif
#include "cabcode.h"
#include "nrniv_mf.h"
#include "nrnoc2iv.h"
#include "nrnpy.h"
#include "nrnmenu.h"
#include "classreg.h"
#include "gui-redirect.h"

typedef void (*ReceiveFunc)(Point_process*, double*, double);
extern int hoc_return_type_code;
// from nrnoc
#include "membfunc.h"
#include "parse.hpp"
extern Symlist* hoc_built_in_symlist;
extern Symbol** pointsym;
extern ReceiveFunc* pnt_receive;
extern int nrn_has_net_event_cnt_;
extern int* nrn_has_net_event_;
extern short* nrn_is_artificial_;
extern int node_index(Section*, double);
extern char* pnt_map;
extern void nrn_parent_info(Section*);

// to nrnoc
void nrnallsectionmenu();
Expand Down Expand Up @@ -1271,8 +1268,7 @@ const char* MechanismType::selected() {
int MechanismType::internal_type() {
return mti_->type_[selected_item()];
}
extern void mech_insert1(Section*, int);
extern void mech_uninsert1(Section*, Symbol*);

void MechanismType::insert(Section* sec) {
if (!mti_->is_point_) {
mech_insert1(sec, memb_func[mti_->type_[selected_item()]].sym->subtype);
Expand Down
1 change: 0 additions & 1 deletion src/nrniv/spaceplt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

extern int nrn_multisplit_active_;
extern int hoc_execerror_messages;
extern int node_index(Section*, double);
extern int nrn_shape_changed_;
extern int hoc_return_type_code;
Object* (*nrnpy_rvp_rxd_to_callable)(Object*) = 0;
Expand Down
Loading
Loading