Merged with recent changes from trunk.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@11187 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Maciej Drwal 2009-04-11 16:46:47 +00:00
commit 8c74fa0f46
703 changed files with 21126 additions and 9266 deletions

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -18,3 +18,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -126,7 +126,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build
@ -141,7 +141,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build

View file

@ -5,10 +5,6 @@
#include "example.h"
%}
%typemap(in) double {
/* hello */
}
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -122,7 +122,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -python $(InputPath)
..\..\..\swig.exe -python $(InputPath)
# End Custom Build
@ -137,7 +137,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -python $(InputPath)
..\..\..\swig.exe -python $(InputPath)
# End Custom Build

View file

@ -21,3 +21,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -18,3 +18,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -18,3 +18,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -19,3 +19,4 @@ clean::
@rm -f foo.py bar.py spam.py base.py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -118,7 +118,7 @@ InputName=bar
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build
@ -133,7 +133,7 @@ InputName=bar
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build

View file

@ -118,7 +118,7 @@ InputName=base
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build
@ -133,7 +133,7 @@ InputName=base
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build

View file

@ -118,7 +118,7 @@ InputName=foo
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build
@ -133,7 +133,7 @@ InputName=foo
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build

View file

@ -118,7 +118,7 @@ InputName=spam
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build
@ -133,7 +133,7 @@ InputName=spam
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -c++ -python $(InputPath)
..\..\..\swig.exe -c++ -python $(InputPath)
# End Custom Build

View file

@ -19,3 +19,4 @@ clean::
@rm -f foo.py bar.py spam.py base.py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -122,7 +122,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -python $(InputPath)
..\..\..\swig.exe -python $(InputPath)
# End Custom Build
@ -137,7 +137,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -python $(InputPath)
..\..\..\swig.exe -python $(InputPath)
# End Custom Build

View file

@ -27,11 +27,24 @@ extern int gcd(int x, int y);
$2 = (char **) malloc(($1+1)*sizeof(char *));
for (i = 0; i < $1; i++) {
PyObject *s = PyList_GetItem($input,i);
if (!PyString_Check(s)) {
%#if PY_VERSION_HEX >= 0x03000000
if (!PyUnicode_Check(s))
%#else
if (!PyString_Check(s))
%#endif
{
free($2);
SWIG_exception(SWIG_ValueError, "List items must be strings");
}
%#if PY_VERSION_HEX >= 0x03000000
{
int l;
$2[i] = PyUnicode_AsStringAndSize(s, &l);
}
%#else
$2[i] = PyString_AsString(s);
%#endif
}
$2[i] = 0;
}
@ -39,12 +52,21 @@ extern int gcd(int x, int y);
extern int gcdmain(int argc, char *argv[]);
%typemap(in) (char *bytes, int len) {
%#if PY_VERSION_HEX >= 0x03000000
if (!PyUnicode_Check($input)) {
PyErr_SetString(PyExc_ValueError,"Expected a string");
return NULL;
}
$1 = PyUnicode_AsStringAndSize($input, &$2);
%#else
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_ValueError,"Expected a string");
return NULL;
}
$1 = PyString_AsString($input);
$2 = PyString_Size($input);
%#endif
}
extern int count(char *bytes, int len, char c);
@ -56,9 +78,15 @@ extern int count(char *bytes, int len, char c);
so that we don't violate it's mutability */
%typemap(in) (char *str, int len) {
%#if PY_VERSION_HEX >= 0x03000000
$2 = PyUnicode_GetSize($input);
$1 = (char *) malloc($2+1);
memmove($1,PyUnicode_AsString($input),$2);
%#else
$2 = PyString_Size($input);
$1 = (char *) malloc($2+1);
memmove($1,PyString_AsString($input),$2);
%#endif
}
/* Return the mutated string as a new object. The t_output_helper
@ -67,7 +95,11 @@ extern int count(char *bytes, int len, char c);
%typemap(argout) (char *str, int len) {
PyObject *o;
%#if PY_VERSION_HEX >= 0x03000000
o = PyUnicode_FromStringAndSize($1,$2);
%#else
o = PyString_FromStringAndSize($1,$2);
%#endif
$result = t_output_helper($result,o);
free($1);
}

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -18,3 +18,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -122,7 +122,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -python $(InputPath)
..\..\..\swig.exe -python $(InputPath)
# End Custom Build
@ -137,7 +137,7 @@ InputName=example
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
..\..\..\swig -python $(InputPath)
..\..\..\swig.exe -python $(InputPath)
# End Custom Build

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -22,3 +22,4 @@ run:
python runme.py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -23,5 +23,5 @@ namespace std {
%template(halfi) half_map<std::string,int>;
%template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
%template(pymap) std::map<swig::PyObject_ptr, swig::PyObject_ptr>;
%template() std::pair<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject>;
%template(pymap) std::map<swig::SwigPtr_PyObject, swig::SwigPtr_PyObject>;

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -22,3 +22,4 @@ clean::
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -17,3 +17,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run

View file

@ -19,3 +19,4 @@ clean::
rm -f $(TARGET).py
check: all
$(MAKE) -f $(TOP)/Makefile python_run