NEURON
nrnpy_p2h.cpp File Reference
#include <../../nrnconf.h>
#include <stdio.h>
#include <InterViews/resource.h>
#include <nrnoc2iv.h>
#include <classreg.h>
#include <nrnpython.h>
#include <hoccontext.h>
#include "nrnpy_utils.h"
#include "parse.hpp"
#include "nrnmpi.h"

Go to the source code of this file.

Classes

struct  NPySecObj
 
class  Py2Nrn
 

Functions

void hoc_nopop ()
 
void hoc_pop_defer ()
 
Objecthoc_new_object (Symbol *, void *)
 
int hoc_stack_type ()
 
char ** hoc_strpop ()
 
Object ** hoc_objpop ()
 
Objecthoc_pop_object ()
 
void hoc_tobj_unref (Object **)
 
int hoc_ipop ()
 
PyObject * nrnpy_hoc2pyobject (Object *)
 
PyObject * hocobj_call_arg (int)
 
Objectnrnpy_pyobject_in_obj (PyObject *)
 
int nrnpy_ho_eq_po (Object *, PyObject *)
 
char * nrnpyerr_str ()
 Full python traceback error message returned as string. More...
 
static voidsave_thread ()
 
static void restore_thread (void *g)
 
NPySecObjnewpysechelp (Section *sec)
 
void nrnpython_reg_real ()
 
PyObject * nrnpy_ho2po (Object *)
 
void nrnpy_decref_defer (PyObject *)
 
PyObject * nrnpy_pyCallObject (PyObject *, PyObject *)
 
Objectnrnpy_po2ho (PyObject *)
 
static void py2n_component (Object *, Symbol *, int, int)
 
static void hpoasgn (Object *, int)
 
static double praxis_efun (Object *, Object *)
 
static int hoccommand_exec (Object *)
 
static int hoccommand_exec_strret (Object *, char *, int)
 
static void grphcmdtool (Object *, int, double, double, int)
 
static double func_call (Object *, int, int *)
 
static Objectcallable_with_args (Object *, int)
 
static double guigetval (Object *)
 
static void guisetval (Object *, double)
 
static int guigetstr (Object *, char **)
 
static char * po2pickle (Object *, size_t *size)
 
static Objectpickle2po (char *, size_t size)
 
static char * call_picklef (char *, size_t size, int narg, size_t *retsize)
 
static Objectpy_alltoall_type (int, int)
 
static int pysame (Object *, Object *)
 
static voidp_cons (Object *)
 
static void p_destruct (void *v)
 
static void call_python_with_section (Object *pyact, Section *sec)
 
static voidopaque_obj2pyobj (Object *ho)
 
static PyObject * hoccommand_exec_help1 (PyObject *po)
 
static PyObject * hoccommand_exec_help (Object *ho)
 
static void setpickle ()
 
static char * pickle (PyObject *p, size_t *size)
 
static PyObject * unpickle (char *s, size_t size)
 
int * mk_displ (int *cnts)
 
static PyObject * char2pylist (char *buf, int np, int *cnt, int *displ)
 

Variables

void *(* nrnpy_save_thread )()
 
void(* nrnpy_restore_thread )(void *)
 
Symbolnrnpy_pyobj_sym_
 
void(* nrnpy_py2n_component )(Object *, Symbol *, int, int)
 
void(* nrnpy_hpoasgn )(Object *, int)
 
double(* nrnpy_praxis_efun )(Object *, Object *)
 
int(* nrnpy_hoccommand_exec )(Object *)
 
int(* nrnpy_hoccommand_exec_strret )(Object *, char *, int)
 
void(* nrnpy_cmdtool )(Object *, int, double, double, int)
 
double(* nrnpy_func_call )(Object *, int, int *)
 
Object *(* nrnpy_callable_with_args )(Object *, int)
 
double(* nrnpy_guigetval )(Object *)
 
void(* nrnpy_guisetval )(Object *, double)
 
int(* nrnpy_guigetstr )(Object *, char **)
 
char *(* nrnpy_po2pickle )(Object *, size_t *size)
 
Object *(* nrnpy_pickle2po )(char *, size_t size)
 
char *(* nrnpy_callpicklef )(char *, size_t size, int narg, size_t *retsize)
 
