mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/fiddle/fiddle.c: adding alignment constants for compatibility
with DL. * ext/fiddle/fiddle.h: ditto * ext/fiddle/lib/fiddle/cparser.rb: importing the C parser for DL backwards compatibility. * ext/fiddle/lib/fiddle/import.rb: importing the import DSL for DL backwards compatibility. * ext/fiddle/lib/fiddle/pack.rb: importing structure pack for DL backwards compatibility. * ext/fiddle/lib/fiddle/value.rb: ditto * ext/fiddle/lib/fiddle/struct.rb: importing struct DSL for DL backwards compatibility. * test/dl/test_c_struct_entry.rb: importing tests * test/dl/test_c_union_entity.rb: ditto * test/dl/test_cparser.rb: ditto * test/dl/test_import.rb: ditto * test/fiddle/test_c_struct_entry.rb: ditto * test/fiddle/test_c_union_entity.rb: ditto * test/fiddle/test_cparser.rb: ditto * test/fiddle/test_import.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
118d9f43c8
commit
0713f89944
16 changed files with 1316 additions and 61 deletions
|
@ -260,6 +260,86 @@ Init_fiddle(void)
|
|||
*/
|
||||
rb_define_const(mFiddle, "TYPE_UINTPTR_T", INT2NUM(TYPE_UINTPTR_T));
|
||||
|
||||
/* Document-const: ALIGN_VOIDP
|
||||
*
|
||||
* The alignment size of a void*
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_VOIDP", INT2NUM(ALIGN_VOIDP));
|
||||
|
||||
/* Document-const: ALIGN_CHAR
|
||||
*
|
||||
* The alignment size of a char
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_CHAR", INT2NUM(ALIGN_CHAR));
|
||||
|
||||
/* Document-const: ALIGN_SHORT
|
||||
*
|
||||
* The alignment size of a short
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_SHORT", INT2NUM(ALIGN_SHORT));
|
||||
|
||||
/* Document-const: ALIGN_INT
|
||||
*
|
||||
* The alignment size of an int
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_INT", INT2NUM(ALIGN_INT));
|
||||
|
||||
/* Document-const: ALIGN_LONG
|
||||
*
|
||||
* The alignment size of a long
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_LONG", INT2NUM(ALIGN_LONG));
|
||||
|
||||
#if HAVE_LONG_LONG
|
||||
/* Document-const: ALIGN_LONG_LONG
|
||||
*
|
||||
* The alignment size of a long long
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_LONG_LONG", INT2NUM(ALIGN_LONG_LONG));
|
||||
#endif
|
||||
|
||||
/* Document-const: ALIGN_FLOAT
|
||||
*
|
||||
* The alignment size of a float
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_FLOAT", INT2NUM(ALIGN_FLOAT));
|
||||
|
||||
/* Document-const: ALIGN_DOUBLE
|
||||
*
|
||||
* The alignment size of a double
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_DOUBLE",INT2NUM(ALIGN_DOUBLE));
|
||||
|
||||
/* Document-const: ALIGN_SIZE_T
|
||||
*
|
||||
* The alignment size of a size_t
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_SIZE_T", INT2NUM(ALIGN_OF(size_t)));
|
||||
|
||||
/* Document-const: ALIGN_SSIZE_T
|
||||
*
|
||||
* The alignment size of a ssize_t
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_SSIZE_T", INT2NUM(ALIGN_OF(size_t))); /* same as size_t */
|
||||
|
||||
/* Document-const: ALIGN_PTRDIFF_T
|
||||
*
|
||||
* The alignment size of a ptrdiff_t
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_PTRDIFF_T", INT2NUM(ALIGN_OF(ptrdiff_t)));
|
||||
|
||||
/* Document-const: ALIGN_INTPTR_T
|
||||
*
|
||||
* The alignment size of a intptr_t
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_INTPTR_T", INT2NUM(ALIGN_OF(intptr_t)));
|
||||
|
||||
/* Document-const: ALIGN_UINTPTR_T
|
||||
*
|
||||
* The alignment size of a uintptr_t
|
||||
*/
|
||||
rb_define_const(mFiddle, "ALIGN_UINTPTR_T", INT2NUM(ALIGN_OF(uintptr_t)));
|
||||
|
||||
/* Document-const: WINDOWS
|
||||
*
|
||||
* Returns a boolean regarding whether the host is WIN32
|
||||
|
@ -356,6 +436,14 @@ Init_fiddle(void)
|
|||
*/
|
||||
rb_define_const(mFiddle, "RUBY_FREE", PTR2NUM(ruby_xfree));
|
||||
|
||||
/* Document-const: BUILD_RUBY_PLATFORM
|
||||
*
|
||||
* Platform built against (i.e. "x86_64-linux", etc.)
|
||||
*
|
||||
* See also RUBY_PLATFORM
|
||||
*/
|
||||
rb_define_const(mFiddle, "BUILD_RUBY_PLATFORM", rb_str_new2(RUBY_PLATFORM));
|
||||
|
||||
rb_define_module_function(mFiddle, "dlwrap", rb_fiddle_value2ptr, 1);
|
||||
rb_define_module_function(mFiddle, "dlunwrap", rb_fiddle_ptr2value, 1);
|
||||
rb_define_module_function(mFiddle, "malloc", rb_fiddle_malloc, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue