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  { \
14  Object** ngh_result; \
15  if (nrnpy_gui_helper_) { \
16  ngh_result = nrnpy_gui_helper_(name, (Object*) obj); \
17  if (ngh_result) { \
18  return (void*) *ngh_result; \
19  } \
20  } \
21  }
22 
23 #define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v) \
24  { \
25  Object** guiredirect_result = NULL; \
26  if (nrnpy_gui_helper_) { \
27  Object* obj = nrn_get_gui_redirect_obj(); \
28  guiredirect_result = nrnpy_gui_helper_(name, obj); \
29  if (guiredirect_result) { \
30  return (nrnpy_object_to_double_(*guiredirect_result)); \
31  } \
32  } \
33  }
34 
35 #define TRY_GUI_REDIRECT_METHOD_ACTUAL_OBJ(name, sym, v) \
36  { \
37  Object** guiredirect_result = NULL; \
38  if (nrnpy_gui_helper_) { \
39  Object* obj = nrn_get_gui_redirect_obj(); \
40  guiredirect_result = nrnpy_gui_helper_(name, obj); \
41  if (guiredirect_result) { \
42  return (guiredirect_result); \
43  } \
44  } \
45  }
46 
47 #define TRY_GUI_REDIRECT_NO_RETURN(name, obj) \
48  { \
49  Object** ngh_result; \
50  if (nrnpy_gui_helper_) { \
51  ngh_result = nrnpy_gui_helper_(name, (Object*) obj); \
52  if (ngh_result) { \
53  return; \
54  } \
55  } \
56  }
57 
58 #define TRY_GUI_REDIRECT_DOUBLE(name, obj) \
59  { \
60  Object** ngh_result; \
61  if (nrnpy_gui_helper_) { \
62  ngh_result = nrnpy_gui_helper_(name, (Object*) obj); \
63  if (ngh_result) { \
64  hoc_ret(); \
65  hoc_pushx(nrnpy_object_to_double_(*ngh_result)); \
66  return; \
67  } \
68  } \
69  }
70 
71 #define TRY_GUI_REDIRECT_ACTUAL_DOUBLE(name, obj) \
72  { \
73  Object** ngh_result; \
74  if (nrnpy_gui_helper_) { \
75  ngh_result = nrnpy_gui_helper_(name, (Object*) obj); \
76  if (ngh_result) { \
77  return (nrnpy_object_to_double_(*ngh_result)); \
78  } \
79  } \
80  }
81 
82 #define TRY_GUI_REDIRECT_ACTUAL_STR(name, obj) \
83  { \
84  char** ngh_result; \
85  if (nrnpy_gui_helper_) { \
86  ngh_result = nrnpy_gui_helper3_str_(name, (Object*) obj, 0); \
87  if (ngh_result) { \
88  return ((const char**) ngh_result); \
89  } \
90  } \
91  }
92 
93 #define TRY_GUI_REDIRECT_ACTUAL_OBJ(name, obj) \
94  { \
95  Object** ngh_result; \
96  if (nrnpy_gui_helper_) { \
97  ngh_result = nrnpy_gui_helper_(name, (Object*) obj); \
98  if (ngh_result) { \
99  return ngh_result; \
100  } \
101  } \
102  }
103 
104 #define TRY_GUI_REDIRECT_DOUBLE_SEND_STRREF(name, obj) \
105  { \
106  Object** ngh_result; \
107  if (nrnpy_gui_helper_) { \
108  ngh_result = nrnpy_gui_helper3_(name, (Object*) obj, 1); \
109  if (ngh_result) { \
110  hoc_ret(); \
111  hoc_pushx(nrnpy_object_to_double_(*ngh_result)); \
112  return; \
113  } \
114  } \
115  }
116 
117 #endif
double(* nrnpy_object_to_double_)(Object *)
Definition: xmenu.cpp:14
Object * nrn_get_gui_redirect_obj()
Definition: hoc_oop.cpp:711
Definition: hocdec.h:227