Changeset 640:237cf6339546 in freeDiameter for extensions/dbg_interactive/dbg_interactive.i
- Timestamp:
- Dec 20, 2010, 7:36:40 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_interactive/dbg_interactive.i
r638 r640 68 68 static int wrapper_errno; 69 69 static PyObject* wrapper_errno_py; 70 static c har * wrapper_error_txt; /* if NULL, use strerror(errno) */70 static const char * wrapper_error_txt; /* if NULL, use strerror(errno) */ 71 71 #define DI_ERROR(code, pycode, str) { \ 72 72 fd_log_debug("[dbg_interactive] ERROR: %s: %s\n", __PRETTY_FUNCTION__, str ? str : strerror(code)); \ … … 88 88 /* Now, test for error */ 89 89 if (wrapper_errno) { 90 c har * str = wrapper_error_txt ? wrapper_error_txt : strerror(wrapper_errno);90 const char * str = wrapper_error_txt ? wrapper_error_txt : strerror(wrapper_errno); 91 91 PyObject * exc = wrapper_errno_py; 92 92 if (!exc) { … … 109 109 ***********************************/ 110 110 111 %apply (char *STRING, size_t LENGTH) { ( char * string, size_t len ) }; /* fd_hash */111 %apply (char *STRING, size_t LENGTH) { ( char * string, size_t len ) }; 112 112 113 113 /* Generic typemap for functions that create something */ … … 119 119 } 120 120 121 /* Typemap to return a boolean value as output parameter */ 122 %typemap(in, numinputs=0,noblock=1) int * BOOL_OUT (int temp) { 123 $1 = &temp; 124 } 125 %typemap(argout,noblock=1) int * BOOL_OUT { 126 PyObject * r; 127 if (*$1) 128 r = Py_True; 129 else 130 r = Py_False; 131 Py_XINCREF(r); 132 %append_output(r); 133 } 134 121 135 /* To allow passing callback functions defined in python */ 122 136 %typemap(in) PyObject *PyCb { 123 if (!PyCallable_Check($input)) { 124 PyErr_SetString(PyExc_TypeError, "Need a callable object!"); 125 SWIG_fail; 137 if (!$input || ($input == Py_None)) { 138 $1 = NULL; 139 } else { 140 if (!PyCallable_Check($input)) { 141 PyErr_SetString(PyExc_TypeError, "Need a callable object!"); 142 SWIG_fail; 143 } 144 $1 = $input; 126 145 } 127 $1 = $input;128 146 } 129 147 130 148 %{ 131 149 /* Forward declaration for the peers module */ 132 %{133 150 static void fd_add_cb(struct peer_info *peer, void *data); 134 151 %} 152 153 /* Overwrite declaration to apply typemaps */ 154 int fd_sess_fromsid ( char * STRING, size_t LENGTH, struct session ** OUTPUT, int * BOOL_OUT); 155 135 156 136 157 /********************************************************* … … 155 176 156 177 %include "peers.i" 178 %include "events.i" 179 %include "endpoints.i"
Note: See TracChangeset
for help on using the changeset viewer.