Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Raw.xs: split Callback and MemPtr into sub XS files

  • Loading branch information...
commit 91b4bb59160a29704715691209dcf13fa03bdbed 1 parent effef57
@ghedo authored
Showing with 77 additions and 76 deletions.
  1. +2 −76 Raw.xs
  2. +41 −0 xs/Callback.xs
  3. +34 −0 xs/MemPtr.xs
View
78 Raw.xs
@@ -351,79 +351,5 @@ call(self, ...)
OUTPUT: RETVAL
-MODULE = FFI::Raw PACKAGE = FFI::Raw::MemPtr
-
-FFI_Raw_MemPtr_t *
-new(class, number)
- SV *class
- unsigned int number
-
- INIT:
- void *temp;
- SV *output;
-
- CODE:
- Newx(temp, number, char);
-
- RETVAL = temp;
-
- OUTPUT: RETVAL
-
-SV *
-tostr(self)
- FFI_Raw_MemPtr_t *self
-
- CODE:
- RETVAL = newSVpv(self, 0);
-
- OUTPUT: RETVAL
-
-void
-DESTROY(self)
- FFI_Raw_MemPtr_t *self
-
- CODE:
- void **ptr = self;
- Safefree(ptr);
-
-MODULE = FFI::Raw PACKAGE = FFI::Raw::Callback
-
-FFI_Raw_Callback_t *
-new(class, coderef, ret_type, ...)
- SV *class
- SV *coderef
- SV *ret_type
-
- INIT:
- int status;
- FFI_Raw_Callback_t *ffi_raw_cb;
-
- CODE:
- Newx(ffi_raw_cb, 1, FFI_Raw_Callback_t);
-
- ffi_raw_cb -> coderef = coderef;
- ffi_raw_cb -> closure = ffi_closure_alloc(
- sizeof(ffi_closure),
- &ffi_raw_cb -> fn
- );
-
- INIT_FFI_CIF(ffi_raw_cb, 3)
-
- status = ffi_prep_closure_loc(
- ffi_raw_cb -> closure, &ffi_raw_cb -> cif,
- _ffi_raw_cb_wrap, ffi_raw_cb,
- ffi_raw_cb -> fn
- );
-
- RETVAL = ffi_raw_cb;
-
- OUTPUT: RETVAL
-
-void
-DESTROY(self)
- FFI_Raw_Callback_t *self
-
- CODE:
- Safefree(self -> args_types);
- Safefree(self -> args);
- Safefree(self);
+INCLUDE: xs/MemPtr.xs
+INCLUDE: xs/Callback.xs
View
41 xs/Callback.xs
@@ -0,0 +1,41 @@
+MODULE = FFI::Raw PACKAGE = FFI::Raw::Callback
+
+FFI_Raw_Callback_t *
+new(class, coderef, ret_type, ...)
+ SV *class
+ SV *coderef
+ SV *ret_type
+
+ INIT:
+ int status;
+ FFI_Raw_Callback_t *ffi_raw_cb;
+
+ CODE:
+ Newx(ffi_raw_cb, 1, FFI_Raw_Callback_t);
+
+ ffi_raw_cb -> coderef = coderef;
+ ffi_raw_cb -> closure = ffi_closure_alloc(
+ sizeof(ffi_closure),
+ &ffi_raw_cb -> fn
+ );
+
+ INIT_FFI_CIF(ffi_raw_cb, 3)
+
+ status = ffi_prep_closure_loc(
+ ffi_raw_cb -> closure, &ffi_raw_cb -> cif,
+ _ffi_raw_cb_wrap, ffi_raw_cb,
+ ffi_raw_cb -> fn
+ );
+
+ RETVAL = ffi_raw_cb;
+
+ OUTPUT: RETVAL
+
+void
+DESTROY(self)
+ FFI_Raw_Callback_t *self
+
+ CODE:
+ Safefree(self -> args_types);
+ Safefree(self -> args);
+ Safefree(self);
View
34 xs/MemPtr.xs
@@ -0,0 +1,34 @@
+MODULE = FFI::Raw PACKAGE = FFI::Raw::MemPtr
+
+FFI_Raw_MemPtr_t *
+new(class, number)
+ SV *class
+ unsigned int number
+
+ INIT:
+ void *temp;
+ SV *output;
+
+ CODE:
+ Newx(temp, number, char);
+
+ RETVAL = temp;
+
+ OUTPUT: RETVAL
+
+SV *
+tostr(self)
+ FFI_Raw_MemPtr_t *self
+
+ CODE:
+ RETVAL = newSVpv(self, 0);
+
+ OUTPUT: RETVAL
+
+void
+DESTROY(self)
+ FFI_Raw_MemPtr_t *self
+
+ CODE:
+ void **ptr = self;
+ Safefree(ptr);
Please sign in to comment.
Something went wrong with that request. Please try again.