JNIEXPORT jlong JNICALL Java_neuron_Neuron_getNewHObject (JNIEnv *env, jclass, jstring name, jint narg){ jnisave const char* cn = env->GetStringUTFChars(name, 0); // Symbol* s = hoc_table_lookup(cn, hoc_top_level_symlist); Symbol* s = hoc_lookup(cn); if (!s || s->type != TEMPLATE) { printf("getNewHObject could not lookup %s or it is not a template.\n", cn); return 0; } env->ReleaseStringUTFChars(name, cn); Object* o = hoc_newobj1(s, narg); hoc_obj_ref(o); jnirestore return (jlong)o; }
static void alloc_pnt(Prop* p) { // this is complex because it can be called either before or // after the hoc object has been created. And so there // must be communication between alloc_pnt and hoc_construct_point. // need the prop->dparam[1]._pvoid if (nrn_point_prop_) { p->dparam = nrn_point_prop_->dparam; p->ob = nrn_point_prop_->ob; //printf("p->ob comes from nrn_point_prop_ %s\n", hoc_object_name(p->ob)); }else{ p->dparam = (Datum*)hoc_Ecalloc(2, sizeof(Datum)); if (last_created_pp_ob_) { p->ob = last_created_pp_ob_; //printf("p->ob comes from last_created %s\n", hoc_object_name(p->ob)); }else{ Symbol* mech = ((HocMech*)memb_func[p->type].hoc_mech)->mech; skip_ = true; //printf("p->ob comes from hoc_newobj1 %s\n", mech->name); p->ob = hoc_newobj1(mech, 0); skip_ = false; } } last_created_pp_ob_ = nil; }
Object* hoc_new_opoint(int type) { HocMech* hm = (HocMech*)memb_func[type].hoc_mech; return hoc_newobj1(hm->mech, 0); }
static void alloc_mech(Prop* p) { Symbol* mech = ((HocMech*)memb_func[p->type].hoc_mech)->mech; p->ob = hoc_newobj1(mech, 0); //printf("alloc_mech %s\n", hoc_object_name(p->ob)); }