Fix SF#2552488: indentation adjust of %pythonappend and %pythonprepend
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11100 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
be7fdab62e
commit
afd67f8c67
5 changed files with 57 additions and 16 deletions
|
|
@ -1,9 +1,13 @@
|
|||
Version 1.3.38 (in progress)
|
||||
================================
|
||||
2008-01-31: bhy
|
||||
[Python] Fix SF#2552048 reported by Gaetan Lehmann. The parameter list
|
||||
of static member function in generated proxy code should not have the
|
||||
'self' parameter.
|
||||
[Python] Fix SF#2552488 reported by Gaetan Lehmann. Now %pythonprepend
|
||||
and %pythonappend have correct indentation.
|
||||
|
||||
2008-01-31: bhy
|
||||
[Python] Fix SF#2552048 reported by Gaetan Lehmann. The parameter list
|
||||
of static member function in generated proxy code should not have the
|
||||
'self' parameter.
|
||||
|
||||
2008-01-29: wsfulton
|
||||
Fix regression introduced in 1.3.37 where the default output directory
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ PY2TO3 = 2to3 -x import
|
|||
CPP_TEST_CASES += \
|
||||
argcargvtest \
|
||||
python_autodoc \
|
||||
python_append \
|
||||
callback \
|
||||
complextest \
|
||||
director_stl \
|
||||
|
|
|
|||
4
Examples/test-suite/python/python_append_runme.py
Normal file
4
Examples/test-suite/python/python_append_runme.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from python_append import *
|
||||
t=Test()
|
||||
t.func()
|
||||
t.static_func()
|
||||
32
Examples/test-suite/python_append.i
Normal file
32
Examples/test-suite/python_append.i
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Testcase to test %pythonprepend and %pythonappend
|
||||
*/
|
||||
|
||||
%module python_append
|
||||
|
||||
%pythonappend Test::func %{
|
||||
pass
|
||||
%}
|
||||
|
||||
%pythonprepend Test::func %{
|
||||
pass
|
||||
%}
|
||||
|
||||
%pythonappend Test::static_func %{
|
||||
pass
|
||||
%}
|
||||
|
||||
%pythonprepend Test::static_func {
|
||||
pass
|
||||
}
|
||||
|
||||
%inline %{
|
||||
|
||||
class Test {
|
||||
public:
|
||||
static void static_func() {};
|
||||
void func() {};
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
|
|
@ -958,7 +958,7 @@ public:
|
|||
* pythoncode() - Output python code into the shadow file
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
String *pythoncode(String *code, const String *indent) {
|
||||
String *pythoncode(String *code, const_String_or_char_ptr indent) {
|
||||
String *out = NewString("");
|
||||
String *temp;
|
||||
char *t;
|
||||
|
|
@ -1645,10 +1645,10 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_dest, " ", docstring(n, AUTODOC_FUNC, tab4), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_dest, " ", pythonprepend(n), "\n", NIL);
|
||||
Printv(f_dest, pythoncode(pythonprepend(n), " "), "\n", NIL);
|
||||
if (have_pythonappend(n)) {
|
||||
Printv(f_dest, " val = ", funcCall(name, callParms), "\n", NIL);
|
||||
Printv(f_dest, " ", pythonappend(n), "\n", NIL);
|
||||
Printv(f_dest, pythoncode(pythonappend(n), " "), "\n", NIL);
|
||||
Printv(f_dest, " return val\n", NIL);
|
||||
} else {
|
||||
Printv(f_dest, " return ", funcCall(name, callParms), "\n", NIL);
|
||||
|
|
@ -3118,12 +3118,12 @@ public:
|
|||
Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL);
|
||||
if (have_pythonprepend(n)) {
|
||||
fproxy = 0;
|
||||
Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
}
|
||||
if (have_pythonappend(n)) {
|
||||
fproxy = 0;
|
||||
Printv(f_shadow, tab8, "val = ", funcCall(Swig_name_member(class_name, symname), callParms), "\n", NIL);
|
||||
Printv(f_shadow, tab8, pythonappend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, tab8, "return val\n\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(class_name, symname), callParms), "\n\n", NIL);
|
||||
|
|
@ -3165,10 +3165,10 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC, tab8), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
if (have_pythonappend(n)) {
|
||||
Printv(f_shadow, tab8, "val = ", funcCall(Swig_name_member(class_name, symname), callParms), "\n", NIL);
|
||||
Printv(f_shadow, tab8, pythonappend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, tab8, "return val\n\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(class_name, symname), callParms), "\n\n", NIL);
|
||||
|
|
@ -3275,7 +3275,7 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_CTOR, tab8), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, pass_self, NIL);
|
||||
if (fastinit) {
|
||||
Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self,", funcCall(Swig_name_construct(symname), callParms), ")\n", NIL);
|
||||
|
|
@ -3285,7 +3285,7 @@ public:
|
|||
tab8, "try: self.this.append(this)\n", tab8, "except: self.this = this\n", NIL);
|
||||
}
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow, tab8, pythonappend(n), "\n\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n\n", NIL);
|
||||
Delete(pass_self);
|
||||
}
|
||||
have_constructor = 1;
|
||||
|
|
@ -3308,13 +3308,13 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow_stubs, tab4, docstring(n, AUTODOC_CTOR, tab4), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow_stubs, tab4, pythonprepend(n), "\n", NIL);
|
||||
Printv(f_shadow_stubs, pythoncode(pythonprepend(n), tab4), "\n", NIL);
|
||||
Printv(f_shadow_stubs, tab4, "val = ", funcCall(Swig_name_construct(symname), callParms), "\n", NIL);
|
||||
#ifdef USE_THISOWN
|
||||
Printv(f_shadow_stubs, tab4, "val.thisown = 1\n", NIL);
|
||||
#endif
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow_stubs, tab4, pythonappend(n), "\n", NIL);
|
||||
Printv(f_shadow_stubs, pythoncode(pythonappend(n), tab4), "\n", NIL);
|
||||
Printv(f_shadow_stubs, tab4, "return val\n", NIL);
|
||||
}
|
||||
}
|
||||
|
|
@ -3356,7 +3356,7 @@ public:
|
|||
if (have_docstring(n))
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_DTOR, tab8), "\n", NIL);
|
||||
if (have_pythonprepend(n))
|
||||
Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonprepend(n), tab8), "\n", NIL);
|
||||
#ifdef USE_THISOWN
|
||||
Printv(f_shadow, tab8, "try:\n", NIL);
|
||||
Printv(f_shadow, tab8, tab4, "if self.thisown: ", module, ".", Swig_name_destroy(symname), "(self)\n", NIL);
|
||||
|
|
@ -3364,7 +3364,7 @@ public:
|
|||
#else
|
||||
#endif
|
||||
if (have_pythonappend(n))
|
||||
Printv(f_shadow, tab8, pythonappend(n), "\n", NIL);
|
||||
Printv(f_shadow, pythoncode(pythonappend(n), tab8), "\n", NIL);
|
||||
Printv(f_shadow, tab8, "pass\n", NIL);
|
||||
Printv(f_shadow, "\n", NIL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue