Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / share / swig / 1.3.26 / python / pytuplehlp.swg
CommitLineData
920dae64
AT
1/*
2 Helper function to return output types, now we need to use a list
3 instead of a tuple since all the other types
4 (std::pair,std::vector,std::list,etc) return tuples.
5*/
6
7%fragment("t_output_helper","header") %{
8SWIGINTERN PyObject*
9t_output_helper(PyObject* target, PyObject* o) {
10 if (!target) {
11 target = o;
12 } else if (target == Py_None) {
13 Py_DECREF(target);
14 target = o;
15 } else {
16 if (!PyList_Check(target)) {
17 PyObject *o2 = target;
18 target = PyList_New(1);
19 PyList_SetItem(target, 0, o2);
20 }
21 PyList_Append(target,o);
22 Py_DECREF(o);
23 }
24 return target;
25}
26%}