Changeset 14
- Timestamp:
- 04/24/07 17:48:56 (2 years ago)
- Files:
-
- branches/pygetsetcall/src/nrnpython/nrnpy_hoc.cpp (modified) (8 diffs)
- branches/pygetsetcall/src/nrnpython/nrnpy_nrn.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/pygetsetcall/src/nrnpython/nrnpy_hoc.cpp
r13 r14 22 22 extern void hoc_call(); 23 23 extern Objectdata* hoc_top_level_data; 24 extern void sec_access_push(); 25 myPyMODINIT_FUNC nrnpy_nrn(); 26 extern PyObject* nrnpy_cas(PyObject*, PyObject*); 24 27 /* 25 28 Because python types have so many methods, attempt to do all set and get … … 303 306 return sym->arayinfo; 304 307 }else{ 305 hoc_top_level_data[sym->u.oboff + 1].arayinfo;308 return hoc_top_level_data[sym->u.oboff + 1].arayinfo; 306 309 } 307 310 } … … 355 358 hoc_objectvar(); 356 359 hoc_pc = pcsav; 360 } 361 362 static PyObject* hocobj_getsec(Symbol* sym) { 363 Inst fc; 364 fc.sym = sym; 365 Inst* pcsav = save_pc(&fc); 366 sec_access_push(); 367 hoc_pc = pcsav; 368 PyObject* result = nrnpy_cas(0, 0); 369 nrn_popsec(); 370 return result; 357 371 } 358 372 … … 430 444 ((PyHocObject*)result)->type_ = 1; 431 445 hoc_obj_ref(((PyHocObject*)result)->ho_); 446 }else{ 447 result = (PyObject*)intermediate(self, sym, -1); 448 } 449 break; 450 case SECTION: 451 if (!ISARRAY(sym)) { 452 result = hocobj_getsec(sym); 432 453 }else{ 433 454 result = (PyObject*)intermediate(self, sym, -1); … … 559 580 */ 560 581 static PyObject* hocobj_getitem(PyObject* self, int ix) { 561 //printf("hocobj_getitem %d\n", i);562 582 PyObject* result = NULL; 563 583 PyHocObject* po = (PyHocObject*)self; … … 589 609 ((PyHocObject*)result)->type_ = 1; 590 610 hoc_obj_ref(((PyHocObject*)result)->ho_); 611 break; 612 case SECTION: 613 hocobj_pushtop(po, 0, ix); 614 result = hocobj_getsec(po->sym_); 591 615 break; 592 616 } … … 635 659 err = 1; 636 660 } 661 break; 662 default: 663 PyErr_SetString(PyExc_TypeError, "not assignable"); 637 664 break; 638 665 } … … 710 737 //printf("AddObject HocObject\n"); 711 738 PyModule_AddObject(m, "HocObject", (PyObject*)hocobject_type); 739 nrnpy_nrn(); 712 740 } 713 741 branches/pygetsetcall/src/nrnpython/nrnpy_nrn.cpp
r1 r14 632 632 }; 633 633 634 static PyObject*cas(PyObject* self, PyObject* args) {634 PyObject* nrnpy_cas(PyObject* self, PyObject* args) { 635 635 Section* sec = chk_access(); 636 636 NPySecObj* pysec = NULL; … … 649 649 650 650 static PyMethodDef nrnpy_methods[] = { 651 {"cas", cas, METH_VARARGS, "Return the currently accesses section." },651 {"cas", nrnpy_cas, METH_VARARGS, "Return the currently accesses section." }, 652 652 {NULL} 653 653 };

