PageRenderTime 40ms CodeModel.GetById 33ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/typemap

http://github.com/PerlGameDev/SDL
#! | 138 lines | 132 code | 6 blank | 0 comment | 0 complexity | d9b01dfb7dcd312ccabc34a426197964 MD5 | raw file
  1TYPEMAP
  2const Uint16 *		T_PTR
  3const Sint16 *		T_PTR
  4Uint8			T_UV
  5Uint8 *			T_PTR
  6const Uint8*		T_PTR
  7Uint8 **		T_PTR
  8Uint16			T_UV
  9Uint16 *		T_PTR
 10Uint32			T_UV
 11Uint32 *		T_PTR
 12SDLKey			T_UV
 13SDLKey *		T_PTR
 14SDLMod			T_UV
 15SDLMod *		T_PTR
 16Sint16			T_IV
 17Sint16 *		T_PTR
 18Sint32			T_IV
 19Sint32 *		T_PTR
 20SDL_Event *		O_OBJECT	
 21SDL_ActiveEvent * 	O_OBJECT
 22SDL_KeyboardEvent * 	O_OBJECT
 23SDL_TextInputEvent * 	O_OBJECT
 24SDL_MouseMotionEvent * 	O_OBJECT
 25SDL_MouseButtonEvent * 	O_OBJECT
 26SDL_JoyAxisEvent * 	O_OBJECT
 27SDL_JoyHatEvent * 	O_OBJECT
 28SDL_JoyButtonEvent *	O_OBJECT
 29SDL_JoyBallEvent * 	O_OBJECT
 30SDL_ResizeEvent * 	O_OBJECT
 31SDL_ExposeEvent * 	O_OBJECT
 32SDL_SysWMEvent * 	O_OBJECT
 33SDL_UserEvent * 	O_OBJECT
 34SDL_QuitEvent * 	O_OBJECT
 35SDL_keysym *		O_OBJECT
 36SDL_Surface *		O_OBJECT
 37SDL_SysWMmsg *		T_PTR
 38SDL_CD *		O_OBJECT
 39SDL_CDtrack *		O_OBJECT
 40SDL_TimerCallback	T_PTR
 41SDL_Rect *		O_OBJECT
 42SDL_Color *		O_OBJECT
 43SDL_Palette *		O_OBJECT
 44SDL_PixelFormat *	O_OBJECT
 45SDL_VideoInfo *		O_OBJECT
 46SDL_version *		O_OBJECT
 47const SDL_version *		O_OBJECT
 48SDL_SysWMInfo *		O_OBJECT
 49SDL_Cursor *		O_OBJECT	
 50SDL_AudioSpec *		O_OBJECT
 51SDL_AudioCVT *		O_OBJECT
 52Mix_Fading		T_UV
 53Mix_Chunk *		O_OBJECT
 54Mix_Music *		O_OBJECT
 55SDL_GLattr              T_IV
 56SDLPango_Context * 	O_OBJECT
 57sdlx_timer * 		O_OBJECT
 58SDLx_LayerManager *	O_OBJECT
 59SDLx_Layer *		O_OBJECT
 60SDLx_Interface *	O_OBJECT
 61SDLx_State *		O_OBJECT
 62SDLPango_Alignment T_UV
 63int *			T_PTR
 64int **			T_PTR
 65void *			T_PTR
 66SDL_TimerID		T_PTR
 67SDL_NewTimerCallback	T_PTR
 68SDL_Joystick *		O_OBJECT	
 69FPSmanager *	O_OBJECT
 70SDLNet_SocketSet	T_PTR
 71TCPsocket		T_PTR
 72UDPsocket		T_PTR
 73UDPpacket *		T_PTR
 74UDPpacket **		T_PTR
 75IPaddress*		O_OBJECT			
 76SDLNet_GenericSocket	T_PTR
 77TTF_Font *		O_OBJECT
 78SDL_Overlay *		O_OBJECT	
 79SMPEG_Info *		O_OBJECT
 80SMPEG *			O_OBJECT
 81SMPEGstatus		T_IV
 82SDL_mutex *		T_PTR
 83GLbitfield		T_IV
 84GLenum			T_IV
 85ConsoleInformation * 	T_PTR
 86GLboolean		T_U_CHAR
 87GLUquadric *		T_PTR
 88GLdouble		T_NV
 89GLUnurbsObj *		T_PTR
 90GLUtesselator *		T_PTR
 91GLuint			T_UV
 92GLuint*			T_PTR
 93GLint			T_IV
 94GLint*			T_PTR
 95float *			T_PTR
 96float			T_NV
 97GLfloat			T_NV
 98Sound_DecoderInfo *	T_PTR
 99const Sound_DecoderInfo *	T_PTR
100Sound_Sample *		T_PTR
101Sound_AudioInfo *	T_PTR
102SDL_RWops*		O_OBJECT
103SDL_svg_context*	T_PTR
104int			T_IV
105intArray		T_ARRAY
106
107OUTPUT
108
109O_OBJECT_NPGC
110    sv_setref_pv( $arg, CLASS, (void*)$var );
111
112O_OBJECT
113    if ($var) {
114        void** pointers  = malloc(3 * sizeof(void*));
115        pointers[0]      = (void*)$var;
116        pointers[1]      = (void*)PERL_GET_CONTEXT;
117        Uint32 *threadid = (Uint32 *)safemalloc(sizeof(Uint32));
118        *threadid        = SDL_ThreadID();
119        pointers[2]      = (void*)threadid;
120        sv_setref_pv( $arg, CLASS, (void*)pointers ); 
121    } else {
122        XSRETURN_UNDEF;
123    }
124
125INPUT
126
127O_OBJECT_NPGC
128    $var = INT2PTR($type, SvIV((SV *)SvRV( $arg )));
129
130O_OBJECT
131    if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
132        void** pointers = (void**)INT2PTR(void *, SvIV((SV *)SvRV( $arg )));
133        $var = ($type)(pointers[0]);
134    } else if ($arg == 0) {
135        XSRETURN(0);
136    } else {
137        XSRETURN_UNDEF;
138    }