Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
4b33803e
"examples/cpp-examples/HelloWaterBox.cpp" did not exist on "f198f53ffb4f060f28871cf7d5dc444b2c875428"
Commit
4b33803e
authored
Jan 12, 2015
by
Robert McGibbon
Browse files
Merge branch 'bytes-4' of github.com:rmcgibbo/openmm into bytes-4
parents
c66e086e
7a4b3601
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
+15
-11
No files found.
wrappers/python/src/swig_doxygen/swig_lib/python/typemaps.i
View file @
4b33803e
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
int
i
,
n
;
int
i
,
n
;
PyObject
*
pyList
;
PyObject
*
pyList
;
n
=
(
*
$
1
)
.
size
()
;
n
=
(
*
$
1
)
.
size
()
;
pyList
=
PyList_New
(
n
)
;
pyList
=
PyList_New
(
n
)
;
PyObject
*
mm
=
PyImport_AddModule
(
"simtk.openmm"
)
;
PyObject
*
mm
=
PyImport_AddModule
(
"simtk.openmm"
)
;
PyObject
*
vec3
=
PyObject_GetAttrString
(
mm
,
"Vec3"
)
;
PyObject
*
vec3
=
PyObject_GetAttrString
(
mm
,
"Vec3"
)
;
...
@@ -169,11 +169,10 @@
...
@@ -169,11 +169,10 @@
$
result
=
PyBytes_FromStringAndSize
(
$
1.
c_str
(),
$
1.
length
())
;
$
result
=
PyBytes_FromStringAndSize
(
$
1.
c_str
(),
$
1.
length
())
;
}
}
%
typemap
(
in
)
const
std
::
string
&
{
%
typemap
(
in
)
std
::
string
{
// if we have a C++ method that takes in a std::string, we're most happy to
// if we have a C++ method that takes in a std::string, we're most happy to accept
// accept a python bytes object. But if the user passes in a unicode object
// a python bytes object. But if the user passes in a unicode object we'll try
// we'll try to recover by encoding it to UTF-8 bytes
// to recover by encoding it to UTF-8 bytes
PyObject
*
temp
=
NULL
;
PyObject
*
temp
=
NULL
;
char
*
c_str
=
NULL
;
char
*
c_str
=
NULL
;
Py_ssize_t
len
=
0
;
Py_ssize_t
len
=
0
;
...
@@ -181,19 +180,24 @@
...
@@ -181,19 +180,24 @@
if
(
PyUnicode_Check
(
$
input
))
{
if
(
PyUnicode_Check
(
$
input
))
{
temp
=
PyUnicode_AsUTF8String
(
$
input
)
;
temp
=
PyUnicode_AsUTF8String
(
$
input
)
;
if
(
temp
==
NULL
)
{
if
(
temp
==
NULL
)
{
SWIG_exception_fail
(
SWIG_TypeError
,
"'utf-8' codec can't decode byte"
)
;
SWIG_exception_fail
(
SWIG_TypeError
,
"
$symname:
'utf-8' codec can't decode byte"
)
;
}
}
PyBytes_AsStringAndSize
(
temp
,
&
c_str,
&
len);
PyBytes_AsStringAndSize
(
temp
,
&
c_str,
&
len);
Py_XDECREF
(
temp
)
;
Py_XDECREF
(
temp
)
;
}
else
if
(
PyBytes_Check
(
$
input
))
{
}
else
if
(
PyBytes_Check
(
$
input
))
{
PyBytes_AsStringAndSize
(
$
input
,
&
c_str,
&
len);
PyBytes_AsStringAndSize
(
$
input
,
&
c_str,
&
len);
}
else
{
}
else
{
SWIG_exception_fail
(
SWIG_TypeError
,
"argument must be str or bytes"
)
;
SWIG_exception_fail
(
SWIG_TypeError
,
"
$symname:
argument must be str or bytes"
)
;
}
}
if
(
c_str
==
NULL
)
{
if
(
c_str
==
NULL
)
{
SWIG_exception_fail
(
SWIG_TypeError
,
"argument must be str or bytes"
)
;
SWIG_exception_fail
(
SWIG_TypeError
,
"
$symname:
argument must be str or bytes"
)
;
}
}
$
1
=
std
::
string
(
c_str
,
len
)
;
std
::
string
temp2
(
c_str
,
len
)
;
}
$
1
=
&
temp2;
\ No newline at end of file
}
%
typemap
(
freearg
)
const
std
::
string
&
{
// Don't delete me
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment