Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added proper typemap compile

  • Loading branch information...
commit 10444e6d20134525b5871e6cddb61bc33d61f591 1 parent eafb829
@kthakore kthakore authored
Showing with 139 additions and 2 deletions.
  1. +4 −2 code_listings/xs_effects.pl
  2. +135 −0 typemap
View
6 code_listings/xs_effects.pl
@@ -1,10 +1,12 @@
use Alien::SDL;
use SDL;
use SDLx::App;
+use Cwd;
+use File::Spec qw/catfile/;
use Inline;
my $libs = Alien::SDL->config('libs');
my $cflags = Alien::SDL->config('cflags');
-my $typemap = '/home/kthakore/Documents/Development/SDLPerl/SDL/typemap';
+my $typemap = File::Spec->catfile( cwd(), 'typemap');
my $code =
'#include <SDL.h>
@@ -45,7 +47,7 @@
Inline->bind( C => $code => LIBS => $libs => CCFLAGS => $cflags => TYPEMAPS => $typemap );
-my $app = SDLx::App->new( width => 640, height => 480, eoq => 1 );
+my $app = SDLx::App->new( width => 640, height => 480, eoq => 1, title => "Grovvy XS Effects" );
$app->add_show_handler( sub{ render( $app ) } );
View
135 typemap
@@ -0,0 +1,135 @@
+TYPEMAP
+const Uint16 * T_PTR
+const Sint16 * T_PTR
+Uint8 T_UV
+Uint8 * T_PTR
+const Uint8* T_PTR
+Uint8 ** T_PTR
+Uint16 T_UV
+Uint16 * T_PTR
+Uint32 T_UV
+Uint32 * T_PTR
+SDLKey T_UV
+SDLKey * T_PTR
+SDLMod T_UV
+SDLMod * T_PTR
+Sint16 T_IV
+Sint16 * T_PTR
+Sint32 T_IV
+Sint32 * T_PTR
+SDL_Event * O_OBJECT
+SDL_ActiveEvent * O_OBJECT
+SDL_KeyboardEvent * O_OBJECT
+SDL_TextInputEvent * O_OBJECT
+SDL_MouseMotionEvent * O_OBJECT
+SDL_MouseButtonEvent * O_OBJECT
+SDL_JoyAxisEvent * O_OBJECT
+SDL_JoyHatEvent * O_OBJECT
+SDL_JoyButtonEvent * O_OBJECT
+SDL_JoyBallEvent * O_OBJECT
+SDL_ResizeEvent * O_OBJECT
+SDL_ExposeEvent * O_OBJECT
+SDL_SysWMEvent * O_OBJECT
+SDL_UserEvent * O_OBJECT
+SDL_QuitEvent * O_OBJECT
+SDL_keysym * O_OBJECT
+SDL_Surface * O_OBJECT
+SDL_SysWMmsg * T_PTR
+SDL_CD * O_OBJECT
+SDL_CDtrack * O_OBJECT
+SDL_TimerCallback T_PTR
+SDL_Rect * O_OBJECT
+SDL_Color * O_OBJECT
+SDL_Palette * O_OBJECT
+SDL_PixelFormat * O_OBJECT
+SDL_VideoInfo * O_OBJECT
+SDL_version * O_OBJECT
+const SDL_version * O_OBJECT
+SDL_SysWMInfo * O_OBJECT
+SDL_Cursor * O_OBJECT
+SDL_AudioSpec * O_OBJECT
+SDL_AudioCVT * O_OBJECT
+Mix_Fading T_UV
+Mix_Chunk * O_OBJECT
+Mix_Music * O_OBJECT
+SDL_GLattr T_IV
+SDLPango_Context * O_OBJECT
+sdlx_timer * O_OBJECT
+SDLx_LayerManager * O_OBJECT
+SDLx_Layer * O_OBJECT
+SDLx_Interface * O_OBJECT
+SDLx_State * O_OBJECT
+SDLPango_Alignment T_UV
+int * T_PTR
+int ** T_PTR
+void * T_PTR
+SDL_TimerID T_PTR
+SDL_NewTimerCallback T_PTR
+SDL_Joystick * O_OBJECT
+FPSmanager * O_OBJECT
+SDLNet_SocketSet T_PTR
+TCPsocket T_PTR
+UDPsocket T_PTR
+UDPpacket * T_PTR
+UDPpacket ** T_PTR
+IPaddress* O_OBJECT
+SDLNet_GenericSocket T_PTR
+TTF_Font * O_OBJECT
+SDL_Overlay * O_OBJECT
+SMPEG_Info * T_PTR
+SMPEG * T_PTR
+SMPEGstatus T_IV
+SDL_mutex * T_PTR
+GLbitfield T_IV
+GLenum T_IV
+ConsoleInformation * T_PTR
+GLboolean T_U_CHAR
+GLUquadric * T_PTR
+GLdouble T_NV
+GLUnurbsObj * T_PTR
+GLUtesselator * T_PTR
+GLuint T_UV
+GLuint* T_PTR
+GLint T_IV
+GLint* T_PTR
+float * T_PTR
+float T_NV
+GLfloat T_NV
+Sound_DecoderInfo * T_PTR
+const Sound_DecoderInfo * T_PTR
+Sound_Sample * T_PTR
+Sound_AudioInfo * T_PTR
+SDL_RWops* O_OBJECT
+SDL_svg_context* T_PTR
+int T_IV
+intArray T_ARRAY
+
+OUTPUT
+
+O_OBJECT_NPGC
+ sv_setref_pv( $arg, CLASS, (void*)$var );
+
+O_OBJECT
+ if ($var) {
+ void** pointers = malloc(2 * sizeof(void*));
+ pointers[0] = (void*)$var;
+ pointers[1] = (void*)PERL_GET_CONTEXT;
+ sv_setref_pv( $arg, CLASS, (void*)pointers );
+ } else {
+ XSRETURN_UNDEF;
+ }
+
+INPUT
+
+O_OBJECT_NPGC
+ $var = ($type) SvIV((SV*)SvRV($arg));
+
+O_OBJECT
+ if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
+ void** pointers = (void**)(SvIV((SV*)SvRV( $arg )));
+ $var = ($type)(pointers[0]);
+ } else if ($arg == 0) {
+ XSRETURN(0);
+ } else {
+ XSRETURN_UNDEF;
+ }
Please sign in to comment.
Something went wrong with that request. Please try again.