NEURON
gui-redirect.h
Go to the documentation of this file.
1 #ifndef gui_redirect_h
2 #define gui_redirect_h
3 
4 #include "hocdec.h"
5 
6 
8 extern Object** (*nrnpy_gui_helper_)(const char*, Object*);
9 extern double (*nrnpy_object_to_double_)(Object*);
10 
11 
12 #define TRY_GUI_REDIRECT_OBJ(name, obj) {\
13  Object** ngh_result;\
14  if (nrnpy_gui_helper_) {\
15  ngh_result = nrnpy_gui_helper_(name, (Object*) obj);\
16  if (ngh_result) {\
17  return (void*) *ngh_result;\
18  }\
19  }\
20 }
21 
22 #define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v) {\
23  Object** guiredirect_result = NULL;\
24  if (nrnpy_gui_helper_) {\
25  Object* obj = nrn_get_gui_redirect_obj();\
26  guiredirect_result = nrnpy_gui_helper_(name, obj);\
27  if (guiredirect_result) {\
28  return(nrnpy_object_to_double_(*guiredirect_result));\
29  }\
30  }\
31 }
32 
33 #define TRY_GUI_REDIRECT_METHOD_ACTUAL_OBJ(name, sym, v) {\
34  Object** guiredirect_result = NULL;\
35  if (nrnpy_gui_helper_) {\
36  Object* obj = nrn_get_gui_redirect_obj();\
37  guiredirect_result = nrnpy_gui_helper_(name, obj);\
38  if (guiredirect_result) {\
39  return(guiredirect_result);\
40  }\
41  }\
42 }
43 
44 #define TRY_GUI_REDIRECT_NO_RETURN(name, obj) {\
45  Object** ngh_result;\
46  if (nrnpy_gui_helper_) {\
47  ngh_result = nrnpy_gui_helper_(name, (Object*) obj);\
48  if (ngh_result) {\
49  return;\
50  }\
51  }\
52 }
53 
54 #define TRY_GUI_REDIRECT_DOUBLE(name, obj) {\
55  Object** ngh_result;\
56  if (nrnpy_gui_helper_) {\
57  ngh_result = nrnpy_gui_helper_(name, (Object*) obj);\
58  if (ngh_result) {\
59  hoc_ret();\
60  hoc_pushx(nrnpy_object_to_double_(*ngh_result));\
61  return;\
62  }\
63  }\
64 }
65 
66 #define TRY_GUI_REDIRECT_ACTUAL_DOUBLE(name, obj) {\
67  Object** ngh_result;\
68  if (nrnpy_gui_helper_) {\
69  ngh_result = nrnpy_gui_helper_(name, (Object*) obj);\
70  if (ngh_result) {\
71  return(nrnpy_object_to_double_(*ngh_result));\
72  }\
73  }\
74 }
75 
76 #define TRY_GUI_REDIRECT_ACTUAL_STR(name, obj) {\
77  char** ngh_result;\
78  if (nrnpy_gui_helper_) {\
79  ngh_result = nrnpy_gui_helper3_str_(name, (Object*) obj, 0);\
80  if (ngh_result) {\
81  return((const char**) ngh_result);\
82  }\
83  }\
84 }
85 
86 #define TRY_GUI_REDIRECT_ACTUAL_OBJ(name, obj) {\
87  Object** ngh_result;\
88  if (nrnpy_gui_helper_) {\
89  ngh_result = nrnpy_gui_helper_(name, (Object*) obj);\
90  if (ngh_result) {\
91  return ngh_result;\
92  }\
93  }\
94 }
95 
96 #define TRY_GUI_REDIRECT_DOUBLE_SEND_STRREF(name, obj) {\
97  Object** ngh_result;\
98  if (nrnpy_gui_helper_) {\
99  ngh_result = nrnpy_gui_helper3_(name, (Object*) obj, 1);\
100  if (ngh_result) {\
101  hoc_ret();\
102  hoc_pushx(nrnpy_object_to_double_(*ngh_result));\
103  return;\
104  }\
105  }\
106 }
107 
108 #endif
double(* nrnpy_object_to_double_)(Object *)
Definition: xmenu.cpp:14
Object * nrn_get_gui_redirect_obj()
Definition: hoc_oop.cpp:725
Definition: hocdec.h:226