1 #include <../../nrnconf.h> 5 #include <nrnpython_config.h> 23 #define hoc_acterror(a,b) printf("%s %s\n", a, b) 44 Name2CellorSec::iterator search =
n2cs.find(n);
45 if (search !=
n2cs.end()) {
46 if (search->second.first ==
SECTYPE) {
48 return (
Section*)search->second.second;
49 }
else if (search->second.first ==
CELLTYPE) {
53 hoc_acterror(name,
" is an overloaded first part name for multiple sections created in python");
57 hoc_acterror(name,
" is not a valid first part name for section created in python");
61 Name2CellorSec::iterator search = n2s->find(n);
62 if (search != n2s->end()) {
65 hoc_acterror(name,
" is an overloaded second part name for multiple sections created in python");
69 return (
Section*)search->second.second;
72 hoc_acterror(name,
" is not a valid last part name for section created in python");
81 Name2CellorSec::iterator search = n2s.find(n);
82 if (search == n2s.end()) {
90 cs.second = (
void*)((
size_t)cs.second + 1);
102 Name2CellorSec::iterator search = n2cs.find(sname);
103 if (search == n2cs.end()) {
112 }
else if (cs.first ==
SECTYPE) {
114 cs.second = (
void*)2;
116 cs.second = (
void*)((
size_t)cs.second + 1);
126 Name2CellorSec::iterator search = n2cs.find(cname);
128 if (search == n2cs.end()) {
154 if (n.find(
"__nrnsec_0x", 0) == 0) {
return; }
155 if (n.find(
"<", 0) != n.npos) {
return; }
157 size_t dot = n.find(
'.', 1);
159 std::string cname = n.substr(0, dot);
160 std::string sname = n.substr(dot+1);
168 cs.second = (
void*)((
size_t)cs.second - 1);
169 return cs.second ? false :
true;
176 if (name[0] ==
'<') {
return;}
178 size_t dot = name.find(
'.', 1);
179 if (dot != name.npos) {
180 std::string cname = name.substr(0, dot);
181 std::string sname = name.substr(dot+1);
182 Name2CellorSec::iterator it =
n2cs.find(cname);
188 Name2CellorSec::iterator its = n2s->find(sname);
189 assert(its != n2s->end());
212 Name2CellorSec::iterator it =
n2cs.find(name);
228 printf(
"pysecname2sec is empty\n");
237 for (Name2CellorSec::iterator it =
n2cs.begin(); it !=
n2cs.end(); ++it) {
241 si->pysec_type_ = cs.first ==
CELLTYPE ? PYSECOBJ : PYSECNAME;
242 si->pysec_ = (
Section*)cs.second;
249 for (Name2CellorSec::iterator it = n2s->begin(); it != n2s->end(); ++it) {
253 si->pysec_type_ = PYSECNAME;
254 si->pysec_ = (
Section*)cs.second;
void nrnpy_pysecname2sec_remove(Section *sec)
static void n2s_add(Name2CellorSec &n2s, std::string n, Section *sec)
static Name2CellorSec n2cs
int const size_t const size_t n
Section * nrnpy_pysecname2sec(const char *name)
const char * secname(Section *sec)
static Name2CellorSec * n2cs_add_cell(Name2CellorSec &n2cs, std::string cname)
void nrnpy_pysecname2sec_add(Section *sec)
#define ForAllSections(sec)
void n2cs_add(Name2CellorSec &n2cs, std::string cname, std::string sname, Section *sec)
void nrn_symdir_load_pysec(SymbolList &sl, void *v)
#define hoc_acterror(a, b)
std::pair< CorStype, void * > CellorSec
static bool decrement(CellorSec &cs)
static void n2cs_add_sec(Name2CellorSec &n2cs, std::string sname, Section *sec)
std::map< const std::string, CellorSec > Name2CellorSec
void * nrn_parsing_pysec_