-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchilda.mod
More file actions
42 lines (32 loc) · 1.01 KB
/
Copy pathchilda.mod
File metadata and controls
42 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
COMMENT
iterator for traversing all the daughters of the currently accessed section
section subtree_traverse("statement")
executes statement for every daughter of section.
Just before the statement is executed the currently accessed section is set.
ENDCOMMENT
NEURON {
SUFFIX nothing
}
VERBATIM
static subtree(sec, sym) Section* sec; Symbol* sym; {
Section* child;
for (child = sec->child; child; child = child->sibling) {
nrn_pushsec(child); /* move these three (sec becomes child) */
hoc_run_stmt(sym); /* into the loop to do only the first level */
nrn_popsec();
}
}
ENDVERBATIM
PROCEDURE subtree_traverse() {
VERBATIM
{
Section* chk_access();
Symbol* hoc_parse_stmt();
Symlist* symlist = (Symlist*)0;
subtree(chk_access(), hoc_parse_stmt(gargstr(1), &symlist));
/* if following not executed (ie hoc error in statement),
some memory will leak */
hoc_free_list(&symlist);
}
ENDVERBATIM
}