ffi 0.6.3-x86-mingw32 → 1.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

Files changed (64) hide show
  1. data/History.txt +7 -0
  2. data/LICENSE +10 -21
  3. data/README.rdoc +1 -0
  4. data/Rakefile +4 -2
  5. data/ext/ffi_c/AbstractMemory.c +103 -38
  6. data/ext/ffi_c/AbstractMemory.h +15 -22
  7. data/ext/ffi_c/Buffer.c +61 -22
  8. data/ext/ffi_c/Call.c +52 -540
  9. data/ext/ffi_c/Call.h +1 -1
  10. data/ext/ffi_c/DataConverter.c +62 -0
  11. data/ext/ffi_c/DynamicLibrary.c +21 -1
  12. data/ext/ffi_c/Function.c +315 -30
  13. data/ext/ffi_c/MappedType.c +146 -0
  14. data/ext/ffi_c/MappedType.h +57 -0
  15. data/ext/ffi_c/MemoryPointer.c +12 -33
  16. data/ext/ffi_c/Platform.c +2 -0
  17. data/ext/ffi_c/Pointer.c +66 -28
  18. data/ext/ffi_c/Struct.c +19 -306
  19. data/ext/ffi_c/Struct.h +6 -0
  20. data/ext/ffi_c/StructByReference.c +150 -0
  21. data/ext/ffi_c/StructByReference.h +50 -0
  22. data/ext/ffi_c/StructLayout.c +25 -14
  23. data/ext/ffi_c/Type.c +39 -68
  24. data/ext/ffi_c/Type.h +12 -22
  25. data/ext/ffi_c/Types.c +20 -5
  26. data/ext/ffi_c/Types.h +7 -7
  27. data/ext/ffi_c/Variadic.c +21 -17
  28. data/ext/ffi_c/extconf.rb +4 -0
  29. data/ext/ffi_c/ffi.c +8 -2
  30. data/ext/ffi_c/rbffi.h +1 -0
  31. data/lib/ffi/autopointer.rb +23 -22
  32. data/lib/ffi/enum.rb +36 -21
  33. data/lib/ffi/errno.rb +20 -0
  34. data/lib/ffi/ffi.rb +13 -80
  35. data/lib/ffi/io.rb +12 -20
  36. data/lib/ffi/library.rb +109 -92
  37. data/lib/ffi/managedstruct.rb +1 -1
  38. data/lib/ffi/memorypointer.rb +15 -21
  39. data/lib/ffi/platform.rb +24 -28
  40. data/lib/ffi/pointer.rb +14 -21
  41. data/lib/ffi/struct.rb +98 -49
  42. data/lib/ffi/struct_layout_builder.rb +158 -0
  43. data/lib/ffi/types.rb +99 -128
  44. data/lib/ffi/union.rb +20 -0
  45. data/lib/ffi/variadic.rb +33 -22
  46. data/lib/ffi_c.so +0 -0
  47. data/spec/ffi/async_callback_spec.rb +23 -0
  48. data/spec/ffi/callback_spec.rb +62 -0
  49. data/spec/ffi/custom_param_type.rb +31 -0
  50. data/spec/ffi/custom_type_spec.rb +73 -0
  51. data/spec/ffi/enum_spec.rb +19 -0
  52. data/spec/ffi/ffi_spec.rb +24 -0
  53. data/spec/ffi/pointer_spec.rb +15 -0
  54. data/spec/ffi/rbx/memory_pointer_spec.rb +7 -1
  55. data/spec/ffi/strptr_spec.rb +36 -0
  56. data/spec/ffi/struct_packed_spec.rb +46 -0
  57. data/spec/ffi/struct_spec.rb +19 -5
  58. data/spec/ffi/typedef_spec.rb +14 -0
  59. data/tasks/setup.rb +2 -1
  60. metadata +15 -6
  61. data/ext/ffi_c/AutoPointer.c +0 -60
  62. data/ext/ffi_c/AutoPointer.h +0 -18
  63. data/lib/1.8/ffi_c.so +0 -0
  64. data/lib/1.9/ffi_c.so +0 -0
@@ -1,60 +0,0 @@
1
-
2
- #include <stdbool.h>
3
- #include <stdint.h>
4
- #include <limits.h>
5
- #include <ruby.h>
6
- #include "rbffi.h"
7
- #include "AbstractMemory.h"
8
- #include "Pointer.h"
9
- #include "AutoPointer.h"
10
-
11
- typedef struct AutoPointer {
12
- AbstractMemory memory;
13
- VALUE parent;
14
- } AutoPointer;
15
-
16
- static void autoptr_mark(AutoPointer* ptr);
17
- static VALUE autoptr_allocate(VALUE klass);
18
- static VALUE autoptr_set_parent(VALUE self, VALUE parent);
19
-
20
- VALUE rbffi_AutoPointerClass = Qnil;
21
-
22
- static VALUE
23
- autoptr_allocate(VALUE klass)
24
- {
25
- AutoPointer* p;
26
- VALUE obj = Data_Make_Struct(klass, AutoPointer, autoptr_mark, -1, p);
27
- p->parent = Qnil;
28
- p->memory.access = MEM_RD | MEM_WR;
29
-
30
- return obj;
31
- }
32
-
33
- static VALUE
34
- autoptr_set_parent(VALUE self, VALUE parent)
35
- {
36
- AutoPointer* p;
37
- AbstractMemory* ptr = rbffi_AbstractMemory_Cast(parent, rbffi_PointerClass);
38
-
39
- Data_Get_Struct(self, AutoPointer, p);
40
- p->memory = *ptr;
41
- p->parent = parent;
42
-
43
- return self;
44
- }
45
-
46
- static void
47
- autoptr_mark(AutoPointer* ptr)
48
- {
49
- rb_gc_mark(ptr->parent);
50
- }
51
-
52
- void
53
- rbffi_AutoPointer_Init(VALUE moduleFFI)
54
- {
55
- rbffi_AutoPointerClass = rb_define_class_under(moduleFFI, "AutoPointer", rbffi_PointerClass);
56
- rb_global_variable(&rbffi_AutoPointerClass);
57
-
58
- rb_define_alloc_func(rbffi_AutoPointerClass, autoptr_allocate);
59
- rb_define_protected_method(rbffi_AutoPointerClass, "parent=", autoptr_set_parent, 1);
60
- }
@@ -1,18 +0,0 @@
1
-
2
- #ifndef _AUTOPOINTER_H
3
- #define _AUTOPOINTER_H
4
-
5
- #ifdef __cplusplus
6
- extern "C" {
7
- #endif
8
-
9
- extern void rbffi_AutoPointer_Init(VALUE ffiModule);
10
- extern VALUE rbffi_AutoPointerClass;
11
-
12
-
13
- #ifdef __cplusplus
14
- }
15
- #endif
16
-
17
- #endif /* _AUTOPOINTER_H */
18
-
Binary file
Binary file