int(* nrnpy_pysame )(Object *, Object *)
 
Object *(* nrnpympi_alltoall_type )(int, int)
 
void(* nrnpy_call_python_with_section )(Object *, Section *)
 
static PyObject * main_module
 
static PyObject * main_namespace
 
static hoc_Listdlist
 
Member_func p_members [] = {0, 0}
 
void *(* nrnpy_opaque_obj2pyobj_p_ )(Object *)
 
static PyObject * loads
 
static PyObject * dumps
 

Function Documentation

◆ call_picklef()

char * call_picklef ( char *  fname,
size_t  size,
int  narg,
size_t *  retsize 
)
static

Definition at line 837 of file nrnpy_p2h.cpp.

◆ call_python_with_section()

static void call_python_with_section ( Object pyact,
Section sec 
)
static

Definition at line 107 of file nrnpy_p2h.cpp.

◆ callable_with_args()

static Object * callable_with_args ( Object ho,
int  narg 
)
static

Definition at line 561 of file nrnpy_p2h.cpp.

◆ char2pylist()

static PyObject* char2pylist ( char *  buf,
int  np,
int *  cnt,
int *  displ 
)
static

Definition at line 891 of file nrnpy_p2h.cpp.

◆ func_call()

static double func_call ( Object ho,
int  narg,
int *  err 
)
static

Definition at line 595 of file nrnpy_p2h.cpp.

◆ grphcmdtool()

static void grphcmdtool ( Object ho,
int  type,
double  x,
double  y,
int  key 
)
static

Definition at line 537 of file nrnpy_p2h.cpp.

◆ guigetstr()

static int guigetstr ( Object ho,
char **  cpp 
)
static

Definition at line 685 of file nrnpy_p2h.cpp.

◆ guigetval()

static double guigetval ( Object ho)
static

Definition at line 656 of file nrnpy_p2h.cpp.

◆ guisetval()

static void guisetval ( Object ho,
double  x 
)
static

Definition at line 672 of file nrnpy_p2h.cpp.

◆ hoc_ipop()

int hoc_ipop ( )

◆ hoc_new_object()

Object* hoc_new_object ( Symbol symtemp,
void v 
)

Definition at line 457 of file hoc_oop.cpp.

◆ hoc_nopop()

void hoc_nopop ( )

◆ hoc_objpop()

Object** hoc_objpop ( )

Definition at line 860 of file code.cpp.

◆ hoc_pop_defer()

void hoc_pop_defer ( )

Definition at line 257 of file code.cpp.

◆ hoc_pop_object()

Object* hoc_pop_object ( )

Definition at line 871 of file code.cpp.

◆ hoc_stack_type()

int hoc_stack_type ( )

Definition at line 654 of file code.cpp.

◆ hoc_strpop()

char** hoc_strpop ( )

Definition at line 879 of file code.cpp.

◆ hoc_tobj_unref()

void hoc_tobj_unref ( Object **  p)

Definition at line 226 of file code.cpp.

◆ hoccommand_exec()

static int hoccommand_exec ( Object ho)
static

Definition at line 491 of file nrnpy_p2h.cpp.

◆ hoccommand_exec_help()

static PyObject* hoccommand_exec_help ( Object ho)
static

Definition at line 455 of file nrnpy_p2h.cpp.

◆ hoccommand_exec_help1()

static PyObject* hoccommand_exec_help1 ( PyObject *  po)
static

Definition at line 429 of file nrnpy_p2h.cpp.

◆ hoccommand_exec_strret()

static int hoccommand_exec_strret ( Object ho,
char *  buf,
int  size 
)
static

Definition at line 511 of file nrnpy_p2h.cpp.

◆ hocobj_call_arg()

PyObject* hocobj_call_arg ( int  i)

Definition at line 700 of file nrnpy_hoc.cpp.

◆ hpoasgn()

static void hpoasgn ( Object o,
int  type 
)
static

Definition at line 371 of file nrnpy_p2h.cpp.

◆ mk_displ()

int* mk_displ ( int *  cnts)

Definition at line 882 of file nrnpy_p2h.cpp.

◆ newpysechelp()

NPySecObj* newpysechelp ( Section sec)

Definition at line 865 of file nrnpy_nrn.cpp.

◆ nrnpy_decref_defer()

