-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.hoc
65 lines (61 loc) · 1.38 KB
/
default.hoc
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{load_file("stdlib.hoc")}
objref pc, parmvars, parmstrs
pc = new ParallelContext()
parmvars = new List()
parmstrs = new List()
proc default_var() {localobj s
s = new String()
if (name_declared($s1) < 2) {
hoc_ac_ = $2
sprint(s.s, "%s = hoc_ac_", $s1)
execute(s.s)
}
s.s = $s1
parmvars.append(s)
}
proc default_str() {localobj s
s = new String()
if (name_declared($s1) < 2) {
sprint(s.s, "strdef %s", $s1)
execute1(s.s)
sprint(s.s, "%s = \"%s\"", $s1, $s2)
execute(s.s)
}
// if (pc.id == 0) {
// sprint(s.s, "printf(\"%s = \\\"%%s\\\"\\n\", %s)", $s1, $s1)
// execute(s.s)
// }
s.s = $s1
parmstrs.append(s)
}
proc print_param() {local i, x localobj s, ss, pc
pc = new ParallelContext()
s = new String()
if (numarg() == 1) {
$o1.printf("%s\n", nrnversion())
$o1.printf("%s\n", nrnversion(6))
$o1.printf("nhost %d\n", pc.nhost())
}
for i = 0, parmvars.count-1 {
sprint(s.s, "hoc_ac_ = %s", parmvars.o(i).s)
execute(s.s)
x = hoc_ac_
if (numarg() == 1) {
$o1.printf("%s = %g\n", parmvars.o(i).s, x)
}else{
printf("%s = %g\n", parmvars.o(i).s, x)
}
}
for i = 0, parmstrs.count-1 {
ss = parmstrs.o(i)
if (numarg() == 1) {
sprint(s.s, "%s.printf(\"%s = \\\"%%s\\\"\\n\", %s)", $o1, ss.s, ss.s)
}else{
sprint(s.s, "printf(\"%s = \\\"%%s\\\"\\n\", %s)", ss.s, ss.s)
}
execute(s.s)
}
if (numarg() == 1) {
$o1.printf("@@@end header@@@\n")
}
}