Ruby  1.9.3p547(2014-05-14revision45962)
ruby_missing.h
Go to the documentation of this file.
1 /*
2  * $Id: ruby_missing.h 44754 2014-01-30 03:49:07Z usa $
3  * 'OpenSSL for Ruby' project
4  * Copyright (C) 2001-2003 Michal Rokos <m.rokos@sh.cvut.cz>
5  * All rights reserved.
6  */
7 /*
8  * This program is licenced under the same licence as Ruby.
9  * (See the file 'LICENCE'.)
10  */
11 #if !defined(_OSSL_RUBY_MISSING_H_)
12 #define _OSSL_RUBY_MISSING_H_
13 
14 #define rb_define_copy_func(klass, func) \
15  rb_define_method((klass), "initialize_copy", (func), 1)
16 
17 
18 #ifndef GetReadFile
19 #define FPTR_TO_FD(fptr) ((fptr)->fd)
20 #else
21 #define FPTR_TO_FD(fptr) (fileno(GetReadFile(fptr)))
22 #endif
23 
24 #ifndef HAVE_RB_IO_T
25 #define rb_io_t OpenFile
26 #endif
27 
28 #ifndef HAVE_RB_STR_SET_LEN
29 /* these methods should probably be backported to 1.8 */
30 #define rb_str_set_len(str, length) do { \
31  RSTRING(str)->ptr[(length)] = 0; \
32  RSTRING(str)->len = (length); \
33 } while(0)
34 #endif /* ! HAVE_RB_STR_SET_LEN */
35 
36 #ifndef HAVE_RB_BLOCK_CALL
37 /* the openssl module doesn't use arg[3-4] and arg2 is always rb_each */
38 #define rb_block_call(arg1, arg2, arg3, arg4, arg5, arg6) rb_iterate(rb_each, (arg1), (arg5), (arg6))
39 #endif /* ! HAVE_RB_BLOCK_CALL */
40 
41 #ifdef PRIsVALUE
42 # define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
43 # define RB_OBJ_STRING(obj) (obj)
44 #else
45 # define PRIsVALUE "s"
46 # define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
47 # define RB_OBJ_STRING(obj) StringValueCStr(obj)
48 #endif
49 
50 #endif /* _OSSL_RUBY_MISSING_H_ */