void nrnpy_decref_defer ( PyObject *  po)

Definition at line 418 of file nrnpy_p2h.cpp.

◆ nrnpy_ho2po()

PyObject* nrnpy_ho2po ( Object o)

Definition at line 499 of file nrnpy_hoc.cpp.

◆ nrnpy_ho_eq_po()

int nrnpy_ho_eq_po ( Object ho,
PyObject *  po 
)

Definition at line 182 of file nrnpy_p2h.cpp.

◆ nrnpy_hoc2pyobject()

PyObject* nrnpy_hoc2pyobject ( Object ho)

Definition at line 196 of file nrnpy_p2h.cpp.

◆ nrnpy_po2ho()

Object* nrnpy_po2ho ( PyObject *  po)

Definition at line 520 of file nrnpy_hoc.cpp.

◆ nrnpy_pyCallObject()

PyObject * nrnpy_pyCallObject ( PyObject *  callable,
PyObject *  args 
)

if (!p) { char* mes = nrnpyerr_str(); if (mes) { Fprintf(stderr, "%s\n", mes); free(mes); hoc_execerror("Call of Python Callable failed", NULL); } if (PyErr_Occurred()) { PyErr_Print(); // Python process will exit with the error code specified by the SystemExit instance. } }

Definition at line 220 of file nrnpy_p2h.cpp.

◆ nrnpy_pyobject_in_obj()

Object* nrnpy_pyobject_in_obj ( PyObject *  po)

Definition at line 210 of file nrnpy_p2h.cpp.

◆ nrnpyerr_str()

char * nrnpyerr_str ( )

Full python traceback error message returned as string.

Caller should free the return value if not NULL

Definition at line 779 of file nrnpy_p2h.cpp.

◆ nrnpython_reg_real()

void nrnpython_reg_real ( )

Definition at line 138 of file nrnpy_p2h.cpp.

◆ opaque_obj2pyobj()

static void* opaque_obj2pyobj ( Object ho)
static

Definition at line 131 of file nrnpy_p2h.cpp.

◆ p_cons()

static void* p_cons ( Object )
static

Definition at line 96 of file nrnpy_p2h.cpp.

◆ p_destruct()

static void p_destruct ( void v)
static

Definition at line 101 of file nrnpy_p2h.cpp.

◆ pickle()

static char* pickle ( PyObject *  p,
size_t *  size 
)
static

Definition at line 728 of file nrnpy_p2h.cpp.

◆ pickle2po()

static Object * pickle2po ( char *  s,
size_t  size 
)
static

Definition at line 768 of file nrnpy_p2h.cpp.

◆ po2pickle()

static char * po2pickle ( Object ho,
size_t *  size 
)
static

Definition at line 747 of file nrnpy_p2h.cpp.

◆ praxis_efun()

static double praxis_efun ( Object ho,
Object v 
)
static

Definition at line 461 of file nrnpy_p2h.cpp.

◆ py2n_component()

void py2n_component ( Object ob,
Symbol sym,
int  nindex,
int  isfunc 
)
static

Definition at line 255 of file nrnpy_p2h.cpp.

◆ py_alltoall_type()

Object * py_alltoall_type ( int  size,
int  type 
)
static

Definition at line 988 of file nrnpy_p2h.cpp.

◆ pysame()

int pysame ( Object o1,
Object o2 
)
static

Definition at line 189 of file nrnpy_p2h.cpp.

◆ restore_thread()

static void restore_thread ( void g)
static

Definition at line 31 of file nrnpy_p2h.cpp.

◆ save_thread()

static void* save_thread ( )
static

Definition at line 28 of file nrnpy_p2h.cpp.

◆ setpickle()

static void setpickle ( )
static

Definition at line 708 of file nrnpy_p2h.cpp.

◆ unpickle()

static PyObject* unpickle ( char *  s,
size_t  size 
)
static

Definition at line 758 of file nrnpy_p2h.cpp.

Variable Documentation

◆ dlist

hoc_List* dlist
static

Definition at line 82 of file nrnpy_p2h.cpp.

◆ dumps

PyObject* dumps
static

Definition at line 706 of file nrnpy_p2h.cpp.

◆ loads

PyObject* loads
static

Definition at line 705 of file nrnpy_p2h.cpp.

◆ main_module

PyObject* main_module
static

Definition at line 80 of file nrnpy_p2h.cpp.

◆ main_namespace

PyObject* main_namespace
static

Definition at line 81 of file nrnpy_p2h.cpp.

◆ nrnpy_call_python_with_section

void(* nrnpy_call_python_with_section) (Object *, Section *) ( Object ,
Section  
)
extern

Definition at line 20 of file secbrows.cpp.

◆ nrnpy_callable_with_args

Object*(* nrnpy_callable_with_args) (Object *, int) ( Object ,
int  narg 
)
extern

Definition at line 46 of file nrnmenu.cpp.

◆ nrnpy_callpicklef

char*(* nrnpy_callpicklef) (char *, size_t size, int narg, size_t *retsize) ( char *  ,
size_t  size,
int  narg,
size_t *  retsize 
)
extern

Definition at line 37 of file ocbbs.cpp.

◆ nrnpy_cmdtool

void(* nrnpy_cmdtool) (Object *, int, double, double, int) ( Object ,
int  type,
double  x,
double  y,
int  kd 
)
extern

Definition at line 19 of file objcmd.cpp.

◆ nrnpy_func_call

double(* nrnpy_func_call) (Object *, int, int *) ( Object ,
int  ,
int *   
)
extern

Definition at line 20 of file objcmd.cpp.

◆ nrnpy_guigetstr

int(* nrnpy_guigetstr) (Object *, char **) ( Object ,
char **   
)
extern

Definition at line 9 of file xmenu.cpp.

◆ nrnpy_guigetval

double(* nrnpy_guigetval) (Object *) ( Object )
extern

Definition at line 7 of file xmenu.cpp.

◆ nrnpy_guisetval

void(* nrnpy_guisetval) (Object *, double) ( Object ,
double   
)
extern

Definition at line 8 of file xmenu.cpp.

◆ nrnpy_hoccommand_exec

int(* nrnpy_hoccommand_exec) (Object *) ( Object )
extern

Definition at line 17 of file objcmd.cpp.

◆ nrnpy_hoccommand_exec_strret

int(* nrnpy_hoccommand_exec_strret) (Object *, char *, int) ( Object ,
char *  ,
int   
)
extern

Definition at line 18 of file objcmd.cpp.

◆ nrnpy_hpoasgn

void(* nrnpy_hpoasgn) (Object *, int) ( Object ,
int   
)
extern

◆ nrnpy_opaque_obj2pyobj_p_

void*(* nrnpy_opaque_obj2pyobj_p_) (Object *) ( Object )
extern

◆ nrnpy_pickle2po

Object*(* nrnpy_pickle2po) (char *, size_t size) ( char *  ,
size_t  size 
)
extern

Definition at line 36 of file ocbbs.cpp.

◆ nrnpy_po2pickle

char*(* nrnpy_po2pickle) (Object *, size_t *size) ( Object ,
size_t *  size 
)
extern

Definition at line 35 of file ocbbs.cpp.

◆ nrnpy_praxis_efun

double(* nrnpy_praxis_efun) (Object *, Object *) ( Object pycallable,
Object hvec 
)
extern

Definition at line 86 of file hocprax.cpp.

◆ nrnpy_py2n_component

void(* nrnpy_py2n_component) (Object *, Symbol *, int, int) ( Object ,
Symbol ,
int  ,
int   
)
extern

◆ nrnpy_pyobj_sym_

Symbol* nrnpy_pyobj_sym_
extern

◆ nrnpy_pysame

int(* nrnpy_pysame) (Object *, Object *) ( Object ,
Object  
)
extern

Definition at line 526 of file cvodeobj.cpp.

◆ nrnpy_restore_thread

void(* nrnpy_restore_thread) (void *) ( void )
extern

Definition at line 43 of file ivoc.cpp.

◆ nrnpy_save_thread

void*(* nrnpy_save_thread) () ( )
extern

Definition at line 42 of file ivoc.cpp.

◆ nrnpympi_alltoall_type

Object*(* nrnpympi_alltoall_type) (int, int) ( int  ,
int   
)
extern

Definition at line 38 of file ocbbs.cpp.

◆ p_members

Member_func p_members[] = {0, 0}

Definition at line 105 of file nrnpy_p2h.cpp.