blob: e100863f5faf0171630606e0ce8d22474c59b878 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001/*
2 lldb.swig
3
Chris Lattner30fdc8d2010-06-08 16:52:24 +00004 This is the input file for SWIG, to create the appropriate C++ wrappers and
5 functions for various scripting languages, to enable them to call the
6 liblldb Script Bridge functions.
Chris Lattner30fdc8d2010-06-08 16:52:24 +00007*/
8
Johnny Chenee481782011-06-30 21:29:50 +00009/* Define our module docstring. */
10%define DOCSTRING
11"The lldb module contains the public APIs for Python binding.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000012
Johnny Chenee481782011-06-30 21:29:50 +000013Some of the important classes are describe here:
14
15o SBTarget: Represents the target program running under the debugger.
16o SBProcess: Represents the process associated with the target program.
17o SBThread: Represents a thread of execution. SBProcess contains SBThread(s).
18o SBFrame: Represents one of the stack frames associated with a thread. SBThread
19 contains SBFrame(s).
20o SBSymbolContext: A container that stores various debugger related info.
21o SBValue: Represents the value of a variable, a register, or an expression.
22o SBModule: Represents an executable image and its associated object and symbol
Johnny Chen4036b582011-07-14 21:32:11 +000023 files. SBTarget conatins SBModule(s).
24o SBBreakpoint: Represents a logical breakpoint and its associated settings.
25 SBTarget conatins SBBreakpoint(s).
Johnny Chen993f2b62011-07-14 21:23:24 +000026o SBSymbol: Represents the symbol possibly associated with a stack frame.
Johnny Chenee481782011-06-30 21:29:50 +000027o SBCompileUnit: Represents a compilation unit, or compiled source file.
28o SBFunction: Represents a generic function, which can be inlined or not.
29o SBBlock: Represents a lexical block. SBFunction contains SBBlock(s).
30o SBLineEntry: Specifies an association with a contiguous range of instructions
Johnny Chen61abb2a2011-07-01 18:39:47 +000031 and a source file location. SBCompileUnit contains SBLineEntry(s)."
Johnny Chenee481782011-06-30 21:29:50 +000032%enddef
33
Johnny Chen9ffc9f72011-07-16 21:27:36 +000034// The name of the module to be created.
Johnny Chenee481782011-06-30 21:29:50 +000035%module(docstring=DOCSTRING) lldb
36
Johnny Chen9ffc9f72011-07-16 21:27:36 +000037// Parameter types will be used in the autodoc string.
38%feature("autodoc", "1");
Chris Lattner30fdc8d2010-06-08 16:52:24 +000039
Chris Lattner30fdc8d2010-06-08 16:52:24 +000040/* Typemap definitions, to allow SWIG to properly handle 'char**' data types. */
41
42%typemap(in) char ** {
43 /* Check if is a list */
44 if (PyList_Check($input)) {
45 int size = PyList_Size($input);
46 int i = 0;
Greg Claytonca512b32011-01-14 04:54:56 +000047 $1 = (char **) malloc((size+1) * sizeof(char*));
Chris Lattner30fdc8d2010-06-08 16:52:24 +000048 for (i = 0; i < size; i++) {
49 PyObject *o = PyList_GetItem($input,i);
50 if (PyString_Check(o))
Greg Claytonca512b32011-01-14 04:54:56 +000051 $1[i] = PyString_AsString(o);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000052 else {
53 PyErr_SetString(PyExc_TypeError,"list must contain strings");
54 free($1);
55 return NULL;
56 }
57 }
58 $1[i] = 0;
Caroline Ticeebc1bb22010-06-30 16:22:25 +000059 } else if ($input == Py_None) {
60 $1 = NULL;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000061 } else {
62 PyErr_SetString(PyExc_TypeError,"not a list");
63 return NULL;
64 }
65}
66
67%typemap(freearg) char** {
68 free((char *) $1);
69}
70
71%typemap(out) char** {
72 int len;
73 int i;
74 len = 0;
75 while ($1[len]) len++;
76 $result = PyList_New(len);
77 for (i = 0; i < len; i++) {
78 PyList_SetItem($result, i, PyString_FromString($1[i]));
79 }
80}
81
Johnny Chen2f6f7ba2011-03-07 21:28:57 +000082/* Typemap definitions to allow SWIG to properly handle char buffer. */
83
84// typemap for a char buffer
85// See also SBThread::GetStopDescription.
86%typemap(in) (char *dst, size_t dst_len) {
87 if (!PyInt_Check($input)) {
88 PyErr_SetString(PyExc_ValueError, "Expecting an integer");
89 return NULL;
90 }
91 $2 = PyInt_AsLong($input);
Johnny Chende8241c2011-03-23 00:26:08 +000092 if ($2 <= 0) {
Johnny Chen2f6f7ba2011-03-07 21:28:57 +000093 PyErr_SetString(PyExc_ValueError, "Positive integer expected");
94 return NULL;
95 }
96 $1 = (char *) malloc($2);
97}
98
99// Return the char buffer. Discarding any previous return result
100// See also SBThread::GetStopDescription.
101%typemap(argout) (char *dst, size_t dst_len) {
102 Py_XDECREF($result); /* Blow away any previous result */
103 $result = PyString_FromStringAndSize(($1),result);
104 free($1);
105}
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000106
Greg Claytonca512b32011-01-14 04:54:56 +0000107
108// typemap for an outgoing buffer
Johnny Chen3a709ac2011-07-08 23:02:33 +0000109// See also SBEvent::SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len).
110%typemap(in) (const char *cstr, uint32_t cstr_len) {
111 if (!PyString_Check($input)) {
112 PyErr_SetString(PyExc_ValueError, "Expecting a string");
113 return NULL;
114 }
115 $1 = (char *) PyString_AsString($input);
116 $2 = PyString_Size($input);
117}
118// And SBProcess::WriteMemory.
Johnny Chen37f99fd2011-03-01 02:20:14 +0000119%typemap(in) (const void *buf, size_t size) {
Greg Claytonca512b32011-01-14 04:54:56 +0000120 if (!PyString_Check($input)) {
121 PyErr_SetString(PyExc_ValueError, "Expecting a string");
122 return NULL;
123 }
124 $1 = (void *) PyString_AsString($input);
125 $2 = PyString_Size($input);
126}
127
128// typemap for an incoming buffer
Johnny Chen2f6f7ba2011-03-07 21:28:57 +0000129// See also SBProcess::ReadMemory.
Johnny Chen37f99fd2011-03-01 02:20:14 +0000130%typemap(in) (void *buf, size_t size) {
Greg Claytonca512b32011-01-14 04:54:56 +0000131 if (!PyInt_Check($input)) {
132 PyErr_SetString(PyExc_ValueError, "Expecting an integer");
133 return NULL;
134 }
135 $2 = PyInt_AsLong($input);
Johnny Chende8241c2011-03-23 00:26:08 +0000136 if ($2 <= 0) {
Greg Claytonca512b32011-01-14 04:54:56 +0000137 PyErr_SetString(PyExc_ValueError, "Positive integer expected");
138 return NULL;
139 }
140 $1 = (void *) malloc($2);
141}
142
143// Return the buffer. Discarding any previous return result
Johnny Chen2f6f7ba2011-03-07 21:28:57 +0000144// See also SBProcess::ReadMemory.
Johnny Chen37f99fd2011-03-01 02:20:14 +0000145%typemap(argout) (void *buf, size_t size) {
Greg Claytonca512b32011-01-14 04:54:56 +0000146 Py_XDECREF($result); /* Blow away any previous result */
Johnny Chen37f99fd2011-03-01 02:20:14 +0000147 $result = PyString_FromStringAndSize(static_cast<const char*>($1),result);
Greg Claytonca512b32011-01-14 04:54:56 +0000148 free($1);
149}
150
Greg Claytonc0cc73e2010-06-12 15:34:20 +0000151/* The liblldb header files to be included. */
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000152
153%{
Greg Claytone0d378b2011-03-24 21:19:54 +0000154#include "lldb/lldb-public.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000155#include "lldb/API/SBAddress.h"
156#include "lldb/API/SBBlock.h"
157#include "lldb/API/SBBreakpoint.h"
158#include "lldb/API/SBBreakpointLocation.h"
159#include "lldb/API/SBBroadcaster.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000160#include "lldb/API/SBCommandInterpreter.h"
161#include "lldb/API/SBCommandReturnObject.h"
Greg Clayton05faeb72010-10-07 04:19:01 +0000162#include "lldb/API/SBCommunication.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000163#include "lldb/API/SBCompileUnit.h"
164#include "lldb/API/SBDebugger.h"
165#include "lldb/API/SBError.h"
166#include "lldb/API/SBEvent.h"
Johnny Chen23fd10c2010-08-27 22:35:26 +0000167#include "lldb/API/SBFileSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000168#include "lldb/API/SBFrame.h"
169#include "lldb/API/SBFunction.h"
Greg Clayton05faeb72010-10-07 04:19:01 +0000170#include "lldb/API/SBHostOS.h"
171#include "lldb/API/SBInputReader.h"
Greg Clayton1d273162010-10-06 03:09:58 +0000172#include "lldb/API/SBInstruction.h"
173#include "lldb/API/SBInstructionList.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000174#include "lldb/API/SBLineEntry.h"
175#include "lldb/API/SBListener.h"
176#include "lldb/API/SBModule.h"
177#include "lldb/API/SBProcess.h"
178#include "lldb/API/SBSourceManager.h"
Caroline Ticedde9cff2010-09-20 05:20:02 +0000179#include "lldb/API/SBStream.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000180#include "lldb/API/SBStringList.h"
181#include "lldb/API/SBSymbol.h"
182#include "lldb/API/SBSymbolContext.h"
Greg Clayton05faeb72010-10-07 04:19:01 +0000183#include "lldb/API/SBSymbolContextList.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000184#include "lldb/API/SBTarget.h"
185#include "lldb/API/SBThread.h"
186#include "lldb/API/SBType.h"
187#include "lldb/API/SBValue.h"
Caroline Tice77404122010-09-22 16:41:52 +0000188#include "lldb/API/SBValueList.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000189%}
190
191/* Various liblldb typedefs that SWIG needs to know about. */
Johnny Chen4b332092010-12-16 00:01:06 +0000192#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
Greg Clayton05faeb72010-10-07 04:19:01 +0000193%include <stdint.h>
194%include "lldb/lldb-defines.h"
195%include "lldb/lldb-enumerations.h"
196%include "lldb/lldb-forward.h"
197%include "lldb/lldb-forward-rtti.h"
198%include "lldb/lldb-types.h"
Johnny Chen349f0762011-07-19 01:07:06 +0000199
Johnny Chen0f519682011-07-19 21:49:34 +0000200/* Headers that are swigged directly. */
201%include "lldb/API/SBDefines.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000202%include "lldb/API/SBBroadcaster.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000203%include "lldb/API/SBCommandInterpreter.h"
204%include "lldb/API/SBCommandReturnObject.h"
Greg Clayton05faeb72010-10-07 04:19:01 +0000205%include "lldb/API/SBCommunication.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000206%include "lldb/API/SBError.h"
Johnny Chen23fd10c2010-08-27 22:35:26 +0000207%include "lldb/API/SBFileSpec.h"
Greg Clayton05faeb72010-10-07 04:19:01 +0000208%include "lldb/API/SBHostOS.h"
209%include "lldb/API/SBInputReader.h"
Greg Clayton1d273162010-10-06 03:09:58 +0000210%include "lldb/API/SBInstruction.h"
211%include "lldb/API/SBInstructionList.h"
Johnny Chen0f519682011-07-19 21:49:34 +0000212%include "lldb/API/SBSourceManager.h"
213%include "lldb/API/SBStream.h"
214%include "lldb/API/SBStringList.h"
215%include "lldb/API/SBType.h"
216
217/* Python interface files with docstrings. */
218%include "./Python/interface/SBAddress.i"
219%include "./Python/interface/SBBlock.i"
220%include "./Python/interface/SBBreakpoint.i"
221%include "./Python/interface/SBBreakpointLocation.i"
222%include "./Python/interface/SBCompileUnit.i"
223%include "./Python/interface/SBDebugger.i"
224%include "./Python/interface/SBEvent.i"
225%include "./Python/interface/SBFrame.i"
226%include "./Python/interface/SBFunction.i"
Johnny Chenf74cb502011-07-18 23:11:07 +0000227%include "./Python/interface/SBLineEntry.i"
228%include "./Python/interface/SBListener.i"
229%include "./Python/interface/SBModule.i"
Johnny Chen357033b2011-07-18 20:13:38 +0000230%include "./Python/interface/SBProcess.i"
Johnny Chen349f0762011-07-19 01:07:06 +0000231%include "./Python/interface/SBSymbol.i"
232%include "./Python/interface/SBSymbolContext.i"
233%include "./Python/interface/SBSymbolContextList.i"
Johnny Chendc7d3c12011-07-16 21:15:39 +0000234%include "./Python/interface/SBTarget.i"
Johnny Chen357033b2011-07-18 20:13:38 +0000235%include "./Python/interface/SBThread.i"
Johnny Chen67ae7bd2011-07-18 19:08:30 +0000236%include "./Python/interface/SBValue.i"
237%include "./Python/interface/SBValueList.i"
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000238
Caroline Ticedac97f32010-09-22 23:01:29 +0000239%include "./Python/python-extensions.swig"
Caroline Tice18474c92010-09-27 18:00:20 +0000240
241
242%wrapper %{
243
Greg Claytonc6ed5422010-10-07 17:14:24 +0000244// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)
245// and is used when a script command is attached to a breakpoint for execution.
Caroline Tice18474c92010-09-27 18:00:20 +0000246
Greg Claytonc6ed5422010-10-07 17:14:24 +0000247SWIGEXPORT bool
Greg Claytonfc36f7912011-03-22 01:14:58 +0000248LLDBSwigPythonBreakpointCallbackFunction
Greg Clayton05faeb72010-10-07 04:19:01 +0000249(
Greg Claytonc6ed5422010-10-07 17:14:24 +0000250 const char *python_function_name,
Caroline Tice2f88aad2011-01-14 00:29:16 +0000251 const char *session_dictionary_name,
Greg Claytonfc36f7912011-03-22 01:14:58 +0000252 const lldb::StackFrameSP& frame_sp,
253 const lldb::BreakpointLocationSP& bp_loc_sp
Greg Clayton05faeb72010-10-07 04:19:01 +0000254)
Caroline Tice18474c92010-09-27 18:00:20 +0000255{
Greg Claytonfc36f7912011-03-22 01:14:58 +0000256 lldb::SBFrame sb_frame (frame_sp);
257 lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
258
Greg Claytonc6ed5422010-10-07 17:14:24 +0000259 bool stop_at_breakpoint = true;
260 PyObject *Frame_PyObj = SWIG_NewPointerObj((void *) &sb_frame, SWIGTYPE_p_lldb__SBFrame, 0);
261 PyObject *Bp_Loc_PyObj = SWIG_NewPointerObj ((void *) &sb_bp_loc, SWIGTYPE_p_lldb__SBBreakpointLocation, 0);
Caroline Tice18474c92010-09-27 18:00:20 +0000262
Greg Claytonc6ed5422010-10-07 17:14:24 +0000263 if (Frame_PyObj == NULL || Bp_Loc_PyObj == NULL)
264 return stop_at_breakpoint;
Caroline Tice2f88aad2011-01-14 00:29:16 +0000265
266 if (!python_function_name || !session_dictionary_name)
267 return stop_at_breakpoint;
Greg Claytonc6ed5422010-10-07 17:14:24 +0000268
Caroline Tice2f88aad2011-01-14 00:29:16 +0000269 PyObject *pmodule, *main_dict, *session_dict, *pfunc;
Greg Claytonc6ed5422010-10-07 17:14:24 +0000270 PyObject *pargs, *pvalue;
Caroline Tice18474c92010-09-27 18:00:20 +0000271
Greg Claytonc6ed5422010-10-07 17:14:24 +0000272 pmodule = PyImport_AddModule ("__main__");
273 if (pmodule != NULL)
Caroline Tice18474c92010-09-27 18:00:20 +0000274 {
Caroline Tice2f88aad2011-01-14 00:29:16 +0000275 main_dict = PyModule_GetDict (pmodule);
276 if (main_dict != NULL)
Caroline Tice18474c92010-09-27 18:00:20 +0000277 {
Caroline Tice2f88aad2011-01-14 00:29:16 +0000278 PyObject *key, *value;
279 Py_ssize_t pos = 0;
280
281 // Find the current session's dictionary in the main module's dictionary.
282
283 if (PyDict_Check (main_dict))
284
285 {
286 session_dict = NULL;
287 while (PyDict_Next (main_dict, &pos, &key, &value))
288 {
289 // We have stolen references to the key and value objects in the dictionary; we need to increment
290 // them now so that Python's garbage collector doesn't collect them out from under us.
291 Py_INCREF (key);
292 Py_INCREF (value);
293 if (strcmp (PyString_AsString (key), session_dictionary_name) == 0)
294 {
295 session_dict = value;
296 break;
297 }
298 }
299 }
300
301 if (!session_dict || !PyDict_Check (session_dict))
302 return stop_at_breakpoint;
303
304 // Find the function we need to call in the current session's dictionary.
305
306 pos = 0;
307 pfunc = NULL;
308 while (PyDict_Next (session_dict, &pos, &key, &value))
309 {
310 if (PyString_Check (key))
311 {
312 // We have stolen references to the key and value objects in the dictionary; we need to increment
313 // them now so that Python's garbage collector doesn't collect them out from under us.
314 Py_INCREF (key);
315 Py_INCREF (value);
316 if (strcmp (PyString_AsString (key), python_function_name) == 0)
317 {
318 pfunc = value;
319 break;
320 }
321 }
322 }
323
324 // Set up the arguments and call the function.
325
Greg Claytonc6ed5422010-10-07 17:14:24 +0000326 if (pfunc && PyCallable_Check (pfunc))
Caroline Tice18474c92010-09-27 18:00:20 +0000327 {
Caroline Tice2f88aad2011-01-14 00:29:16 +0000328 pargs = PyTuple_New (3);
Greg Claytonc6ed5422010-10-07 17:14:24 +0000329 if (pargs == NULL)
Caroline Tice18474c92010-09-27 18:00:20 +0000330 {
Greg Claytonc6ed5422010-10-07 17:14:24 +0000331 if (PyErr_Occurred())
Caroline Tice18474c92010-09-27 18:00:20 +0000332 PyErr_Clear();
Greg Claytonc6ed5422010-10-07 17:14:24 +0000333 return stop_at_breakpoint;
Caroline Tice18474c92010-09-27 18:00:20 +0000334 }
Greg Claytonc6ed5422010-10-07 17:14:24 +0000335
336 PyTuple_SetItem (pargs, 0, Frame_PyObj); // This "steals" a reference to Frame_PyObj
337 PyTuple_SetItem (pargs, 1, Bp_Loc_PyObj); // This "steals" a reference to Bp_Loc_PyObj
Caroline Tice2f88aad2011-01-14 00:29:16 +0000338 PyTuple_SetItem (pargs, 2, session_dict); // This "steals" a reference to session_dict
Greg Claytonc6ed5422010-10-07 17:14:24 +0000339 pvalue = PyObject_CallObject (pfunc, pargs);
340 Py_DECREF (pargs);
341
342 if (pvalue != NULL)
343 {
344 Py_DECREF (pvalue);
345 }
346 else if (PyErr_Occurred ())
Caroline Tice18474c92010-09-27 18:00:20 +0000347 {
348 PyErr_Clear();
349 }
Caroline Tice2f88aad2011-01-14 00:29:16 +0000350 Py_INCREF (session_dict);
Caroline Tice18474c92010-09-27 18:00:20 +0000351 }
352 else if (PyErr_Occurred())
353 {
354 PyErr_Clear();
355 }
356 }
Greg Claytonc6ed5422010-10-07 17:14:24 +0000357 else if (PyErr_Occurred())
Caroline Tice18474c92010-09-27 18:00:20 +0000358 {
Greg Claytonc6ed5422010-10-07 17:14:24 +0000359 PyErr_Clear();
Caroline Tice18474c92010-09-27 18:00:20 +0000360 }
361 }
Greg Claytonc6ed5422010-10-07 17:14:24 +0000362 else if (PyErr_Occurred ())
363 {
364 PyErr_Clear ();
365 }
366 return stop_at_breakpoint;
Caroline Tice18474c92010-09-27 18:00:20 +0000367}
368
Enrico Granataf2bbf712011-07-15 02:26:42 +0000369SWIGEXPORT std::string
370LLDBSwigPythonCallTypeScript
371(
372 const char *python_function_name,
373 const char *session_dictionary_name,
374 const lldb::ValueObjectSP& valobj_sp
375)
376{
377 lldb::SBValue sb_value (valobj_sp);
378
379 std::string retval = "";
380
381 PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &valobj_sp, SWIGTYPE_p_lldb__SBValue, 0);
382
383 if (ValObj_PyObj == NULL)
384 return retval;
385
386 if (!python_function_name || !session_dictionary_name)
387 return retval;
388
389 PyObject *pmodule, *main_dict, *session_dict, *pfunc;
390 PyObject *pargs, *pvalue;
391
392 pmodule = PyImport_AddModule ("__main__");
393 if (pmodule != NULL)
394 {
395 main_dict = PyModule_GetDict (pmodule);
396 if (main_dict != NULL)
397 {
398 PyObject *key, *value;
399 Py_ssize_t pos = 0;
400
401 // Find the current session's dictionary in the main module's dictionary.
402
403 if (PyDict_Check (main_dict))
404
405 {
406 session_dict = NULL;
407 while (PyDict_Next (main_dict, &pos, &key, &value))
408 {
409 // We have stolen references to the key and value objects in the dictionary; we need to increment
410 // them now so that Python's garbage collector doesn't collect them out from under us.
411 Py_INCREF (key);
412 Py_INCREF (value);
413 if (strcmp (PyString_AsString (key), session_dictionary_name) == 0)
414 {
415 session_dict = value;
416 break;
417 }
418 }
419 }
420
421 if (!session_dict || !PyDict_Check (session_dict))
422 return retval;
423
424 // Find the function we need to call in the current session's dictionary.
425
426 pos = 0;
427 pfunc = NULL;
428 while (PyDict_Next (session_dict, &pos, &key, &value))
429 {
430 if (PyString_Check (key))
431 {
432 // We have stolen references to the key and value objects in the dictionary; we need to increment
433 // them now so that Python's garbage collector doesn't collect them out from under us.
434 Py_INCREF (key);
435 Py_INCREF (value);
436 if (strcmp (PyString_AsString (key), python_function_name) == 0)
437 {
438 pfunc = value;
439 break;
440 }
441 }
442 }
443
444 // Set up the arguments and call the function.
445
446 if (pfunc && PyCallable_Check (pfunc))
447 {
448 pargs = PyTuple_New (2);
449 if (pargs == NULL)
450 {
451 if (PyErr_Occurred())
452 PyErr_Clear();
453 return retval;
454 }
455
456 PyTuple_SetItem (pargs, 0, ValObj_PyObj); // This "steals" a reference to ValObj_PyObj
457 PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict
458 pvalue = PyObject_CallObject (pfunc, pargs);
459 Py_DECREF (pargs);
460
461 if (pvalue != NULL)
462 {
463 if (pvalue != Py_None)
464 retval = std::string(PyString_AsString(pvalue));
465 else
466 retval = "None";
467 Py_DECREF (pvalue);
468 }
469 else if (PyErr_Occurred ())
470 {
Enrico Granata03f16a02011-07-18 16:24:10 +0000471 PyErr_Print();
Enrico Granataf2bbf712011-07-15 02:26:42 +0000472 PyErr_Clear();
473 }
474 Py_INCREF (session_dict);
475 }
476 else if (PyErr_Occurred())
477 {
Enrico Granata03f16a02011-07-18 16:24:10 +0000478 PyErr_Print();
Enrico Granataf2bbf712011-07-15 02:26:42 +0000479 PyErr_Clear();
480 }
481 }
482 else if (PyErr_Occurred())
483 {
Enrico Granata03f16a02011-07-18 16:24:10 +0000484 PyErr_Print();
Enrico Granataf2bbf712011-07-15 02:26:42 +0000485 PyErr_Clear();
486 }
487 }
488 else if (PyErr_Occurred ())
489 {
Enrico Granata03f16a02011-07-18 16:24:10 +0000490 PyErr_Print();
Enrico Granataf2bbf712011-07-15 02:26:42 +0000491 PyErr_Clear ();
492 }
493 return retval;
494}
495
496
Caroline Tice18474c92010-09-27 18:00:20 +0000497%}