summaryrefslogtreecommitdiff
path: root/share/swig/3.0.12/ruby/file.i
diff options
context:
space:
mode:
Diffstat (limited to 'share/swig/3.0.12/ruby/file.i')
-rw-r--r--share/swig/3.0.12/ruby/file.i39
1 files changed, 39 insertions, 0 deletions
diff --git a/share/swig/3.0.12/ruby/file.i b/share/swig/3.0.12/ruby/file.i
new file mode 100644
index 0000000..f9aaa27
--- /dev/null
+++ b/share/swig/3.0.12/ruby/file.i
@@ -0,0 +1,39 @@
+// FILE *
+%{
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Ruby 1.9 changed the file name of this header */
+#ifdef HAVE_RUBY_IO_H
+#include "ruby/io.h"
+#else
+#include "rubyio.h"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+%}
+
+%typemap(in) FILE *READ {
+ OpenFile *of;
+ GetOpenFile($input, of);
+ rb_io_check_readable(of);
+ $1 = GetReadFile(of);
+ rb_read_check($1);
+}
+
+%typemap(in) FILE *READ_NOCHECK {
+ OpenFile *of;
+ GetOpenFile($input, of);
+ rb_io_check_readable(of);
+ $1 = GetReadFile(of);
+}
+
+%typemap(in) FILE *WRITE {
+ OpenFile *of;
+ GetOpenFile($input, of);
+ rb_io_check_writable(of);
+ $1 = GetWriteFile(of);
+}