1 // FILE * 2 %{ 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 // Ruby 1.9 changed the file name of this header 8 #ifdef HAVE_RUBY_IO_H 9 #include "ruby/io.h" 10 #else 11 #include "rubyio.h" 12 #endif 13 14 #ifdef __cplusplus 15 } 16 #endif 17 %} 18 19 %typemap(in) FILE *READ { 20 OpenFile *of; 21 GetOpenFile($input, of); 22 rb_io_check_readable(of); 23 $1 = GetReadFile(of); 24 rb_read_check($1); 25 } 26 27 %typemap(in) FILE *READ_NOCHECK { 28 OpenFile *of; 29 GetOpenFile($input, of); 30 rb_io_check_readable(of); 31 $1 = GetReadFile(of); 32 } 33 34 %typemap(in) FILE *WRITE { 35 OpenFile *of; 36 GetOpenFile($input, of); 37 rb_io_check_writable(of); 38 $1 = GetWriteFile(of); 39 } 40