PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

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