1 #include <../../nrnconf.h>
23 #define hoc_acterror(a, b) printf("%s %s\n", a, b)
46 Name2CellorSec::iterator search =
n2cs.find(
n);
47 if (search !=
n2cs.end()) {
48 if (search->second.first ==
SECTYPE) {
50 return (
Section*) search->second.second;
51 }
else if (search->second.first ==
CELLTYPE) {
57 " is an overloaded first part name for multiple sections created in python");
61 hoc_acterror(
name,
" is not a valid first part name for section created in python");
65 Name2CellorSec::iterator search = n2s->find(
n);
66 if (search != n2s->end()) {
71 " is an overloaded second part name for multiple sections created in python");
75 return (
Section*) search->second.second;
78 hoc_acterror(
name,
" is not a valid last part name for section created in python");
87 Name2CellorSec::iterator search = n2s.find(
n);
88 if (search == n2s.end()) {
94 cs.second = (
void*) 2;
96 cs.second = (
void*) ((
size_t) cs.second + 1);
108 Name2CellorSec::iterator search =
n2cs.find(sname);
109 if (search ==
n2cs.end()) {
118 }
else if (cs.first ==
SECTYPE) {
120 cs.second = (
void*) 2;
122 cs.second = (
void*) ((
size_t) cs.second + 1);
132 Name2CellorSec::iterator search =
n2cs.find(cname);
134 if (search ==
n2cs.end()) {
162 if (
n.find(
"__nrnsec_0x", 0) == 0) {
165 if (
n.find(
"<", 0) !=
n.npos) {
169 size_t dot =
n.find(
'.', 1);
171 std::string cname =
n.substr(0,
dot);
172 std::string sname =
n.substr(
dot + 1);
180 cs.second = (
void*) ((
size_t) cs.second - 1);
181 return cs.second ? false :
true;
190 if (
name[0] ==
'<') {
194 size_t dot =
name.find(
'.', 1);
196 std::string cname =
name.substr(0,
dot);
197 std::string sname =
name.substr(
dot + 1);
198 Name2CellorSec::iterator it =
n2cs.find(cname);
204 Name2CellorSec::iterator its = n2s->find(sname);
205 assert(its != n2s->end());
228 Name2CellorSec::iterator it =
n2cs.find(
name);
244 printf(
"pysecname2sec is empty\n");
253 for (
auto&& [symbol, cs]:
n2cs) {
266 si->pysec_type_ = PYSECNAME;
267 si->pysec_ = (
Section*) cs.second;
const char * secname(Section *sec)
name of section (for use in error messages)
void * nrn_parsing_pysec_
#define ITERATE(itm, lst)
double dot(const Point3D &p1, const Point3D &p2)
int const size_t const size_t n
static void n2cs_add_sec(Name2CellorSec &n2cs, std::string sname, Section *sec)
void n2cs_add(Name2CellorSec &n2cs, std::string cname, std::string sname, Section *sec)
static Name2CellorSec n2cs
std::pair< CorStype, void * > CellorSec
void nrnpy_pysecname2sec_add(Section *sec)
Section * nrnpy_pysecname2sec(const char *name)
std::map< const std::string, CellorSec > Name2CellorSec
static void n2s_add(Name2CellorSec &n2s, std::string n, Section *sec)
static Name2CellorSec * n2cs_add_cell(Name2CellorSec &n2cs, std::string cname)
static bool decrement(CellorSec &cs)
void nrn_symdir_load_pysec(std::vector< SymbolItem * > &sl, void *v)
#define hoc_acterror(a, b)
void nrnpy_pysecname2sec_remove(Section *sec)