aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ruby_missing.h
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-23 16:12:24 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-23 16:12:24 +0000
commit231247c010acba191b78ed2d1310c935e63ad919 (patch)
tree10591a106bc2f3eff53eff8e440f58495ff517c9 /ext/openssl/ruby_missing.h
parentfd46a1da0a41b7939424bc5a393027be7940908e (diff)
downloadruby-231247c010acba191b78ed2d1310c935e63ad919.tar.gz
* ext/openssl: imported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ruby_missing.h')
-rw-r--r--ext/openssl/ruby_missing.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/ext/openssl/ruby_missing.h b/ext/openssl/ruby_missing.h
new file mode 100644
index 0000000000..bdb152b08e
--- /dev/null
+++ b/ext/openssl/ruby_missing.h
@@ -0,0 +1,70 @@
+/*
+ * $Id$
+ * 'OpenSSL for Ruby' project
+ * Copyright (C) 2001-2003 Michal Rokos <m.rokos@sh.cvut.cz>
+ * All rights reserved.
+ */
+/*
+ * This program is licenced under the same licence as Ruby.
+ * (See the file 'LICENCE'.)
+ */
+#if !defined(_OSSL_RUBY_MISSING_H_)
+#define _OSS_RUBY_MISSING_H_
+
+#if !defined(StringValue)
+# define StringValue(v) \
+ if (TYPE(v) != T_STRING) v = rb_str_to_str(v)
+#endif
+
+#if !defined(StringValuePtr)
+# define StringValuePtr(v) \
+ RSTRING((TYPE(v) == T_STRING) ? (v) : rb_str_to_str(v))->ptr
+#endif
+
+#if !defined(SafeStringValue)
+# define SafeStringValue(v) do {\
+ StringValue(v);\
+ rb_check_safe_str(v);\
+} while (0)
+#endif
+
+#if RUBY_VERSION_CODE < 180
+# define rb_cstr_to_inum(a,b,c) \
+ rb_cstr2inum(a,b)
+# define rb_check_frozen(obj) \
+ if (OBJ_FROZEN(obj)) rb_error_frozen(rb_obj_classname(obj))
+# define rb_obj_classname(obj) \
+ rb_class2name(CLASS_OF(obj))
+#endif
+
+#if HAVE_RB_DEFINE_ALLOC_FUNC
+# define DEFINE_ALLOC_WRAPPER(func)
+#else
+# define DEFINE_ALLOC_WRAPPER(func) \
+ static VALUE \
+ func##_wrapper(int argc, VALUE *argv, VALUE klass) \
+ { \
+ VALUE obj; \
+ \
+ obj = func(klass); \
+ \
+ rb_obj_call_init(obj, argc, argv); \
+ \
+ return obj; \
+ }
+# define rb_define_alloc_func(klass, func) \
+ rb_define_singleton_method(klass, "new", func##_wrapper, -1)
+#endif
+
+#if RUBY_VERSION_CODE >= 180
+# if !defined(HAVE_RB_OBJ_INIT_COPY)
+# define rb_define_copy_func(klass, func) \
+ rb_define_method(klass, "copy_object", func, 1)
+# else
+# define rb_define_copy_func(klass, func) \
+ rb_define_method(klass, "initialize_copy", func, 1)
+# endif
+#endif
+
+#endif /* _OSS_RUBY_MISSING_H_ */
+