Files
cpp-thirdparty/winx64/bin/swig-3.0.12/Examples/test-suite/python_append.i
Bassem Girgis 81b4b9e273 Initial commit
2018-12-20 17:34:07 -06:00

59 lines
935 B
OpenEdge ABL

/*
Testcase to test %pythonprepend and %pythonappend %pythoncode %pythonbegin
*/
%module python_append
%pythoncode %{
mypath = os.path.dirname("/a/b/c/d.txt")
funcpath = None
staticfuncpath = None
def grabpath():
return funcpath
def grabstaticpath():
return staticfuncpath
def clearstaticpath():
global staticfuncpath
staticfuncpath = None
%}
%pythonappend Test::func %{
funcpath = os.path.dirname(funcpath)
%}
%pythonprepend Test::func %{
global funcpath
funcpath = mypath
%}
%pythonappend Test::static_func %{
staticfuncpath = os.path.basename(staticfuncpath)
pass
%}
%pythonprepend Test::static_func {
global staticfuncpath
staticfuncpath = mypath
pass
}
%pythonbegin %{
import os.path
%}
%inline %{
class Test {
public:
static void static_func() {};
void func() {};
};
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
%}