Made a seperated Rect
[sdlgit/SDL_perl.git] / exp / SDL / Rect / Rect.c
1 /*
2  * This file was generated automatically by ExtUtils::ParseXS version 2.2002 from the
3  * contents of Rect.xs. Do not edit this file, edit Rect.xs instead.
4  *
5  *      ANY CHANGES MADE HERE WILL BE LOST! 
6  *
7  */
8
9 #line 1 "./Rect.xs"
10 #include "EXTERN.h"
11 #include "perl.h"
12 #include "XSUB.h"
13
14 #ifndef aTHX_
15 #define aTHX_
16 #endif
17
18 #include <SDL.h>
19
20
21
22 #line 23 "./Rect.c"
23 #ifndef PERL_UNUSED_VAR
24 #  define PERL_UNUSED_VAR(var) if (0) var = var
25 #endif
26
27 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
28 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
29
30 /* prototype to pass -Wmissing-prototypes */
31 STATIC void
32 S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
33
34 STATIC void
35 S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
36 {
37     const GV *const gv = CvGV(cv);
38
39     PERL_ARGS_ASSERT_CROAK_XS_USAGE;
40
41     if (gv) {
42         const char *const gvname = GvNAME(gv);
43         const HV *const stash = GvSTASH(gv);
44         const char *const hvname = stash ? HvNAME(stash) : NULL;
45
46         if (hvname)
47             Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
48         else
49             Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
50     } else {
51         /* Pants. I don't think that it should be possible to get here. */
52         Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
53     }
54 }
55 #undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE
56
57 #ifdef PERL_IMPLICIT_CONTEXT
58 #define croak_xs_usage(a,b)     S_croak_xs_usage(aTHX_ a,b)
59 #else
60 #define croak_xs_usage          S_croak_xs_usage
61 #endif
62
63 #endif
64
65 #line 66 "./Rect.c"
66
67 XS(XS_Rect_NewRect); /* prototype to pass -Wmissing-prototypes */
68 XS(XS_Rect_NewRect)
69 {
70 #ifdef dVAR
71     dVAR; dXSARGS;
72 #else
73     dXSARGS;
74 #endif
75     if (items != 4)
76        croak_xs_usage(cv,  "x, y, w, h");
77     {
78         Sint16  x = (Sint16)SvIV(ST(0));
79         Sint16  y = (Sint16)SvIV(ST(1));
80         Uint16  w = (Uint16)SvUV(ST(2));
81         Uint16  h = (Uint16)SvUV(ST(3));
82         SDL_Rect *      RETVAL;
83 #line 23 "./Rect.xs"
84                 RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
85                 RETVAL->x = x;
86                 RETVAL->y = y;
87                 RETVAL->w = w;
88                 RETVAL->h = h;
89 #line 90 "./Rect.c"
90         ST(0) = sv_newmortal();
91         sv_setref_pv(ST(0), "SDL_RectPtr", (void*)RETVAL);
92     }
93     XSRETURN(1);
94 }
95
96
97 XS(XS_Rect_RectX); /* prototype to pass -Wmissing-prototypes */
98 XS(XS_Rect_RectX)
99 {
100 #ifdef dVAR
101     dVAR; dXSARGS;
102 #else
103     dXSARGS;
104 #endif
105     if (items < 1)
106        croak_xs_usage(cv,  "rect, ...");
107     {
108         SDL_Rect *      rect;
109         Sint16  RETVAL;
110         dXSTARG;
111
112         if (sv_derived_from(ST(0), "SDL_RectPtr")) {
113             IV tmp = SvIV((SV*)SvRV(ST(0)));
114             rect = INT2PTR(SDL_Rect *,tmp);
115         }
116         else
117             Perl_croak(aTHX_ "%s: %s is not of type %s",
118                         "Rect::RectX",
119                         "rect", "SDL_RectPtr");
120 #line 35 "./Rect.xs"
121                 if (items > 1 ) rect->x = SvIV(ST(1)); 
122                 RETVAL = rect->x;
123 #line 124 "./Rect.c"
124         XSprePUSH; PUSHi((IV)RETVAL);
125     }
126     XSRETURN(1);
127 }
128
129
130 XS(XS_Rect_RectY); /* prototype to pass -Wmissing-prototypes */
131 XS(XS_Rect_RectY)
132 {
133 #ifdef dVAR
134     dVAR; dXSARGS;
135 #else
136     dXSARGS;
137 #endif
138     if (items < 1)
139        croak_xs_usage(cv,  "rect, ...");
140     {
141         SDL_Rect *      rect;
142         Sint16  RETVAL;
143         dXSTARG;
144
145         if (sv_derived_from(ST(0), "SDL_RectPtr")) {
146             IV tmp = SvIV((SV*)SvRV(ST(0)));
147             rect = INT2PTR(SDL_Rect *,tmp);
148         }
149         else
150             Perl_croak(aTHX_ "%s: %s is not of type %s",
151                         "Rect::RectY",
152                         "rect", "SDL_RectPtr");
153 #line 44 "./Rect.xs"
154                 if (items > 1 ) rect->y = SvIV(ST(1)); 
155                 RETVAL = rect->y;
156 #line 157 "./Rect.c"
157         XSprePUSH; PUSHi((IV)RETVAL);
158     }
159     XSRETURN(1);
160 }
161
162
163 XS(XS_Rect_RectW); /* prototype to pass -Wmissing-prototypes */
164 XS(XS_Rect_RectW)
165 {
166 #ifdef dVAR
167     dVAR; dXSARGS;
168 #else
169     dXSARGS;
170 #endif
171     if (items < 1)
172        croak_xs_usage(cv,  "rect, ...");
173     {
174         SDL_Rect *      rect;
175         Uint16  RETVAL;
176         dXSTARG;
177
178         if (sv_derived_from(ST(0), "SDL_RectPtr")) {
179             IV tmp = SvIV((SV*)SvRV(ST(0)));
180             rect = INT2PTR(SDL_Rect *,tmp);
181         }
182         else
183             Perl_croak(aTHX_ "%s: %s is not of type %s",
184                         "Rect::RectW",
185                         "rect", "SDL_RectPtr");
186 #line 53 "./Rect.xs"
187                 if (items > 1 ) rect->w = SvIV(ST(1)); 
188                 RETVAL = rect->w;
189 #line 190 "./Rect.c"
190         XSprePUSH; PUSHu((UV)RETVAL);
191     }
192     XSRETURN(1);
193 }
194
195
196 XS(XS_Rect_RectH); /* prototype to pass -Wmissing-prototypes */
197 XS(XS_Rect_RectH)
198 {
199 #ifdef dVAR
200     dVAR; dXSARGS;
201 #else
202     dXSARGS;
203 #endif
204     if (items < 1)
205        croak_xs_usage(cv,  "rect, ...");
206     {
207         SDL_Rect *      rect;
208         Uint16  RETVAL;
209         dXSTARG;
210
211         if (sv_derived_from(ST(0), "SDL_RectPtr")) {
212             IV tmp = SvIV((SV*)SvRV(ST(0)));
213             rect = INT2PTR(SDL_Rect *,tmp);
214         }
215         else
216             Perl_croak(aTHX_ "%s: %s is not of type %s",
217                         "Rect::RectH",
218                         "rect", "SDL_RectPtr");
219 #line 62 "./Rect.xs"
220                 if (items > 1 ) rect->h = SvIV(ST(1)); 
221                 RETVAL = rect->h;
222 #line 223 "./Rect.c"
223         XSprePUSH; PUSHu((UV)RETVAL);
224     }
225     XSRETURN(1);
226 }
227
228
229 XS(XS_SDL_RectPtr_DESTROY); /* prototype to pass -Wmissing-prototypes */
230 XS(XS_SDL_RectPtr_DESTROY)
231 {
232 #ifdef dVAR
233     dVAR; dXSARGS;
234 #else
235     dXSARGS;
236 #endif
237     if (items != 1)
238        croak_xs_usage(cv,  "rect");
239     {
240         SDL_Rect *      rect;
241
242         if (SvROK(ST(0))) {
243             IV tmp = SvIV((SV*)SvRV(ST(0)));
244             rect = INT2PTR(SDL_Rect *,tmp);
245         }
246         else
247             Perl_croak(aTHX_ "%s: %s is not a reference",
248                         "SDL_RectPtr::DESTROY",
249                         "rect");
250 #line 73 "./Rect.xs"
251                 printf("RectPtr::DESTROY\n");
252                 safefree( rect );
253 #line 254 "./Rect.c"
254     }
255     XSRETURN_EMPTY;
256 }
257
258 #ifdef __cplusplus
259 extern "C"
260 #endif
261 XS(boot_Rect); /* prototype to pass -Wmissing-prototypes */
262 XS(boot_Rect)
263 {
264 #ifdef dVAR
265     dVAR; dXSARGS;
266 #else
267     dXSARGS;
268 #endif
269     const char* file = __FILE__;
270
271     PERL_UNUSED_VAR(cv); /* -W */
272     PERL_UNUSED_VAR(items); /* -W */
273     XS_VERSION_BOOTCHECK ;
274
275         newXS("Rect::NewRect", XS_Rect_NewRect, file);
276         newXS("Rect::RectX", XS_Rect_RectX, file);
277         newXS("Rect::RectY", XS_Rect_RectY, file);
278         newXS("Rect::RectW", XS_Rect_RectW, file);
279         newXS("Rect::RectH", XS_Rect_RectH, file);
280         newXS("SDL_RectPtr::DESTROY", XS_SDL_RectPtr_DESTROY, file);
281     if (PL_unitcheckav)
282          call_list(PL_scopestack_ix, PL_unitcheckav);
283     XSRETURN_YES;
284 }
285