Beispiel #1
0
void SPObjectName::execute() {
	if (Oc::helpmode()) {
		Oc::help(Scene_ObjectName_);
	}
	Scene* s = XYView::current_pick_view()->scene();
	printf("%s\n", hoc_object_name(s->hoc_obj_ptr()));
}
Beispiel #2
0
JNIEXPORT jstring JNICALL Java_neuron_Neuron_hocObjectName
  (JNIEnv *env, jclass, jlong jc) {
	Object* ho = (Object*)jc;
	char* s = hoc_object_name(ho);
	jstring js = env->NewStringUTF(s);
	return js;
}
Beispiel #3
0
static double tstop_event(void* v) {
	NetCvode* d = (NetCvode*)v;
	double x = *getarg(1);
	if (!cvode_active_) { // watch out for fixed step roundoff if x
		// close to n*dt
		double y = x/nrn_threads->_dt;
		if (y > 1 && fabs(floor(y + 1e-6) - y) < 1e-6) {
			//printf("reduce %g to avoid fixed step roundoff\n", x);
			x -= nrn_threads->_dt/4.;
		}
	}
	if (ifarg(2)) {
		Object* ppobj = nil;
		int reinit = 0;
		if (ifarg(3)) {
			ppobj = *hoc_objgetarg(3);
			if (!ppobj || ppobj->ctemplate->is_point_ <= 0
			    || nrn_is_artificial_[ob2pntproc(ppobj)->prop->type]
			){
				hoc_execerror(hoc_object_name(ppobj), "is not a POINT_PROCESS");
			}
			reinit = int(chkarg(4, 0, 1));
		}
	    if (hoc_is_object_arg(2)) {
		d->hoc_event(x, nil, ppobj, reinit, *hoc_objgetarg(2));
	    }else{		
		d->hoc_event(x, gargstr(2), ppobj, reinit);
	    }
	}else{
		//d->tstop_event(x);
		d->hoc_event(x, 0, 0, 0);
	}
	return x;
}
Beispiel #4
0
Point_process* ob2pntproc(Object* ob) {
	Point_process* pp = ob2pntproc_0(ob);
	if (!pp || !pp->prop) {
		 hoc_execerror(hoc_object_name(ob),"point process not located in a section");
	}
	return pp;
}
Beispiel #5
0
HocCommand::HocCommand(Object* pobj) {
	// must wrap a PyObject method or tuple of (method, arg1, ...)
	// hold a reference to the wrapped PyObject
	if (strcmp(pobj->ctemplate->sym->name, "PythonObject") != 0) {
		hoc_execerror(hoc_object_name(pobj), "not a PythonObject");
	}
	po_ = pobj;
	hoc_obj_ref(po_);
	s_ = NULL;
	obj_ = NULL;
}
Beispiel #6
0
static void overloaded(Object* ho, Symbol* method) {
	int n = strlen(method->name);
	printf("%s.%s Overloaded. Use one of:\n", hoc_object_name(ho), method->name);
	for (Symbol* s = ho->ctemplate->symtable->first; s; s = s->next) {
		if (s != method && strncmp(s->name, method->name, n) == 0
			&& isdigit(s->name[n])
		) {
			printf("	%s\n", s->name);
		}
	}
	hoc_execerror(method->name, "Overloaded.  Disambiguate using a more specific method.");
}
Beispiel #7
0
static double allprint(void* v) {
	int type, i, cnt;
	for (type=0; type < 4; ++type) {
		FIHList* fl = FInitialHandler::fihlist_[type];
		if (fl && fl->count() > 0) {
			cnt = fl->count();
			printf("Type %d FInitializeHandler statements\n", type);
			for (i=0; i < cnt; ++i) {
				FInitialHandler* f = fl->item(i);
				if (f->stmt_->pyobject()) {
printf("\t%s\n", hoc_object_name(f->stmt_->pyobject()));
				}else if (f->stmt_->object()) {
printf("\t%s.%s\n", hoc_object_name(f->stmt_->object()), f->stmt_->name());
				}else{
					printf("\t%s\n", f->stmt_->name());
				}
			}
		}
	}
	return 0.;
}
Beispiel #8
0
void VecPlayContinuous::pr() {
	printf("VecPlayContinuous ");
	printf("%s.x[%d]\n", hoc_object_name(y_->obj_), last_index_);
}
Beispiel #9
0
void VecPlayStep::pr() {
	printf("VecPlayStep ");
	printf("%s.x[%d]\n", hoc_object_name(y_->obj_), current_index_);
}
Beispiel #10
0
void KSSingleNodeData::pr(const char* s, double tt, NetCvode* nc) {
	printf("%s %s %.15g\n", s, hoc_object_name((*ppnt_)->ob), tt);
}