summaryrefslogtreecommitdiff
path: root/share/swig/2.0.11/python/file.i
diff options
context:
space:
mode:
authorVince Harron <vharron@google.com>2015-06-07 21:43:05 -0700
committerVince Harron <vharron@google.com>2015-06-08 08:33:11 -0700
commit330b6544424d02bcdf29653dd889d524d2e6f7d2 (patch)
tree4c40fd53e5c12fcc83aeaa06f27fa606bcfe3d3c /share/swig/2.0.11/python/file.i
parent7b7c39b73762eb3aa12d79a3893e156fd801468e (diff)
downloadwindows-x86-68975394b5f9a8f1b6fcdaea81ef2f3fce1be02a.tar.gz
Diffstat (limited to 'share/swig/2.0.11/python/file.i')
-rw-r--r--share/swig/2.0.11/python/file.i41
1 files changed, 41 insertions, 0 deletions
diff --git a/share/swig/2.0.11/python/file.i b/share/swig/2.0.11/python/file.i
new file mode 100644
index 0000000..359c34d
--- /dev/null
+++ b/share/swig/2.0.11/python/file.i
@@ -0,0 +1,41 @@
+/* -----------------------------------------------------------------------------
+ * file.i
+ *
+ * Typemaps for FILE*
+ * ----------------------------------------------------------------------------- */
+
+%types(FILE *);
+
+/* defining basic methods */
+%fragment("SWIG_AsValFilePtr","header") {
+SWIGINTERN int
+SWIG_AsValFilePtr(PyObject *obj, FILE **val) {
+ static swig_type_info* desc = 0;
+ void *vptr = 0;
+ if (!desc) desc = SWIG_TypeQuery("FILE *");
+ if ((SWIG_ConvertPtr(obj, &vptr, desc, 0)) == SWIG_OK) {
+ if (val) *val = (FILE *)vptr;
+ return SWIG_OK;
+ }
+%#if PY_VERSION_HEX < 0x03000000
+ if (PyFile_Check(obj)) {
+ if (val) *val = PyFile_AsFile(obj);
+ return SWIG_OK;
+ }
+%#endif
+ return SWIG_TypeError;
+}
+}
+
+
+%fragment("SWIG_AsFilePtr","header",fragment="SWIG_AsValFilePtr") {
+SWIGINTERNINLINE FILE*
+SWIG_AsFilePtr(PyObject *obj) {
+ FILE *val = 0;
+ SWIG_AsValFilePtr(obj, &val);
+ return val;
+}
+}
+
+/* defining the typemaps */
+%typemaps_asval(%checkcode(POINTER), SWIG_AsValFilePtr, "SWIG_AsValFilePtr", FILE*);