Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
pymolfile
Commits
1be60c10
Commit
1be60c10
authored
Oct 24, 2017
by
Berk Onat
Browse files
One Cmake call for all
parent
086f4be1
Changes
375
Show whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 375+
files are displayed.
Plain diff
Email patch
pymolfile/molfile/compile-without-tng.sh
deleted
100644 → 0
View file @
086f4be1
echo
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
swig
-py3
-Wall
-c
++
-python
libpymolfile.i
echo
"'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'"
g++-7
-fPIC
-Wall
-Wextra
-shared
-g
-Wunused-function
-Wunused-parameter
\
-I
/labEnv3/lib/python3.6/site-packages/numpy/core/include/
\
-I
./include
\
-I
./include/molfile_plugin/include
\
-I
./lib/molfile_plugin/lib
\
-I
./include/plugin_src/include
\
-I
./include/netcdf/include
\
-I
./include/expat/include
\
-I
./include/tng/include
\
libpymolfile_wrap.cxx pymolfile.c
-o
_libpymolfile.so
-L
.
\
-L
./lib/molfile_plugin/lib
\
-L
./lib/netcdf/lib
\
-L
./lib/expat/lib
\
-L
./lib/tng/lib
\
lib/molfile_plugin/lib/libmolfile_plugin.a
-I
/labEnv3/include/python3.6m/
\
-L
/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib
\
-lpython3
.6
-lnetcdf
pymolfile/molfile/compile.sh
deleted
100644 → 0
View file @
086f4be1
echo
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
swig
-py3
-Wall
-c
++
-python
libpymolfile.i
echo
"'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'"
g++-7
-fPIC
-Wall
-Wextra
-shared
-g
-Wunused-function
-Wunused-parameter
\
-I
/labEnv3/lib/python3.6/site-packages/numpy/core/include/
\
-I
./include
\
-I
./include/molfile_plugin/include
\
-I
./lib/molfile_plugin/lib
\
-I
./include/plugin_src/include
\
-I
./include/netcdf/include
\
-I
./include/expat/include
\
-I
./include/tng/include
\
libpymolfile_wrap.cxx pymolfile.cxx
-o
_libpymolfile.so
-L
.
\
-L
./lib/molfile_plugin/lib
\
-L
./lib/netcdf/lib
\
-L
./lib/expat/lib
\
-L
./lib/tng/lib
\
lib/molfile_plugin/lib/libmolfile_plugin.a
-I
/labEnv3/include/python3.6m/
\
-L
/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib
\
-lpython3
.6
-ltng_io
-lnetcdf
-lexpat
pymolfile/molfile/compile27.sh
deleted
100644 → 0
View file @
086f4be1
echo
"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
#swig -py3 -Wall -c++ -python libpymolfile.i
swig
-Wall
-c
++
-python
libpymolfile.i
echo
"'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'-._.-'"
g++-7
-fPIC
-Wall
-Wextra
-Xlinker
-export-dynamic
-shared
-g
-Wunused-function
-Wunused-parameter
\
-I
/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include/
\
-I
./include
\
-I
./include/molfile_plugin/include
\
-I
./lib/molfile_plugin/lib
\
-I
./include/plugin_src/include
\
-I
./include/netcdf/include
\
-I
./include/expat/include
\
-I
./include/tng/include
\
libpymolfile_wrap.cxx pymolfile.c
-o
_libpymolfile.so
-L
.
\
-L
./lib/molfile_plugin/lib
\
-L
./lib/netcdf/lib
\
-L
./lib/expat/lib
\
-L
./lib/tng/lib
\
lib/molfile_plugin/lib/libmolfile_plugin.a
\
-I
/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/include/python2.7/
\
-L
/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib
\
-lpython2
.7
-ltng_io
-lnetcdf
-lexpat
pymolfile/molfile/external/CMakeLists.txt
View file @
1be60c10
...
...
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8.12)
project
(
TNGBuilder
)
include
(
ExternalProject
)
set
(
TNG_PREFIX
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
external/
tng"
)
set
(
TNG_INSTALL_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
external/
tng"
)
set
(
TNG_PREFIX
"
${
CMAKE_CURRENT_BINARY_DIR
}
/tng"
)
set
(
TNG_INSTALL_DIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
/tng"
)
set
(
TNG_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
TNG_INSTALL_DIR
}
)
message
(
"TNG_PREFIX='
${
TNG_PREFIX
}
'"
)
...
...
@@ -19,16 +19,16 @@ ExternalProject_Add(tng
)
set
(
LIB_TNGIO_FILES
"
${
TNG_INSTALL_DIR
}
/
tng/
include/tng/tng_io.h"
)
if
(
APPLE
)
set
(
LIB_TNGIO_FILES
${
LIB_TNGIO_FILES
}
"
${
TNG_INSTALL_DIR
}
/
tng/
lib/libtng_io.dylib"
)
else
()
set
(
LIB_TNGIO_FILES
${
LIB_TNGIO_FILES
}
"
${
TNG_INSTALL_DIR
}
/
tng/
lib/libtng_io.so"
)
endif
()
#
set(LIB_TNGIO_FILES
#
"${TNG_INSTALL_DIR}/include/tng/tng_io.h")
#
#
if (APPLE)
#
set(LIB_TNGIO_FILES ${LIB_TNGIO_FILES} "${TNG_INSTALL_DIR}/lib/libtng_io.dylib")
#
else()
#
set(LIB_TNGIO_FILES ${LIB_TNGIO_FILES} "${TNG_INSTALL_DIR}/lib/libtng_io.so")
#
endif()
#
add_custom_target
(
tngio_comp ALL
DEPENDS
${
LIB_TNGIO_FILES
}
)
DEPENDS
${
TNG_INSTALL_DIR
}
)
pymolfile/molfile/include/expat/include
deleted
120000 → 0
View file @
086f4be1
/usr/local/Cellar/expat/2.2.4/include/
\ No newline at end of file
pymolfile/molfile/include/molfile_plugin/include
deleted
120000 → 0
View file @
086f4be1
../../vmd_molfile_plugins/include
\ No newline at end of file
pymolfile/molfile/include/netcdf/include
deleted
120000 → 0
View file @
086f4be1
/usr/local/Cellar/netcdf/4.4.1.1_6/include/
\ No newline at end of file
pymolfile/molfile/include/plugin_src/include
deleted
120000 → 0
View file @
086f4be1
../../vmd_molfile_plugins/molfile_plugin/src/
\ No newline at end of file
pymolfile/molfile/include/tng/include
deleted
120000 → 0
View file @
086f4be1
/Users/bonat/TNG/tng/include/
\ No newline at end of file
pymolfile/molfile/lib/expat/lib
deleted
120000 → 0
View file @
086f4be1
/usr/local/Cellar/expat/2.2.4/lib
\ No newline at end of file
pymolfile/molfile/lib/molfile_plugin/lib
deleted
120000 → 0
View file @
086f4be1
../../vmd_molfile_plugins/compile/lib_MACOSXX86_64GCC/molfile/
\ No newline at end of file
pymolfile/molfile/lib/netcdf/lib
deleted
120000 → 0
View file @
086f4be1
/usr/local/Cellar/netcdf/4.4.1.1_6/lib/
\ No newline at end of file
pymolfile/molfile/lib/tng/lib
deleted
120000 → 0
View file @
086f4be1
/Users/bonat/TNG/tng/build/lib/
\ No newline at end of file
pymolfile/molfile/libpymolfile.py
deleted
100644 → 0
View file @
086f4be1
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
:Author: Berk Onat <b.onat@warwick.ac.uk>
:Year: 2017
:Licence: UIUC LICENSE
"""
from
sys
import
version_info
as
_swig_python_version_info
if
_swig_python_version_info
>=
(
2
,
7
,
0
):
def
swig_import_helper
():
import
importlib
pkg
=
__name__
.
rpartition
(
'.'
)[
0
]
mname
=
'.'
.
join
((
pkg
,
'_libpymolfile'
)).
lstrip
(
'.'
)
try
:
return
importlib
.
import_module
(
mname
)
except
ImportError
:
return
importlib
.
import_module
(
'_libpymolfile'
)
_libpymolfile
=
swig_import_helper
()
del
swig_import_helper
elif
_swig_python_version_info
>=
(
2
,
6
,
0
):
def
swig_import_helper
():
from
os.path
import
dirname
import
imp
fp
=
None
try
:
fp
,
pathname
,
description
=
imp
.
find_module
(
'_libpymolfile'
,
[
dirname
(
__file__
)])
except
ImportError
:
import
_libpymolfile
return
_libpymolfile
try
:
_mod
=
imp
.
load_module
(
'_libpymolfile'
,
fp
,
pathname
,
description
)
finally
:
if
fp
is
not
None
:
fp
.
close
()
return
_mod
_libpymolfile
=
swig_import_helper
()
del
swig_import_helper
else
:
import
_libpymolfile
del
_swig_python_version_info
try
:
_swig_property
=
property
except
NameError
:
pass
# Python < 2.2 doesn't have 'property'.
try
:
import
builtins
as
__builtin__
except
ImportError
:
import
__builtin__
def
_swig_setattr_nondynamic
(
self
,
class_type
,
name
,
value
,
static
=
1
):
if
(
name
==
"thisown"
):
return
self
.
this
.
own
(
value
)
if
(
name
==
"this"
):
if
type
(
value
).
__name__
==
'SwigPyObject'
:
self
.
__dict__
[
name
]
=
value
return
method
=
class_type
.
__swig_setmethods__
.
get
(
name
,
None
)
if
method
:
return
method
(
self
,
value
)
if
(
not
static
):
if
_newclass
:
object
.
__setattr__
(
self
,
name
,
value
)
else
:
self
.
__dict__
[
name
]
=
value
else
:
raise
AttributeError
(
"You cannot add attributes to %s"
%
self
)
def
_swig_setattr
(
self
,
class_type
,
name
,
value
):
return
_swig_setattr_nondynamic
(
self
,
class_type
,
name
,
value
,
0
)
def
_swig_getattr
(
self
,
class_type
,
name
):
if
(
name
==
"thisown"
):
return
self
.
this
.
own
()
method
=
class_type
.
__swig_getmethods__
.
get
(
name
,
None
)
if
method
:
return
method
(
self
)
raise
AttributeError
(
"'%s' object has no attribute '%s'"
%
(
class_type
.
__name__
,
name
))
def
_swig_repr
(
self
):
try
:
strthis
=
"proxy of "
+
self
.
this
.
__repr__
()
except
__builtin__
.
Exception
:
strthis
=
""
return
"<%s.%s; %s >"
%
(
self
.
__class__
.
__module__
,
self
.
__class__
.
__name__
,
strthis
,)
try
:
_object
=
object
_newclass
=
1
except
__builtin__
.
Exception
:
class
_object
:
pass
_newclass
=
0
def
molfile_plugin_list
(
maxsize
:
'int'
)
->
"PyObject *"
:
"""molfile_plugin_list(maxsize) -> PyObject *"""
return
_libpymolfile
.
molfile_plugin_list
(
maxsize
)
def
molfile_init
()
->
"int"
:
"""molfile_init() -> int"""
return
_libpymolfile
.
molfile_init
()
def
molfile_finish
()
->
"int"
:
"""molfile_finish() -> int"""
return
_libpymolfile
.
molfile_finish
()
def
get_plugin
(
molcapsule
:
'PyObject *'
,
plug_no
:
'int'
)
->
"PyObject *"
:
"""get_plugin(molcapsule, plug_no) -> PyObject *"""
return
_libpymolfile
.
get_plugin
(
molcapsule
,
plug_no
)
def
molfile_plugin_info
(
molcapsule
:
'PyObject *'
,
plugin_no
:
'int'
)
->
"PyObject *"
:
"""molfile_plugin_info(molcapsule, plugin_no) -> PyObject *"""
return
_libpymolfile
.
molfile_plugin_info
(
molcapsule
,
plugin_no
)
def
open_file_read
(
molcapsule
:
'PyObject *'
,
fname
:
'char *'
,
ftype
:
'char *'
,
natoms
:
'int'
)
->
"PyObject *"
:
"""open_file_read(molcapsule, fname, ftype, natoms) -> PyObject *"""
return
_libpymolfile
.
open_file_read
(
molcapsule
,
fname
,
ftype
,
natoms
)
def
close_file_read
(
molpack
:
'PyObject *'
)
->
"PyObject *"
:
"""close_file_read(molpack) -> PyObject *"""
return
_libpymolfile
.
close_file_read
(
molpack
)
def
read_fill_structure
(
molpack
:
'PyObject *'
,
prototype
:
'PyObject *'
)
->
"PyObject *"
:
"""read_fill_structure(molpack, prototype) -> PyObject *"""
return
_libpymolfile
.
read_fill_structure
(
molpack
,
prototype
)
def
read_fill_bonds
(
molpack
:
'PyObject *'
)
->
"PyObject *"
:
"""read_fill_bonds(molpack) -> PyObject *"""
return
_libpymolfile
.
read_fill_bonds
(
molpack
)
def
read_fill_angles
(
molpack
:
'PyObject *'
)
->
"PyObject *"
:
"""read_fill_angles(molpack) -> PyObject *"""
return
_libpymolfile
.
read_fill_angles
(
molpack
)
def
read_fill_next_timestep
(
molpack
:
'PyObject *'
)
->
"PyObject *"
:
"""read_fill_next_timestep(molpack) -> PyObject *"""
return
_libpymolfile
.
read_fill_next_timestep
(
molpack
)
def
are_plugins_same
(
molpack_a
:
'PyObject *'
,
molpack_b
:
'PyObject *'
)
->
"PyObject *"
:
"""are_plugins_same(molpack_a, molpack_b) -> PyObject *"""
return
_libpymolfile
.
are_plugins_same
(
molpack_a
,
molpack_b
)
def
are_filehandles_same
(
molpack_a
:
'PyObject *'
,
molpack_b
:
'PyObject *'
)
->
"PyObject *"
:
"""are_filehandles_same(molpack_a, molpack_b) -> PyObject *"""
return
_libpymolfile
.
are_filehandles_same
(
molpack_a
,
molpack_b
)
# This file is compatible with both classic and new-style classes.
pymolfile/molfile/libpymolfile_wrap.cpp
deleted
100644 → 0
View file @
086f4be1
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#ifndef SWIGPYTHON
#define SWIGPYTHON
#endif
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template
<
typename
T
>
class
SwigValueWrapper
{
struct
SwigMovePointer
{
T
*
ptr
;
SwigMovePointer
(
T
*
p
)
:
ptr
(
p
)
{
}
~
SwigMovePointer
()
{
delete
ptr
;
}
SwigMovePointer
&
operator
=
(
SwigMovePointer
&
rhs
)
{
T
*
oldptr
=
ptr
;
ptr
=
0
;
delete
oldptr
;
ptr
=
rhs
.
ptr
;
rhs
.
ptr
=
0
;
return
*
this
;
}
}
pointer
;
SwigValueWrapper
&
operator
=
(
const
SwigValueWrapper
<
T
>&
rhs
);
SwigValueWrapper
(
const
SwigValueWrapper
<
T
>&
rhs
);
public:
SwigValueWrapper
()
:
pointer
(
0
)
{
}
SwigValueWrapper
&
operator
=
(
const
T
&
t
)
{
SwigMovePointer
tmp
(
new
T
(
t
));
pointer
=
tmp
;
return
*
this
;
}
operator
T
&
()
const
{
return
*
pointer
.
ptr
;
}
T
*
operator
&
()
{
return
pointer
.
ptr
;
}
};
template
<
typename
T
>
T
SwigValueInit
()
{
return
T
();
}
#endif
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
* ----------------------------------------------------------------------------- */
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
# define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
# define SWIGTEMPLATEDISAMBIGUATOR template
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline
# else
# define SWIGINLINE
# endif
#endif
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
#endif
#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
# pragma warning(disable : 4505)
/* unreferenced local function has been removed */
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
/* exporting methods */
#if defined(__GNUC__)
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
# endif
#endif
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED)
# define SWIGEXPORT
# else
# define SWIGEXPORT __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
# define SWIGEXPORT __attribute__ ((visibility("default")))
# else
# define SWIGEXPORT
# endif
# endif
#endif
/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif
/* Intel's compiler complains if a variable which was never initialised is
* cast to void, which is a common idiom which we use to indicate that we
* are aware a variable isn't used. So we just silence that warning.
* See: https://github.com/swig/swig/issues/192 for more discussion.
*/
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include <Python.h>
# define _DEBUG
#else
# include <Python.h>
#endif
/* -----------------------------------------------------------------------------
* swigrun.swg
*
* This file contains generic C API SWIG runtime support for pointer
* type checking.
* ----------------------------------------------------------------------------- */
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif
/*
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
creating a static or dynamic library from the SWIG runtime code.
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
But only do this if strictly necessary, ie, if you have problems
with your compiler or suchlike.
*/
#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif
#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif
/* Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
/*
Flags/methods for returning states.
The SWIG conversion methods, as ConvertPtr, return an integer
that tells if the conversion was successful or not. And if not,
an error code can be returned (see swigerrors.swg for the codes).
Use the following macros/flags to set or process the returning
states.
In old versions of SWIG, code such as the following was usually written:
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
// success code
} else {
//fail code
}
Now you can be more explicit:
int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
if (SWIG_IsOK(res)) {
// success code
} else {
// fail code
}
which is the same really, but now you can also do
Type *ptr;
int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
if (SWIG_IsOK(res)) {
// success code
if (SWIG_IsNewObj(res) {
...
delete *ptr;
} else {
...
}
} else {
// fail code
}
I.e., now SWIG_ConvertPtr can return new objects and you can
identify the case and take care of the deallocation. Of course that
also requires SWIG_ConvertPtr to return new result values, such as
int SWIG_ConvertPtr(obj, ptr,...) {
if (<obj is ok>) {
if (<need new object>) {
*ptr = <ptr to new allocated object>;
return SWIG_NEWOBJ;
} else {
*ptr = <ptr to old object>;
return SWIG_OLDOBJ;
}
} else {
return SWIG_BADOBJ;
}
}
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
SWIG errors code.
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
allows to return the 'cast rank', for example, if you have this
int food(double)
int fooi(int);
and you call
food(1) // cast rank '1' (1 -> 1.0)
fooi(1) // cast rank '0'
just use the SWIG_AddCast()/SWIG_CheckState()
*/
#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ (SWIG_ERROR)
#define SWIG_OLDOBJ (SWIG_OK)
#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)