Skip to content

Commit

Permalink
Cope with Section being a forward declaration.
Browse files Browse the repository at this point in the history
Needed for new data structures.
  • Loading branch information
olupton committed Apr 20, 2023
1 parent 38e1f62 commit 0f41652
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.html
Expand Up @@ -61,4 +61,5 @@
Changelog
---------
2023-02-28: updated for C++ compatibility (NEURON 9+)
2023-04-20: updated for SoA data compatibility (NEURON 9+)
</pre></html>
12 changes: 8 additions & 4 deletions mod/child.mod
Expand Up @@ -13,14 +13,18 @@
}

VERBATIM
#ifdef NRN_MECHANISM_DATA_IS_SOA
#define get_child(sec) _nrn_mechanism_get_child(sec)
#define get_sibling(sec) _nrn_mechanism_get_sibling(sec)
#else
#define get_child(sec) sec->child
#define get_sibling(sec) sec->sibling
#endif
static void subtree(Section* sec, Symbol* sym) {
Section* child;

nrn_pushsec(sec); /* move these three (sec becomes child) */
hoc_run_stmt(sym); /* into the loop to do only the first level */
nrn_popsec();

for (child = sec->child; child; child = child->sibling) {
for (Section* child = get_child(sec); child; child = get_sibling(child)) {
subtree(child, sym);
}
}
Expand Down
13 changes: 8 additions & 5 deletions mod/childa.mod
Expand Up @@ -13,12 +13,15 @@ NEURON {
}

VERBATIM
#ifdef NRN_MECHANISM_DATA_IS_SOA
#define get_child(sec) _nrn_mechanism_get_child(sec)
#define get_sibling(sec) _nrn_mechanism_get_sibling(sec)
#else
#define get_child(sec) sec->child
#define get_sibling(sec) sec->sibling
#endif
static void subtree(Section* sec, Symbol* sym) {
Section* child;



for (child = sec->child; child; child = child->sibling) {
for (Section* child = get_child(sec); child; child = get_sibling(child)) {
nrn_pushsec(child); /* move these three (sec becomes child) */
hoc_run_stmt(sym); /* into the loop to do only the first level */
nrn_popsec();
Expand Down

0 comments on commit 0f41652

Please sign in to comment.