Skip to content
Browse files

Cleanup. Added RWops xs,pm, and pod. Added tests to 00-load

  • Loading branch information...
1 parent 3267cec commit 0f35eddf6cf3c47ec0b6978e7c13437f1a4b558b @kthakore kthakore committed
Showing with 155 additions and 101 deletions.
  1. +8 −0 Build.PL
  2. +4 −3 lib/SDL/{TextInputEvent.pm → RWOps.pm}
  3. +11 −0 lib/pods/SDL/RWOps.pod
  4. +123 −0 src/Core/objects/RWOps.xs
  5. +0 −96 src/SDL.xs
  6. +7 −0 t/00-load.t
  7. +1 −1 t/core_rwops.t
  8. +1 −1 typemap
View
8 Build.PL
@@ -105,6 +105,14 @@ my %subsystems =
},
libraries => [qw( SDL )],
},
+ RWOps => {
+ file => {
+ from => 'src/Core/objects/RWOps.xs',
+ to => 'lib/SDL/RWOps.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+
PixelFormat => {
file => {
from => 'src/Core/objects/PixelFormat.xs',
View
7 lib/SDL/TextInputEvent.pm → lib/SDL/RWOps.pm
@@ -1,8 +1,9 @@
-package SDL::TextInputEvent;
+package SDL::RWOps;
use strict;
use warnings;
require Exporter;
require DynaLoader;
our @ISA = qw(Exporter DynaLoader);
-bootstrap SDL::TextInputEvent;
-1;
+bootstrap SDL::RWOps;
+
+1;
View
11 lib/pods/SDL/RWOps.pod
@@ -0,0 +1,11 @@
+=pod
+
+=head1 NAME
+
+SDL::RWOps -- SDL Bindings to SDL_RWOPs
+
+=head1 CATEGORY
+
+TODO, Core, Structure
+
+=cut
View
123 src/Core/objects/RWOps.xs
@@ -0,0 +1,123 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::RWops PACKAGE = SDL::RWops PREFIX = rwops_
+
+=for documentation
+
+SDL_RWops -- Direct memory read write.
+
+=cut
+
+
+SDL_RWops*
+rwops_alloc (CLASS)
+ char* CLASS
+ CODE:
+ RETVAL = SDL_AllocRW();
+ OUTPUT:
+ RETVAL
+
+
+SDL_RWops*
+rwops_from_file ( CLASS, file, mode )
+ char* CLASS
+ char* file
+ char * mode
+ CODE:
+ RETVAL = SDL_RWFromFile(file,mode);
+ OUTPUT:
+ RETVAL
+
+SDL_RWops*
+rwops_from_FP ( CLASS, fp, autoclose )
+ char* CLASS
+ FILE* fp
+ int autoclose
+ CODE:
+ RETVAL = SDL_RWFromFP(fp,autoclose);
+ OUTPUT:
+ RETVAL
+
+SDL_RWops*
+rwops_from_mem ( CLASS, mem, size )
+ char* CLASS
+ char* mem
+ int size
+ CODE:
+ RETVAL = SDL_RWFromMem((void*)mem,size);
+ OUTPUT:
+ RETVAL
+
+SDL_RWops*
+rwops_from_const_mem (CLASS, mem, size )
+ char* CLASS
+ const char* mem
+ int size
+ CODE:
+ RETVAL = SDL_RWFromConstMem((const void*)mem,size);
+ OUTPUT:
+ RETVAL
+
+int
+rwops_seek ( rw, off, whence )
+ SDL_RWops* rw
+ int off
+ int whence
+ CODE:
+ RETVAL = SDL_RWseek(rw,off,whence);
+ OUTPUT:
+ RETVAL
+
+int
+rwops_tell ( rw )
+ SDL_RWops* rw
+ CODE:
+ RETVAL = SDL_RWtell(rw);
+ OUTPUT:
+ RETVAL
+
+int
+rwops_read ( rw, mem, size, n )
+ SDL_RWops* rw
+ char* mem
+ int size
+ int n
+ CODE:
+ RETVAL = SDL_RWread(rw,mem,size,n);
+ OUTPUT:
+ RETVAL
+
+int
+rwops_write ( rw, mem, size, n )
+ SDL_RWops* rw
+ char* mem
+ int size
+ int n
+ CODE:
+ RETVAL = SDL_RWwrite(rw,mem,size,n);
+ OUTPUT:
+ RETVAL
+
+int
+rwops_close ( rw )
+ SDL_RWops* rw
+ CODE:
+ RETVAL = SDL_RWclose(rw);
+ OUTPUT:
+ RETVAL
+
+void
+rwops_free ( rw )
+ SDL_RWops* rw
+ CODE:
+ SDL_FreeRW(rw);
+
+
View
96 src/SDL.xs
@@ -415,102 +415,6 @@ RemoveTimer ( id )
OUTPUT:
RETVAL
-SDL_RWops*
-RWFromFile ( file, mode )
- char* file
- char * mode
- CODE:
- RETVAL = SDL_RWFromFile(file,mode);
- OUTPUT:
- RETVAL
-
-SDL_RWops*
-RWFromFP ( fp, autoclose )
- FILE* fp
- int autoclose
- CODE:
- RETVAL = SDL_RWFromFP(fp,autoclose);
- OUTPUT:
- RETVAL
-
-SDL_RWops*
-RWFromMem ( mem, size )
- char* mem
- int size
- CODE:
- RETVAL = SDL_RWFromMem((void*)mem,size);
- OUTPUT:
- RETVAL
-
-SDL_RWops*
-RWFromConstMem ( mem, size )
- const char* mem
- int size
- CODE:
- RETVAL = SDL_RWFromConstMem((const void*)mem,size);
- OUTPUT:
- RETVAL
-
-SDL_RWops*
-AllocRW ()
- CODE:
- RETVAL = SDL_AllocRW();
- OUTPUT:
- RETVAL
-
-void
-FreeRW ( rw )
- SDL_RWops* rw
- CODE:
- SDL_FreeRW(rw);
-
-int
-RWseek ( rw, off, whence )
- SDL_RWops* rw
- int off
- int whence
- CODE:
- RETVAL = SDL_RWseek(rw,off,whence);
- OUTPUT:
- RETVAL
-
-int
-RWtell ( rw )
- SDL_RWops* rw
- CODE:
- RETVAL = SDL_RWtell(rw);
- OUTPUT:
- RETVAL
-
-int
-RWread ( rw, mem, size, n )
- SDL_RWops* rw
- char* mem
- int size
- int n
- CODE:
- RETVAL = SDL_RWread(rw,mem,size,n);
- OUTPUT:
- RETVAL
-
-int
-RWwrite ( rw, mem, size, n )
- SDL_RWops* rw
- char* mem
- int size
- int n
- CODE:
- RETVAL = SDL_RWwrite(rw,mem,size,n);
- OUTPUT:
- RETVAL
-
-int
-RWclose ( rw )
- SDL_RWops* rw
- CODE:
- RETVAL = SDL_RWclose(rw);
- OUTPUT:
- RETVAL
#ifdef HAVE_SDL_IMAGE
View
7 t/00-load.t
@@ -24,6 +24,13 @@ SDL::AudioSpec
SDL::CDROM
SDL::CDTrack
SDL::CD
+SDL::MultiThread
+SDL::PixelFormat
+SDL::VideoInfo
+SDL::Mixer
+SDL::Mixer::MixChunk
+SDL::Mixer::MixMusic
+SDL::Version
/;
plan tests => scalar @modules;
View
2 t/core_rwops.t
@@ -2,7 +2,7 @@
use strict;
use SDL;
use Test::More;
-
+use SDL::RWOps;
my @done = qw//;
my @left = qw/
View
2 typemap
@@ -88,7 +88,7 @@ Sound_DecoderInfo * T_PTR
const Sound_DecoderInfo * T_PTR
Sound_Sample * T_PTR
Sound_AudioInfo * T_PTR
-SDL_RWops* T_PTR
+SDL_RWops* O_OBJECT
SDL_svg_context* T_PTR
int T_IV
intArray T_ARRAY

0 comments on commit 0f35edd

Please sign in to comment.
Something went wrong with that request. Please try again.