2 #include <../../nrnconf.h> 53 static void point_menu(
Object*,
int);
88 char *
strstr(
const char *,
const char *);
95 for (sp = hoc_built_in_symlist->
first; sp; sp = sp->
next) {
114 for (sp = hoc_built_in_symlist->
first; sp; sp = sp->
next) {
115 if (sp->type == MECHANISM && sp->subtype !=
MORPHOLOGY 117 sprintf(buf,
"nrnglobalmechmenu(\"%s\")", sp->name);
129 for (sp = hoc_built_in_symlist->
first; sp; sp = sp->
next) {
130 if (sp->type == VAR && sp->subtype ==
USERDOUBLE 131 && (s =
strstr(sp->name, suffix)) != 0
132 && s[strlen(suffix)] ==
'\0'){
139 sprintf(buf,
"%s (Globals)", name);
141 for (sp = hoc_built_in_symlist->
first; sp; sp = sp->
next) {
142 if (sp->type == VAR && sp->subtype ==
USERDOUBLE 143 && (s =
strstr(sp->name, suffix)) != 0
144 && s[strlen(suffix)] ==
'\0'){
149 for (i=0; i < a->
sub[0]; i++) {
151 sprintf(buf,
"%s[%d]", sp->name, i);
152 sprintf(n,
"%s[%d]", sp->name, i);
184 btype =
"(Parameters)";
190 btype =
"(Assigned)";
203 node = sec->
pnode[0];
239 pnodemenu(p, x,
type, 0, ms);
249 pnodemenu(p1->
next, x,
type, path, ms);
253 mech_menu(p1, x,
type, path, ms);
259 static bool nrn_is_const(
const char* path,
const char*
name) {
262 "%s for (hoc_ac_) if (hoc_ac_ > 0 && hoc_ac_ < 1) if (%s(hoc_ac_) != %s(.5)) {hoc_ac_ = 0 break}\n",
287 for (j=0; j < sym->
s_varn; j++ ) {
290 if (vsym->
type == RANGEVAR) {
294 for (i=0; i < a->
sub[0]; i++) {
298 if (nrn_is_const(path, n)) {
299 sprintf(buf,
"%s.%s", path, n);
302 sprintf(buf,
"%s is not constant", n);
312 if (nrn_is_const(path, vsym->
name)) {
350 for (i=1; (sp = pointsym[
i]) != (
Symbol *)0; i++) {
351 sprintf(buf,
"nrnallpointmenu(%d)", i);
360 if ((psym = pointsym[i]) != (
Symbol *)0) {
365 bool locmenu =
false;
372 bool are_globals =
false;
387 sprintf(buf,
"nrnpointmenu(%p)", ob);
395 sprintf(buf,
"nrnglobalmechmenu(\"%s\")", psym->
name);
417 ob->ctemplate->symtable);
419 hoc_execerror(ob->ctemplate->sym->name,
"not a point process");
425 point_menu(ob, make_label);
432 static void point_menu(
Object* ob,
int make_label) {
450 }
else if (make_label== 0){
452 }
else if (make_label==-1){
472 for (k=0; k < psym->
s_varn; k++ ) {
477 #if defined(MikeNeubig) 479 #endif // end of hack 539 double x =
chkarg(1, 0, 1);
553 hoc_execerror(
"Object arg must be MechanismStandard or a Point Process, not",
567 double x =
chkarg(1, 0, 1);
581 hoc_execerror(
"Object arg must be MechanismStandard or a Point Process or a nrn.Segment, not",
666 ms_class_sym_ =
hoc_lookup(
"MechanismStandard");
681 for (sp = hoc_built_in_symlist->
first; sp; sp = sp->
next) {
684 && s[strlen(suffix)] ==
'\0'){
690 for (sp = hoc_built_in_symlist->
first; sp; sp = sp->
next) {
693 && s[strlen(suffix)] ==
'\0'){
701 if (type < vartype) {
703 }
else if (vartype == 0 || type == vartype) {
758 pyactval = (*nrnpy_callable_with_args)(
pyact_, 3);
765 true,
false,
true, sym->
extra);
770 for (j=1; j < size; ++
j) {
777 pyactval = (*nrnpy_callable_with_args)(
pyact_, 3);
786 true,
false,
true, sym->
extra);
845 for (
int i = 0;
i < sec->
nnode; ++
i) {
866 std::ostream&
o = *po;
868 sprintf(buf,
"%s = new MechanismStandard(\"%s\")", obref,
np_->
name());
869 o << buf << std::endl;
873 for (i=0; i <
cnt; ++
i) {
874 sprintf(buf,
"%s.set(\"%s\", %g, %d)", obref, sym->name,
876 o << buf << std::endl;
884 hoc_execerror(s,
" MechanismStandard method not implemented for GLOBAL type");
996 return double(mt->
count());
1054 static const char*
nullstr =
"";
1066 static const char*
nullstr =
"";
1112 NULL, mt_retobj_members, mt_retstr_func);
1284 oc.
run(
"{xmenu(\"MechType\")}\n");
1296 sprintf(buf,
"xbutton(\"%s\", \"hoc_ac_=%d %s\")\n",
1303 oc.
run(
"{xmenu()}\n");
1316 }
else if (index >=
count()) {
int var_type(Symbol *) const
char * hoc_section_pathname(Section *sec)
void action(const char *, Object *pyact)
size_t hoc_total_array_data(Symbol *s, Objectdata *obd)
char * strstr(cs, ct) char *cs
void hoc_ivpvalue(CChar *name, double *, bool deflt=false, HocSymExtension *extra=NULL)
MechanismStandard(const char *, int vartype)
void section_menu(double, int, MechSelector *=NULL)
Point_process * pp_begin()
int hoc_is_str_arg(int narg)
void point_process(Object **)
bool is_netcon_target(int)
Point_process * pp_next()
#define ITERATE(itm, lst)
int hoc_is_double_arg(int narg)
double nrn_arc_position(Section *sec, Node *node)
Symbol * hoc_lookup(const char *)
void in(Section *, double x=-1.)
char * hoc_object_name(Object *ob)
#define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v)
void select(const char *)
void hoc_ivlabel(CChar *)
static const char * nullstr
double * prop_pval(const Symbol *, int arrayindex=0) const
void set(const char *, double val, int arrayindex=0)
char ** hoc_pgargstr(int narg)
bool is_selected(int type)
static philox4x32_key_t k
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
void save(const char *, std::ostream *)
void hoc_ivvalue(CChar *name, CChar *variable, bool deflt=false, Object *pyvar=0)
const char * string() const
const char * sec_and_position(Section *sec, Node *nd)
static double done(void *v)
void hoc_assign_str(char **cpp, const char *buf)
int nrn_vartype(Symbol *sym)
HocSymExtension * hoc_var_extra(const char *name)
int const size_t const size_t n
HocStruct Symbol ** ppsym
#define TRY_GUI_REDIRECT_DOUBLE(name, obj)
static ostream * save_stream
void hoc_ivbutton(CChar *name, CChar *action, Object *pyact=0)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
void hoc_obj_unref(Object *obj)
const char * secname(Section *sec)
void nrn_pushsec(Section *sec)
double get(const char *, int arrayindex=0)
void hoc_execerror(const char *, const char *)
void hoc_ivpanel(CChar *, bool h=false)
void panel(const char *label=NULL)
void hoc_dec_refcount(Object **pobj)
int is_point_process(Object *)
void hoc_push_object(Object *d)
MechanismType(bool point_process)
virtual void unref() const
static bool assign(Prop *src, Prop *dest, int vartype=0)
Prop * nrn_mechanism(int type, Node *nd)
void hoc_obj_ref(Object *obj)
void hoc_ivmenu(CChar *, bool add2menubar=false)
void out(Section *, double x=-1.)
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
static char * stmp[HOC_TEMP_CHARPTR_SIZE]
void hoc_ivpanelmap(int scroll=-1)
void hoc_ivvaluerun(CChar *name, CChar *variable, CChar *action, bool deflt=false, bool canrun=false, bool usepointer=false, Object *pyvar=0, Object *pyact=0)
HocStruct cTemplate * ctemplate
const char * name() const
void hoc_ivvaluerun_ex(CChar *name, CChar *var, double *pvar, Object *pyvar, CChar *action, Object *pyact, bool deflt=false, bool canrun=false, bool usepointer=false, HocSymExtension *extra=NULL)
Symbol * hoc_table_lookup(const char *, Symlist *)
double * hoc_val_pointer(const char *s)
void hoc_ivpvaluerun(CChar *name, double *, CChar *action, bool deflt=false, bool canrun=false, HocSymExtension *extra=NULL)
int is_obj_type(Object *obj, const char *type_name)
void action(const char *, Object *pyact)
int hoc_is_object_arg(int narg)
virtual ~MechanismStandard()
Object ** hoc_temp_objptr(Object *)
static Node * node(Object *)
int run(int argc, const char **argv)
Object ** hoc_objgetarg(int)
Symbol * find(const char *rangevar)
Section * chk_access(void)
Node * node_exact(Section *sec, double x)
double chkarg(int, double low, double high)
static void make_section_browser()