/trunk/Lib/ruby/file.i
Swig | 39 lines | 34 code | 5 blank | 0 comment | 0 complexity | 6c956542077bdb2624dc5225feba6991 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- // 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);
- }