Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / socket / Socket.c
1 /*
2  * This file was generated automatically by ExtUtils::ParseXS version 2.2202 from the
3  * contents of Socket.xs. Do not edit this file, edit Socket.xs instead.
4  *
5  *      ANY CHANGES MADE HERE WILL BE LOST! 
6  *
7  */
8
9 /////////////////////////////////////////////////////////////////////////////
10 // Name:        ext/socket/Socket.xs
11 // Purpose:     XS for Wx::Socket
12 // Author:      Graciliano M. P.
13 // Modified by:
14 // Created:     27/02/2003
15 // RCS-ID:      $Id: Socket.xs 2700 2009-12-13 11:25:50Z mbarbon $
16 // Copyright:   (c) 2003-2004, 2006, 2008-2009 Graciliano M. P.
17 // Licence:     This program is free software; you can redistribute it and/or
18 //              modify it under the same terms as Perl itself
19 /////////////////////////////////////////////////////////////////////////////
20
21 #define PERL_NO_GET_CONTEXT
22
23 #include "cpp/wxapi.h"
24 #include "wx/socket.h"
25
26 #undef THIS
27
28 #include "cpp/sk_constants.cpp"
29 #include "cpp/socket.h"
30
31 #ifndef PERL_UNUSED_VAR
32 #  define PERL_UNUSED_VAR(var) if (0) var = var
33 #endif
34
35 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
36 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
37
38 /* prototype to pass -Wmissing-prototypes */
39 STATIC void
40 S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
41
42 STATIC void
43 S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
44 {
45     const GV *const gv = CvGV(cv);
46
47     PERL_ARGS_ASSERT_CROAK_XS_USAGE;
48
49     if (gv) {
50         const char *const gvname = GvNAME(gv);
51         const HV *const stash = GvSTASH(gv);
52         const char *const hvname = stash ? HvNAME(stash) : NULL;
53
54         if (hvname)
55             Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
56         else
57             Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
58     } else {
59         /* Pants. I don't think that it should be possible to get here. */
60         Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
61     }
62 }
63 #undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE
64
65 #ifdef PERL_IMPLICIT_CONTEXT
66 #define croak_xs_usage(a,b)     S_croak_xs_usage(aTHX_ a,b)
67 #else
68 #define croak_xs_usage          S_croak_xs_usage
69 #endif
70
71 #endif
72
73 /* NOTE: the prototype of newXSproto() is different in versions of perls,
74  * so we define a portable version of newXSproto()
75  */
76 #ifdef newXS_flags
77 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
78 #else
79 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
80 #endif /* !defined(newXS_flags) */
81
82
83 /* INCLUDE:  Including 'XS/SocketBase.xs' from 'Socket.xs' */
84
85
86 /* INCLUDE:  Including 'XS/SocketClient.xs' from 'XS/SocketBase.xs' */
87
88
89 /* INCLUDE:  Including 'XS/SocketServer.xs' from 'XS/SocketClient.xs' */
90
91
92 /* INCLUDE:  Including 'XS/SocketEvent.xs' from 'XS/SocketServer.xs' */
93
94
95 XS(XS_Wx__SocketEvent_new); /* prototype to pass -Wmissing-prototypes */
96 XS(XS_Wx__SocketEvent_new)
97 {
98 #ifdef dVAR
99     dVAR; dXSARGS;
100 #else
101     dXSARGS;
102 #endif
103     if (items < 1 || items > 2)
104        croak_xs_usage(cv,  "CLASS, id = 0");
105     {
106         int     id;
107         char *  CLASS = (char *)SvPV_nolen(ST(0));
108         wxSocketEvent * RETVAL;
109
110         if (items < 2)
111             id = 0;
112         else {
113             id = (int)SvIV(ST(1));
114         }
115     RETVAL = new wxSocketEvent( id ) ;
116         ST(0) = sv_newmortal();
117     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
118
119     }
120     XSRETURN(1);
121 }
122
123
124 XS(XS_Wx__SocketEvent_GetSocket); /* prototype to pass -Wmissing-prototypes */
125 XS(XS_Wx__SocketEvent_GetSocket)
126 {
127 #ifdef dVAR
128     dVAR; dXSARGS;
129 #else
130     dXSARGS;
131 #endif
132     if (items != 1)
133        croak_xs_usage(cv,  "THIS");
134     {
135         wxSocketEvent *    THIS = (wxSocketEvent *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketEvent" );
136         wxSocketBase *  RETVAL;
137
138         RETVAL = THIS->GetSocket();
139         ST(0) = sv_newmortal();
140     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
141
142     }
143     XSRETURN(1);
144 }
145
146
147 XS(XS_Wx__SocketEvent_GetSocketEvent); /* prototype to pass -Wmissing-prototypes */
148 XS(XS_Wx__SocketEvent_GetSocketEvent)
149 {
150 #ifdef dVAR
151     dVAR; dXSARGS;
152 #else
153     dXSARGS;
154 #endif
155     if (items != 1)
156        croak_xs_usage(cv,  "THIS");
157     {
158         wxSocketEvent *    THIS = (wxSocketEvent *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketEvent" );
159         long    RETVAL;
160         dXSTARG;
161
162         RETVAL = THIS->GetSocketEvent();
163         XSprePUSH; PUSHi((IV)RETVAL);
164     }
165     XSRETURN(1);
166 }
167
168
169 /* INCLUDE: Returning to 'XS/SocketServer.xs' from 'XS/SocketEvent.xs' */
170
171
172 XS(XS_Wx__SocketServer_new); /* prototype to pass -Wmissing-prototypes */
173 XS(XS_Wx__SocketServer_new)
174 {
175 #ifdef dVAR
176     dVAR; dXSARGS;
177 #else
178     dXSARGS;
179 #endif
180     if (items < 3 || items > 4)
181        croak_xs_usage(cv,  "CLASS, host, port, style = 0");
182     {
183         wxString        host;
184         wxString        port;
185         long    style;
186         char *  CLASS = (char *)SvPV_nolen(ST(0));
187         wxSocketServer *        RETVAL;
188
189     WXSTRING_INPUT( host, wxString, ST(1) );
190
191     WXSTRING_INPUT( port, wxString, ST(2) );
192
193         if (items < 4)
194             style = 0;
195         else {
196             style = (long)SvIV(ST(3));
197         }
198     wxIPV4address addr ;
199     addr.Hostname(host) ;
200     addr.Service(port) ;
201     RETVAL = new wxPlSocketServer( CLASS , addr , style ) ;
202         ST(0) = sv_newmortal();
203     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
204
205     }
206     XSRETURN(1);
207 }
208
209
210 XS(XS_Wx__SocketServer_Accept); /* prototype to pass -Wmissing-prototypes */
211 XS(XS_Wx__SocketServer_Accept)
212 {
213 #ifdef dVAR
214     dVAR; dXSARGS;
215 #else
216     dXSARGS;
217 #endif
218     if (items < 1 || items > 2)
219        croak_xs_usage(cv,  "THIS, wait = true");
220     {
221         bool    wait;
222         wxSocketServer *    THIS = (wxSocketServer *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketServer" );
223         wxSocketBase *  RETVAL;
224
225         if (items < 2)
226             wait = true;
227         else {
228             wait = (bool)SvTRUE(ST(1));
229         }
230     // works, more or less; not a good example of C++
231     RETVAL = ((wxPlSocketServer*)THIS)->Accept(wait);
232         ST(0) = sv_newmortal();
233     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
234
235     }
236     XSRETURN(1);
237 }
238
239
240 XS(XS_Wx__SocketServer_AcceptWith); /* prototype to pass -Wmissing-prototypes */
241 XS(XS_Wx__SocketServer_AcceptWith)
242 {
243 #ifdef dVAR
244     dVAR; dXSARGS;
245 #else
246     dXSARGS;
247 #endif
248     if (items < 2 || items > 3)
249        croak_xs_usage(cv,  "THIS, socket, wait = true");
250     {
251         wxSocketBase*    socket = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SocketBase" );
252         bool    wait;
253         wxSocketServer *    THIS = (wxSocketServer *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketServer" );
254         bool    RETVAL;
255
256         if (items < 3)
257             wait = true;
258         else {
259             wait = (bool)SvTRUE(ST(2));
260         }
261     RETVAL = THIS->AcceptWith( *socket , wait );
262         ST(0) = boolSV(RETVAL);
263         sv_2mortal(ST(0));
264     }
265     XSRETURN(1);
266 }
267
268
269 XS(XS_Wx__SocketServer_WaitForAccept); /* prototype to pass -Wmissing-prototypes */
270 XS(XS_Wx__SocketServer_WaitForAccept)
271 {
272 #ifdef dVAR
273     dVAR; dXSARGS;
274 #else
275     dXSARGS;
276 #endif
277     if (items < 1 || items > 3)
278        croak_xs_usage(cv,  "THIS, seconds = -1, millisecond = 0");
279     {
280         long    seconds;
281         long    millisecond;
282         wxSocketServer *    THIS = (wxSocketServer *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketServer" );
283         bool    RETVAL;
284
285         if (items < 2)
286             seconds = -1;
287         else {
288             seconds = (long)SvIV(ST(1));
289         }
290
291         if (items < 3)
292             millisecond = 0;
293         else {
294             millisecond = (long)SvIV(ST(2));
295         }
296
297         RETVAL = THIS->WaitForAccept(seconds, millisecond);
298         ST(0) = boolSV(RETVAL);
299         sv_2mortal(ST(0));
300     }
301     XSRETURN(1);
302 }
303
304
305 /* INCLUDE: Returning to 'XS/SocketClient.xs' from 'XS/SocketServer.xs' */
306
307
308 XS(XS_Wx__SocketClient_new); /* prototype to pass -Wmissing-prototypes */
309 XS(XS_Wx__SocketClient_new)
310 {
311 #ifdef dVAR
312     dVAR; dXSARGS;
313 #else
314     dXSARGS;
315 #endif
316     if (items < 1 || items > 2)
317        croak_xs_usage(cv,  "CLASS, style = 0");
318     {
319         long    style;
320         char *  CLASS = (char *)SvPV_nolen(ST(0));
321         wxSocketClient *        RETVAL;
322
323         if (items < 2)
324             style = 0;
325         else {
326             style = (long)SvIV(ST(1));
327         }
328     RETVAL = new wxPliSocketClient( CLASS , style ) ;
329         ST(0) = sv_newmortal();
330     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
331
332     }
333     XSRETURN(1);
334 }
335
336
337 XS(XS_Wx__SocketClient_Connect); /* prototype to pass -Wmissing-prototypes */
338 XS(XS_Wx__SocketClient_Connect)
339 {
340 #ifdef dVAR
341     dVAR; dXSARGS;
342 #else
343     dXSARGS;
344 #endif
345     if (items < 3 || items > 4)
346        croak_xs_usage(cv,  "THIS, host, port, wait = 1");
347     {
348         wxString        host;
349         wxString        port;
350         bool    wait;
351         wxSocketClient *    THIS = (wxSocketClient *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketClient" );
352         bool    RETVAL;
353
354     WXSTRING_INPUT( host, wxString, ST(1) );
355
356     WXSTRING_INPUT( port, wxString, ST(2) );
357
358         if (items < 4)
359             wait = 1;
360         else {
361             wait = (bool)SvTRUE(ST(3));
362         }
363     wxIPV4address addr ;
364     addr.Hostname(host) ;
365     addr.Service(port) ;
366     RETVAL = THIS->Connect( addr , wait ) ;
367         ST(0) = boolSV(RETVAL);
368         sv_2mortal(ST(0));
369     }
370     XSRETURN(1);
371 }
372
373
374 /* INCLUDE: Returning to 'XS/SocketBase.xs' from 'XS/SocketClient.xs' */
375
376 #if 0
377 #define XSubPPtmpAAAA 1
378
379
380 XS(XS_Wx__SocketBase_new); /* prototype to pass -Wmissing-prototypes */
381 XS(XS_Wx__SocketBase_new)
382 {
383 #ifdef dVAR
384     dVAR; dXSARGS;
385 #else
386     dXSARGS;
387 #endif
388     if (items != 1)
389        croak_xs_usage(cv,  "CLASS");
390     {
391         char *  CLASS = (char *)SvPV_nolen(ST(0));
392         wxSocketBase *  RETVAL;
393     RETVAL = new wxPlSocketBase( CLASS ) ;
394         ST(0) = sv_newmortal();
395     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
396
397     }
398     XSRETURN(1);
399 }
400
401 #endif
402
403 XS(XS_Wx__SocketBase_Destroy); /* prototype to pass -Wmissing-prototypes */
404 XS(XS_Wx__SocketBase_Destroy)
405 {
406 #ifdef dVAR
407     dVAR; dXSARGS;
408 #else
409     dXSARGS;
410 #endif
411     if (items != 1)
412        croak_xs_usage(cv,  "THIS");
413     {
414         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
415
416         THIS->Destroy();
417     }
418     XSRETURN_EMPTY;
419 }
420
421
422 XS(XS_Wx__SocketBase_Ok); /* prototype to pass -Wmissing-prototypes */
423 XS(XS_Wx__SocketBase_Ok)
424 {
425 #ifdef dVAR
426     dVAR; dXSARGS;
427 #else
428     dXSARGS;
429 #endif
430     if (items != 1)
431        croak_xs_usage(cv,  "THIS");
432     {
433         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
434         bool    RETVAL;
435
436         RETVAL = THIS->Ok();
437         ST(0) = boolSV(RETVAL);
438         sv_2mortal(ST(0));
439     }
440     XSRETURN(1);
441 }
442
443
444 XS(XS_Wx__SocketBase_IsConnected); /* prototype to pass -Wmissing-prototypes */
445 XS(XS_Wx__SocketBase_IsConnected)
446 {
447 #ifdef dVAR
448     dVAR; dXSARGS;
449 #else
450     dXSARGS;
451 #endif
452     if (items != 1)
453        croak_xs_usage(cv,  "THIS");
454     {
455         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
456         bool    RETVAL;
457
458         RETVAL = THIS->IsConnected();
459         ST(0) = boolSV(RETVAL);
460         sv_2mortal(ST(0));
461     }
462     XSRETURN(1);
463 }
464
465
466 XS(XS_Wx__SocketBase_IsDisconnected); /* prototype to pass -Wmissing-prototypes */
467 XS(XS_Wx__SocketBase_IsDisconnected)
468 {
469 #ifdef dVAR
470     dVAR; dXSARGS;
471 #else
472     dXSARGS;
473 #endif
474     if (items != 1)
475        croak_xs_usage(cv,  "THIS");
476     {
477         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
478         bool    RETVAL;
479
480         RETVAL = THIS->IsDisconnected();
481         ST(0) = boolSV(RETVAL);
482         sv_2mortal(ST(0));
483     }
484     XSRETURN(1);
485 }
486
487
488 XS(XS_Wx__SocketBase_IsData); /* prototype to pass -Wmissing-prototypes */
489 XS(XS_Wx__SocketBase_IsData)
490 {
491 #ifdef dVAR
492     dVAR; dXSARGS;
493 #else
494     dXSARGS;
495 #endif
496     if (items != 1)
497        croak_xs_usage(cv,  "THIS");
498     {
499         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
500         bool    RETVAL;
501
502         RETVAL = THIS->IsData();
503         ST(0) = boolSV(RETVAL);
504         sv_2mortal(ST(0));
505     }
506     XSRETURN(1);
507 }
508
509
510 XS(XS_Wx__SocketBase_LastCount); /* prototype to pass -Wmissing-prototypes */
511 XS(XS_Wx__SocketBase_LastCount)
512 {
513 #ifdef dVAR
514     dVAR; dXSARGS;
515 #else
516     dXSARGS;
517 #endif
518     if (items != 1)
519        croak_xs_usage(cv,  "THIS");
520     {
521         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
522         long    RETVAL;
523         dXSTARG;
524
525         RETVAL = THIS->LastCount();
526         XSprePUSH; PUSHi((IV)RETVAL);
527     }
528     XSRETURN(1);
529 }
530
531
532 XS(XS_Wx__SocketBase_Notify); /* prototype to pass -Wmissing-prototypes */
533 XS(XS_Wx__SocketBase_Notify)
534 {
535 #ifdef dVAR
536     dVAR; dXSARGS;
537 #else
538     dXSARGS;
539 #endif
540     if (items != 2)
541        croak_xs_usage(cv,  "THIS, notify");
542     {
543         bool    notify = (bool)SvTRUE(ST(1));
544         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
545
546         THIS->Notify(notify);
547     }
548     XSRETURN_EMPTY;
549 }
550
551
552 XS(XS_Wx__SocketBase_SetTimeout); /* prototype to pass -Wmissing-prototypes */
553 XS(XS_Wx__SocketBase_SetTimeout)
554 {
555 #ifdef dVAR
556     dVAR; dXSARGS;
557 #else
558     dXSARGS;
559 #endif
560     if (items != 2)
561        croak_xs_usage(cv,  "THIS, seconds");
562     {
563         int     seconds = (int)SvIV(ST(1));
564         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
565
566         THIS->SetTimeout(seconds);
567     }
568     XSRETURN_EMPTY;
569 }
570
571
572 XS(XS_Wx__SocketBase_Wait); /* prototype to pass -Wmissing-prototypes */
573 XS(XS_Wx__SocketBase_Wait)
574 {
575 #ifdef dVAR
576     dVAR; dXSARGS;
577 #else
578     dXSARGS;
579 #endif
580     if (items < 1 || items > 3)
581        croak_xs_usage(cv,  "THIS, seconds = -1, millisecond = 0");
582     {
583         long    seconds;
584         long    millisecond;
585         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
586         bool    RETVAL;
587
588         if (items < 2)
589             seconds = -1;
590         else {
591             seconds = (long)SvIV(ST(1));
592         }
593
594         if (items < 3)
595             millisecond = 0;
596         else {
597             millisecond = (long)SvIV(ST(2));
598         }
599
600         RETVAL = THIS->Wait(seconds, millisecond);
601         ST(0) = boolSV(RETVAL);
602         sv_2mortal(ST(0));
603     }
604     XSRETURN(1);
605 }
606
607
608 XS(XS_Wx__SocketBase_WaitForRead); /* prototype to pass -Wmissing-prototypes */
609 XS(XS_Wx__SocketBase_WaitForRead)
610 {
611 #ifdef dVAR
612     dVAR; dXSARGS;
613 #else
614     dXSARGS;
615 #endif
616     if (items < 1 || items > 3)
617        croak_xs_usage(cv,  "THIS, seconds = -1, millisecond = 0");
618     {
619         long    seconds;
620         long    millisecond;
621         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
622         bool    RETVAL;
623
624         if (items < 2)
625             seconds = -1;
626         else {
627             seconds = (long)SvIV(ST(1));
628         }
629
630         if (items < 3)
631             millisecond = 0;
632         else {
633             millisecond = (long)SvIV(ST(2));
634         }
635
636         RETVAL = THIS->WaitForRead(seconds, millisecond);
637         ST(0) = boolSV(RETVAL);
638         sv_2mortal(ST(0));
639     }
640     XSRETURN(1);
641 }
642
643
644 XS(XS_Wx__SocketBase_WaitForWrite); /* prototype to pass -Wmissing-prototypes */
645 XS(XS_Wx__SocketBase_WaitForWrite)
646 {
647 #ifdef dVAR
648     dVAR; dXSARGS;
649 #else
650     dXSARGS;
651 #endif
652     if (items < 1 || items > 3)
653        croak_xs_usage(cv,  "THIS, seconds = -1, millisecond = 0");
654     {
655         long    seconds;
656         long    millisecond;
657         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
658         bool    RETVAL;
659
660         if (items < 2)
661             seconds = -1;
662         else {
663             seconds = (long)SvIV(ST(1));
664         }
665
666         if (items < 3)
667             millisecond = 0;
668         else {
669             millisecond = (long)SvIV(ST(2));
670         }
671
672         RETVAL = THIS->WaitForWrite(seconds, millisecond);
673         ST(0) = boolSV(RETVAL);
674         sv_2mortal(ST(0));
675     }
676     XSRETURN(1);
677 }
678
679
680 XS(XS_Wx__SocketBase_Read); /* prototype to pass -Wmissing-prototypes */
681 XS(XS_Wx__SocketBase_Read)
682 {
683 #ifdef dVAR
684     dVAR; dXSARGS;
685 #else
686     dXSARGS;
687 #endif
688     if (items < 3 || items > 4)
689        croak_xs_usage(cv,  "THIS, buf, size, leng = 0");
690     {
691         SV*     buf = ST(1);
692         size_t    size = (size_t)SvUV( ST(2) );
693         size_t  leng;
694         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
695         long    RETVAL;
696         dXSTARG;
697
698         if (items < 4)
699             leng = 0;
700         else {
701     leng = (size_t)SvUV( ST(3) );
702         }
703     // Upgrade the SV to scalar if needed. If the scalar is undef
704     // can't use SvGROW.
705     SvUPGRADE(buf , SVt_PV) ;
706     // Tell that the scalar is string only (not integer, double, utf8...):
707     SvPOK_only(buf) ;
708
709     // Grow the scalar to receive the data and return a char* point:
710     char* buffer = SvGROW( buf , leng + size + 2 ) ;
711
712     // To read at the offset the user specified (works even if offset = 0):
713     if ( leng > 0 ) buffer += leng ;
714
715     THIS->Read( buffer , size ) ;
716     int nread = THIS->LastCount() ;
717
718     // Null-terminate the buffer, not necessary, but does not hurt:
719     buffer[nread] = 0 ;
720     // Tell Perl how long the string is:
721     SvCUR_set( buf , leng + nread ) ;
722     // Undef on read error:
723     if( THIS->Error() ) XSRETURN_UNDEF ;
724     // Return the amount of data read, like Perl read().
725     RETVAL = nread ;
726         XSprePUSH; PUSHi((IV)RETVAL);
727     }
728     XSRETURN(1);
729 }
730
731
732 XS(XS_Wx__SocketBase_Close); /* prototype to pass -Wmissing-prototypes */
733 XS(XS_Wx__SocketBase_Close)
734 {
735 #ifdef dVAR
736     dVAR; dXSARGS;
737 #else
738     dXSARGS;
739 #endif
740     if (items != 1)
741        croak_xs_usage(cv,  "THIS");
742     {
743         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
744
745         THIS->Close();
746     }
747     XSRETURN_EMPTY;
748 }
749
750
751 XS(XS_Wx__SocketBase_Discard); /* prototype to pass -Wmissing-prototypes */
752 XS(XS_Wx__SocketBase_Discard)
753 {
754 #ifdef dVAR
755     dVAR; dXSARGS;
756 #else
757     dXSARGS;
758 #endif
759     if (items != 1)
760        croak_xs_usage(cv,  "THIS");
761     {
762         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
763
764         THIS->Discard();
765     }
766     XSRETURN_EMPTY;
767 }
768
769
770 XS(XS_Wx__SocketBase_Error); /* prototype to pass -Wmissing-prototypes */
771 XS(XS_Wx__SocketBase_Error)
772 {
773 #ifdef dVAR
774     dVAR; dXSARGS;
775 #else
776     dXSARGS;
777 #endif
778     if (items != 1)
779        croak_xs_usage(cv,  "THIS");
780     {
781         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
782         bool    RETVAL;
783
784         RETVAL = THIS->Error();
785         ST(0) = boolSV(RETVAL);
786         sv_2mortal(ST(0));
787     }
788     XSRETURN(1);
789 }
790
791
792 XS(XS_Wx__SocketBase_GetFlags); /* prototype to pass -Wmissing-prototypes */
793 XS(XS_Wx__SocketBase_GetFlags)
794 {
795 #ifdef dVAR
796     dVAR; dXSARGS;
797 #else
798     dXSARGS;
799 #endif
800     if (items != 1)
801        croak_xs_usage(cv,  "THIS");
802     {
803         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
804         long    RETVAL;
805         dXSTARG;
806
807         RETVAL = THIS->GetFlags();
808         XSprePUSH; PUSHi((IV)RETVAL);
809     }
810     XSRETURN(1);
811 }
812
813
814 XS(XS_Wx__SocketBase_GetLocal); /* prototype to pass -Wmissing-prototypes */
815 XS(XS_Wx__SocketBase_GetLocal)
816 {
817 #ifdef dVAR
818     dVAR; dXSARGS;
819 #else
820     dXSARGS;
821 #endif
822     if (items != 1)
823        croak_xs_usage(cv,  "THIS");
824     PERL_UNUSED_VAR(ax); /* -Wall */
825     SP -= items;
826     {
827         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
828     wxIPV4address addr ;
829     THIS->GetLocal( addr ) ;
830     XPUSHs( sv_2mortal( newSVpv( addr.Hostname().mb_str(), 0 ) ) );
831     XPUSHs( sv_2mortal( newSViv( addr.Service() ) ) );
832         PUTBACK;
833         return;
834     }
835 }
836
837
838 XS(XS_Wx__SocketBase_GetPeer); /* prototype to pass -Wmissing-prototypes */
839 XS(XS_Wx__SocketBase_GetPeer)
840 {
841 #ifdef dVAR
842     dVAR; dXSARGS;
843 #else
844     dXSARGS;
845 #endif
846     if (items != 1)
847        croak_xs_usage(cv,  "THIS");
848     PERL_UNUSED_VAR(ax); /* -Wall */
849     SP -= items;
850     {
851         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
852     wxIPV4address addr ;
853     THIS->GetPeer( addr ) ;
854     XPUSHs( sv_2mortal( newSVpv( addr.Hostname().mb_str(), 0 ) ) );
855     XPUSHs( sv_2mortal( newSViv( addr.Service() ) ) );
856         PUTBACK;
857         return;
858     }
859 }
860
861
862 XS(XS_Wx__SocketBase_InterruptWait); /* prototype to pass -Wmissing-prototypes */
863 XS(XS_Wx__SocketBase_InterruptWait)
864 {
865 #ifdef dVAR
866     dVAR; dXSARGS;
867 #else
868     dXSARGS;
869 #endif
870     if (items != 1)
871        croak_xs_usage(cv,  "THIS");
872     {
873         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
874
875         THIS->InterruptWait();
876     }
877     XSRETURN_EMPTY;
878 }
879
880
881 XS(XS_Wx__SocketBase_LastError); /* prototype to pass -Wmissing-prototypes */
882 XS(XS_Wx__SocketBase_LastError)
883 {
884 #ifdef dVAR
885     dVAR; dXSARGS;
886 #else
887     dXSARGS;
888 #endif
889     if (items != 1)
890        croak_xs_usage(cv,  "THIS");
891     {
892         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
893         long    RETVAL;
894         dXSTARG;
895
896         RETVAL = THIS->LastError();
897         XSprePUSH; PUSHi((IV)RETVAL);
898     }
899     XSRETURN(1);
900 }
901
902
903 XS(XS_Wx__SocketBase_Peek); /* prototype to pass -Wmissing-prototypes */
904 XS(XS_Wx__SocketBase_Peek)
905 {
906 #ifdef dVAR
907     dVAR; dXSARGS;
908 #else
909     dXSARGS;
910 #endif
911     if (items < 3 || items > 4)
912        croak_xs_usage(cv,  "THIS, buf, size, leng = 0");
913     {
914         SV*     buf = ST(1);
915         size_t    size = (size_t)SvUV( ST(2) );
916         size_t  leng;
917         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
918         long    RETVAL;
919         dXSTARG;
920
921         if (items < 4)
922             leng = 0;
923         else {
924     leng = (size_t)SvUV( ST(3) );
925         }
926     SvUPGRADE(buf , SVt_PV) ;
927     SvPOK_only(buf) ;
928     char* buffer = SvGROW( buf , leng + size + 2 ) ;
929     if ( leng > 0 ) { buffer += leng ;}
930
931     THIS->Peek( buffer , size ) ;
932     int nread = THIS->LastCount() ;
933
934     buffer[nread] = 0 ;
935     SvCUR_set( buf , leng + nread ) ;
936     if( THIS->Error() ) XSRETURN_UNDEF ;
937     RETVAL = nread ;
938         XSprePUSH; PUSHi((IV)RETVAL);
939     }
940     XSRETURN(1);
941 }
942
943
944 XS(XS_Wx__SocketBase_ReadMsg); /* prototype to pass -Wmissing-prototypes */
945 XS(XS_Wx__SocketBase_ReadMsg)
946 {
947 #ifdef dVAR
948     dVAR; dXSARGS;
949 #else
950     dXSARGS;
951 #endif
952     if (items < 3 || items > 4)
953        croak_xs_usage(cv,  "THIS, buf, size, leng = 0");
954     {
955         SV*     buf = ST(1);
956         size_t    size = (size_t)SvUV( ST(2) );
957         size_t  leng;
958         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
959         long    RETVAL;
960         dXSTARG;
961
962         if (items < 4)
963             leng = 0;
964         else {
965     leng = (size_t)SvUV( ST(3) );
966         }
967     SvUPGRADE(buf , SVt_PV) ;
968     SvPOK_only(buf) ;
969     char* buffer = SvGROW( buf , leng + size + 2 ) ;
970     if ( leng > 0 ) { buffer += leng ;}
971
972     THIS->ReadMsg( buffer , size ) ;
973     int nread = THIS->LastCount() ;
974
975     buffer[nread] = 0 ;
976     SvCUR_set( buf , leng + nread ) ;
977     if( THIS->Error() ) XSRETURN_UNDEF ;
978     RETVAL = nread ;
979         XSprePUSH; PUSHi((IV)RETVAL);
980     }
981     XSRETURN(1);
982 }
983
984
985 XS(XS_Wx__SocketBase_RestoreState); /* prototype to pass -Wmissing-prototypes */
986 XS(XS_Wx__SocketBase_RestoreState)
987 {
988 #ifdef dVAR
989     dVAR; dXSARGS;
990 #else
991     dXSARGS;
992 #endif
993     if (items != 1)
994        croak_xs_usage(cv,  "THIS");
995     {
996         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
997
998         THIS->RestoreState();
999     }
1000     XSRETURN_EMPTY;
1001 }
1002
1003
1004 XS(XS_Wx__SocketBase_SaveState); /* prototype to pass -Wmissing-prototypes */
1005 XS(XS_Wx__SocketBase_SaveState)
1006 {
1007 #ifdef dVAR
1008     dVAR; dXSARGS;
1009 #else
1010     dXSARGS;
1011 #endif
1012     if (items != 1)
1013        croak_xs_usage(cv,  "THIS");
1014     {
1015         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1016
1017         THIS->SaveState();
1018     }
1019     XSRETURN_EMPTY;
1020 }
1021
1022
1023 XS(XS_Wx__SocketBase_SetFlags); /* prototype to pass -Wmissing-prototypes */
1024 XS(XS_Wx__SocketBase_SetFlags)
1025 {
1026 #ifdef dVAR
1027     dVAR; dXSARGS;
1028 #else
1029     dXSARGS;
1030 #endif
1031     if (items != 2)
1032        croak_xs_usage(cv,  "THIS, flags");
1033     {
1034         long    flags = (long)SvIV(ST(1));
1035         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1036
1037         THIS->SetFlags(flags);
1038     }
1039     XSRETURN_EMPTY;
1040 }
1041
1042
1043 XS(XS_Wx__SocketBase_SetNotify); /* prototype to pass -Wmissing-prototypes */
1044 XS(XS_Wx__SocketBase_SetNotify)
1045 {
1046 #ifdef dVAR
1047     dVAR; dXSARGS;
1048 #else
1049     dXSARGS;
1050 #endif
1051     if (items != 2)
1052        croak_xs_usage(cv,  "THIS, flags");
1053     {
1054         long    flags = (long)SvIV(ST(1));
1055         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1056
1057         THIS->SetNotify(flags);
1058     }
1059     XSRETURN_EMPTY;
1060 }
1061
1062
1063 XS(XS_Wx__SocketBase_Unread); /* prototype to pass -Wmissing-prototypes */
1064 XS(XS_Wx__SocketBase_Unread)
1065 {
1066 #ifdef dVAR
1067     dVAR; dXSARGS;
1068 #else
1069     dXSARGS;
1070 #endif
1071     if (items < 2 || items > 3)
1072        croak_xs_usage(cv,  "THIS, buf, size = 0");
1073     {
1074         SV*     buf = ST(1);
1075         long    size;
1076         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1077         long    RETVAL;
1078         dXSTARG;
1079
1080         if (items < 3)
1081             size = 0;
1082         else {
1083             size = (long)SvIV(ST(2));
1084         }
1085     // Upgrade the SV to scalar if needed. If the scalar is undef 
1086     // can't use SvGROW.
1087     SvUPGRADE(buf , SVt_PV) ;
1088
1089     if ( size == 0 ) { size = SvCUR(buf) ;}
1090     THIS->Unread( SvPV_nolen(buf) , size ) ;
1091     RETVAL = THIS->LastCount() ;
1092         XSprePUSH; PUSHi((IV)RETVAL);
1093     }
1094     XSRETURN(1);
1095 }
1096
1097
1098 XS(XS_Wx__SocketBase_WaitForLost); /* prototype to pass -Wmissing-prototypes */
1099 XS(XS_Wx__SocketBase_WaitForLost)
1100 {
1101 #ifdef dVAR
1102     dVAR; dXSARGS;
1103 #else
1104     dXSARGS;
1105 #endif
1106     if (items < 1 || items > 3)
1107        croak_xs_usage(cv,  "THIS, seconds = -1, millisecond = 0");
1108     {
1109         long    seconds;
1110         long    millisecond;
1111         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1112         bool    RETVAL;
1113
1114         if (items < 2)
1115             seconds = -1;
1116         else {
1117             seconds = (long)SvIV(ST(1));
1118         }
1119
1120         if (items < 3)
1121             millisecond = 0;
1122         else {
1123             millisecond = (long)SvIV(ST(2));
1124         }
1125
1126         RETVAL = THIS->WaitForLost(seconds, millisecond);
1127         ST(0) = boolSV(RETVAL);
1128         sv_2mortal(ST(0));
1129     }
1130     XSRETURN(1);
1131 }
1132
1133
1134 XS(XS_Wx__SocketBase_Write); /* prototype to pass -Wmissing-prototypes */
1135 XS(XS_Wx__SocketBase_Write)
1136 {
1137 #ifdef dVAR
1138     dVAR; dXSARGS;
1139 #else
1140     dXSARGS;
1141 #endif
1142     if (items < 2 || items > 3)
1143        croak_xs_usage(cv,  "THIS, buf, size = 0");
1144     {
1145         SV*     buf = ST(1);
1146         long    size;
1147         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1148         long    RETVAL;
1149         dXSTARG;
1150
1151         if (items < 3)
1152             size = 0;
1153         else {
1154             size = (long)SvIV(ST(2));
1155         }
1156     if ( size == 0 ) { size = SvCUR(buf) ;}
1157     THIS->Write( SvPV_nolen(buf) , size ) ;
1158     RETVAL = THIS->LastCount() ;
1159         XSprePUSH; PUSHi((IV)RETVAL);
1160     }
1161     XSRETURN(1);
1162 }
1163
1164
1165 XS(XS_Wx__SocketBase_WriteMsg); /* prototype to pass -Wmissing-prototypes */
1166 XS(XS_Wx__SocketBase_WriteMsg)
1167 {
1168 #ifdef dVAR
1169     dVAR; dXSARGS;
1170 #else
1171     dXSARGS;
1172 #endif
1173     if (items < 2 || items > 3)
1174        croak_xs_usage(cv,  "THIS, buf, size = 0");
1175     {
1176         SV*     buf = ST(1);
1177         long    size;
1178         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1179         long    RETVAL;
1180         dXSTARG;
1181
1182         if (items < 3)
1183             size = 0;
1184         else {
1185             size = (long)SvIV(ST(2));
1186         }
1187     if ( size == 0 ) { size = SvCUR(buf) ;}
1188     THIS->WriteMsg( SvPV_nolen(buf) , size ) ;
1189     RETVAL = THIS->LastCount() ;
1190         XSprePUSH; PUSHi((IV)RETVAL);
1191     }
1192     XSRETURN(1);
1193 }
1194
1195
1196 XS(XS_Wx__SocketBase_SetEventHandler); /* prototype to pass -Wmissing-prototypes */
1197 XS(XS_Wx__SocketBase_SetEventHandler)
1198 {
1199 #ifdef dVAR
1200     dVAR; dXSARGS;
1201 #else
1202     dXSARGS;
1203 #endif
1204     if (items < 2 || items > 3)
1205        croak_xs_usage(cv,  "THIS, evthnd, id = wxID_ANY");
1206     {
1207         wxEvtHandler*    evthnd = (wxEvtHandler *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::EvtHandler" );
1208         int     id;
1209         wxSocketBase *    THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1210
1211         if (items < 3)
1212             id = wxID_ANY;
1213         else {
1214             id = (int)SvIV(ST(2));
1215         }
1216     THIS->SetEventHandler( *evthnd , id );
1217     }
1218     XSRETURN_EMPTY;
1219 }
1220
1221
1222 /* INCLUDE: Returning to 'Socket.xs' from 'XS/SocketBase.xs' */
1223
1224
1225 /* INCLUDE:  Including 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/SockAddress.xsp |' from 'Socket.xs' */
1226
1227
1228 XS(XS_Wx__SockAddress_CLONE); /* prototype to pass -Wmissing-prototypes */
1229 XS(XS_Wx__SockAddress_CLONE)
1230 {
1231 #ifdef dVAR
1232     dVAR; dXSARGS;
1233 #else
1234     dXSARGS;
1235 #endif
1236     if (items != 1)
1237        croak_xs_usage(cv,  "CLASS");
1238     {
1239         char *  CLASS = (char *)SvPV_nolen(ST(0));
1240     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
1241     }
1242     XSRETURN_EMPTY;
1243 }
1244
1245
1246 XS(XS_Wx__SockAddress_DESTROY); /* prototype to pass -Wmissing-prototypes */
1247 XS(XS_Wx__SockAddress_DESTROY)
1248 {
1249 #ifdef dVAR
1250     dVAR; dXSARGS;
1251 #else
1252     dXSARGS;
1253 #endif
1254     if (items != 1)
1255        croak_xs_usage(cv,  "THIS");
1256     {
1257         wxSockAddress *    THIS = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SockAddress" );
1258      wxPli_thread_sv_unregister( aTHX_ wxPli_get_class( aTHX_ ST(0) ), THIS, ST(0) );
1259                 delete THIS;
1260     }
1261     XSRETURN_EMPTY;
1262 }
1263
1264
1265 XS(XS_Wx__SockAddress_Clear); /* prototype to pass -Wmissing-prototypes */
1266 XS(XS_Wx__SockAddress_Clear)
1267 {
1268 #ifdef dVAR
1269     dVAR; dXSARGS;
1270 #else
1271     dXSARGS;
1272 #endif
1273     if (items != 1)
1274        croak_xs_usage(cv,  "THIS");
1275     {
1276         wxSockAddress *    THIS = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SockAddress" );
1277
1278         THIS->Clear();
1279     }
1280     XSRETURN_EMPTY;
1281 }
1282
1283
1284 XS(XS_Wx__SockAddress_Type); /* prototype to pass -Wmissing-prototypes */
1285 XS(XS_Wx__SockAddress_Type)
1286 {
1287 #ifdef dVAR
1288     dVAR; dXSARGS;
1289 #else
1290     dXSARGS;
1291 #endif
1292     if (items != 1)
1293        croak_xs_usage(cv,  "THIS");
1294     {
1295         wxSockAddress *    THIS = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SockAddress" );
1296         int     RETVAL;
1297         dXSTARG;
1298
1299         RETVAL = THIS->Type();
1300         XSprePUSH; PUSHi((IV)RETVAL);
1301     }
1302     XSRETURN(1);
1303 }
1304
1305 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
1306 #define XSubPPtmpAAAB 1
1307
1308
1309 XS(XS_Wx__IPaddress_SetHostname); /* prototype to pass -Wmissing-prototypes */
1310 XS(XS_Wx__IPaddress_SetHostname)
1311 {
1312 #ifdef dVAR
1313     dVAR; dXSARGS;
1314 #else
1315     dXSARGS;
1316 #endif
1317     if (items != 2)
1318        croak_xs_usage(cv,  "THIS, name");
1319     {
1320         wxString        name;
1321         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1322         bool    RETVAL;
1323
1324     WXSTRING_INPUT( name, wxString, ST(1) );
1325     RETVAL = THIS->Hostname( name );
1326         ST(0) = boolSV(RETVAL);
1327         sv_2mortal(ST(0));
1328     }
1329     XSRETURN(1);
1330 }
1331
1332
1333 XS(XS_Wx__IPaddress_SetService); /* prototype to pass -Wmissing-prototypes */
1334 XS(XS_Wx__IPaddress_SetService)
1335 {
1336 #ifdef dVAR
1337     dVAR; dXSARGS;
1338 #else
1339     dXSARGS;
1340 #endif
1341     if (items != 2)
1342        croak_xs_usage(cv,  "THIS, port");
1343     {
1344         wxString        port;
1345         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1346         bool    RETVAL;
1347
1348     WXSTRING_INPUT( port, wxString, ST(1) );
1349     RETVAL = THIS->Service( port );
1350         ST(0) = boolSV(RETVAL);
1351         sv_2mortal(ST(0));
1352     }
1353     XSRETURN(1);
1354 }
1355
1356
1357 XS(XS_Wx__IPaddress_IsLocalHost); /* prototype to pass -Wmissing-prototypes */
1358 XS(XS_Wx__IPaddress_IsLocalHost)
1359 {
1360 #ifdef dVAR
1361     dVAR; dXSARGS;
1362 #else
1363     dXSARGS;
1364 #endif
1365     if (items != 1)
1366        croak_xs_usage(cv,  "THIS");
1367     {
1368         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1369         bool    RETVAL;
1370
1371         RETVAL = THIS->IsLocalHost();
1372         ST(0) = boolSV(RETVAL);
1373         sv_2mortal(ST(0));
1374     }
1375     XSRETURN(1);
1376 }
1377
1378
1379 XS(XS_Wx__IPaddress_SetAnyAddress); /* prototype to pass -Wmissing-prototypes */
1380 XS(XS_Wx__IPaddress_SetAnyAddress)
1381 {
1382 #ifdef dVAR
1383     dVAR; dXSARGS;
1384 #else
1385     dXSARGS;
1386 #endif
1387     if (items != 1)
1388        croak_xs_usage(cv,  "THIS");
1389     {
1390         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1391         bool    RETVAL;
1392     RETVAL = THIS->AnyAddress();
1393         ST(0) = boolSV(RETVAL);
1394         sv_2mortal(ST(0));
1395     }
1396     XSRETURN(1);
1397 }
1398
1399
1400 XS(XS_Wx__IPaddress_GetIPAddress); /* prototype to pass -Wmissing-prototypes */
1401 XS(XS_Wx__IPaddress_GetIPAddress)
1402 {
1403 #ifdef dVAR
1404     dVAR; dXSARGS;
1405 #else
1406     dXSARGS;
1407 #endif
1408     if (items != 1)
1409        croak_xs_usage(cv,  "THIS");
1410     {
1411         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1412         wxString        RETVAL;
1413     RETVAL = THIS->IPAddress();
1414         ST(0) = sv_newmortal();
1415     WXSTRING_OUTPUT( RETVAL, ST(0) );
1416
1417     }
1418     XSRETURN(1);
1419 }
1420
1421
1422 XS(XS_Wx__IPaddress_GetHostname); /* prototype to pass -Wmissing-prototypes */
1423 XS(XS_Wx__IPaddress_GetHostname)
1424 {
1425 #ifdef dVAR
1426     dVAR; dXSARGS;
1427 #else
1428     dXSARGS;
1429 #endif
1430     if (items != 1)
1431        croak_xs_usage(cv,  "THIS");
1432     {
1433         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1434         wxString        RETVAL;
1435     RETVAL = THIS->Hostname();
1436         ST(0) = sv_newmortal();
1437     WXSTRING_OUTPUT( RETVAL, ST(0) );
1438
1439     }
1440     XSRETURN(1);
1441 }
1442
1443
1444 XS(XS_Wx__IPaddress_GetService); /* prototype to pass -Wmissing-prototypes */
1445 XS(XS_Wx__IPaddress_GetService)
1446 {
1447 #ifdef dVAR
1448     dVAR; dXSARGS;
1449 #else
1450     dXSARGS;
1451 #endif
1452     if (items != 1)
1453        croak_xs_usage(cv,  "THIS");
1454     {
1455         wxIPaddress *    THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1456         unsigned short  RETVAL;
1457         dXSTARG;
1458     RETVAL = THIS->Service();
1459         XSprePUSH; PUSHu((UV)RETVAL );
1460     }
1461     XSRETURN(1);
1462 }
1463
1464 #endif
1465
1466 XS(XS_Wx__IPV4address_new); /* prototype to pass -Wmissing-prototypes */
1467 XS(XS_Wx__IPV4address_new)
1468 {
1469 #ifdef dVAR
1470     dVAR; dXSARGS;
1471 #else
1472     dXSARGS;
1473 #endif
1474     if (items != 1)
1475        croak_xs_usage(cv,  "CLASS");
1476     {
1477         char *  CLASS = (char *)SvPV_nolen(ST(0));
1478         wxIPV4address * RETVAL;
1479
1480         RETVAL = new wxIPV4address();
1481         ST(0) = sv_newmortal();
1482     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
1483     wxPli_thread_sv_register( aTHX_ "Wx::IPV4address", RETVAL, ST(0) );
1484
1485     }
1486     XSRETURN(1);
1487 }
1488
1489
1490 XS(XS_Wx__IPV4address_GetOrigHostname); /* prototype to pass -Wmissing-prototypes */
1491 XS(XS_Wx__IPV4address_GetOrigHostname)
1492 {
1493 #ifdef dVAR
1494     dVAR; dXSARGS;
1495 #else
1496     dXSARGS;
1497 #endif
1498     if (items != 1)
1499        croak_xs_usage(cv,  "THIS");
1500     {
1501         wxIPV4address *    THIS = (wxIPV4address *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPV4address" );
1502         wxString        RETVAL;
1503     RETVAL = THIS->OrigHostname();
1504         ST(0) = sv_newmortal();
1505     WXSTRING_OUTPUT( RETVAL, ST(0) );
1506
1507     }
1508     XSRETURN(1);
1509 }
1510
1511 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
1512 #define XSubPPtmpAAAC 1
1513
1514
1515 XS(XS_Wx__IPV4address_SetBroadcastAddress); /* prototype to pass -Wmissing-prototypes */
1516 XS(XS_Wx__IPV4address_SetBroadcastAddress)
1517 {
1518 #ifdef dVAR
1519     dVAR; dXSARGS;
1520 #else
1521     dXSARGS;
1522 #endif
1523     if (items != 1)
1524        croak_xs_usage(cv,  "THIS");
1525     {
1526         wxIPV4address *    THIS = (wxIPV4address *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPV4address" );
1527         bool    RETVAL;
1528     RETVAL = THIS->BroadcastAddress();
1529         ST(0) = boolSV(RETVAL);
1530         sv_2mortal(ST(0));
1531     }
1532     XSRETURN(1);
1533 }
1534
1535 #endif
1536 #if wxUSE_IPV6
1537 #define XSubPPtmpAAAD 1
1538
1539
1540 XS(XS_Wx__IPV6address_new); /* prototype to pass -Wmissing-prototypes */
1541 XS(XS_Wx__IPV6address_new)
1542 {
1543 #ifdef dVAR
1544     dVAR; dXSARGS;
1545 #else
1546     dXSARGS;
1547 #endif
1548     if (items != 1)
1549        croak_xs_usage(cv,  "CLASS");
1550     {
1551         char *  CLASS = (char *)SvPV_nolen(ST(0));
1552         wxIPV6address * RETVAL;
1553
1554         RETVAL = new wxIPV6address();
1555         ST(0) = sv_newmortal();
1556     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
1557     wxPli_thread_sv_register( aTHX_ "Wx::IPV6address", RETVAL, ST(0) );
1558
1559     }
1560     XSRETURN(1);
1561 }
1562
1563 #endif
1564 #ifdef __UNIX__
1565 #define XSubPPtmpAAAE 1
1566
1567
1568 XS(XS_Wx__UNIXaddress_new); /* prototype to pass -Wmissing-prototypes */
1569 XS(XS_Wx__UNIXaddress_new)
1570 {
1571 #ifdef dVAR
1572     dVAR; dXSARGS;
1573 #else
1574     dXSARGS;
1575 #endif
1576     if (items != 1)
1577        croak_xs_usage(cv,  "CLASS");
1578     {
1579         char *  CLASS = (char *)SvPV_nolen(ST(0));
1580         wxUNIXaddress * RETVAL;
1581
1582         RETVAL = new wxUNIXaddress();
1583         ST(0) = sv_newmortal();
1584     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
1585     wxPli_thread_sv_register( aTHX_ "Wx::UNIXaddress", RETVAL, ST(0) );
1586
1587     }
1588     XSRETURN(1);
1589 }
1590
1591
1592 XS(XS_Wx__UNIXaddress_GetFilename); /* prototype to pass -Wmissing-prototypes */
1593 XS(XS_Wx__UNIXaddress_GetFilename)
1594 {
1595 #ifdef dVAR
1596     dVAR; dXSARGS;
1597 #else
1598     dXSARGS;
1599 #endif
1600     if (items != 1)
1601        croak_xs_usage(cv,  "THIS");
1602     {
1603         wxUNIXaddress *    THIS = (wxUNIXaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::UNIXaddress" );
1604         wxString        RETVAL;
1605     RETVAL = THIS->Filename();
1606         ST(0) = sv_newmortal();
1607     WXSTRING_OUTPUT( RETVAL, ST(0) );
1608
1609     }
1610     XSRETURN(1);
1611 }
1612
1613
1614 XS(XS_Wx__UNIXaddress_SetFilename); /* prototype to pass -Wmissing-prototypes */
1615 XS(XS_Wx__UNIXaddress_SetFilename)
1616 {
1617 #ifdef dVAR
1618     dVAR; dXSARGS;
1619 #else
1620     dXSARGS;
1621 #endif
1622     if (items != 2)
1623        croak_xs_usage(cv,  "THIS, filename");
1624     {
1625         wxString        filename;
1626         wxUNIXaddress *    THIS = (wxUNIXaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::UNIXaddress" );
1627
1628     WXSTRING_INPUT( filename, wxString, ST(1) );
1629     THIS->Filename( filename );
1630     }
1631     XSRETURN_EMPTY;
1632 }
1633
1634 #endif
1635
1636 /* INCLUDE: Returning to 'Socket.xs' from 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/SockAddress.xsp |' */
1637
1638
1639 /* INCLUDE:  Including 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/DatagramSocket.xsp |' from 'Socket.xs' */
1640
1641
1642 XS(XS_Wx__DatagramSocket_new); /* prototype to pass -Wmissing-prototypes */
1643 XS(XS_Wx__DatagramSocket_new)
1644 {
1645 #ifdef dVAR
1646     dVAR; dXSARGS;
1647 #else
1648     dXSARGS;
1649 #endif
1650     if (items < 2 || items > 3)
1651        croak_xs_usage(cv,  "CLASS, addr, flags = wxSOCKET_NONE");
1652     {
1653         wxSockAddress*    addr = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SockAddress" );
1654         wxSocketFlags   flags;
1655         char *  CLASS = (char *)SvPV_nolen(ST(0));
1656         wxDatagramSocket *      RETVAL;
1657
1658         if (items < 3)
1659             flags = wxSOCKET_NONE;
1660         else {
1661             flags = (wxSocketFlags)SvIV(ST(2));
1662         }
1663      RETVAL = new wxPliDatagramSocket( CLASS , *addr, flags ); 
1664         ST(0) = sv_newmortal();
1665     wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
1666
1667     }
1668     XSRETURN(1);
1669 }
1670
1671
1672 XS(XS_Wx__DatagramSocket_RecvFrom); /* prototype to pass -Wmissing-prototypes */
1673 XS(XS_Wx__DatagramSocket_RecvFrom)
1674 {
1675 #ifdef dVAR
1676     dVAR; dXSARGS;
1677 #else
1678     dXSARGS;
1679 #endif
1680     if (items != 4)
1681        croak_xs_usage(cv,  "THIS, addr, buf, nBytes");
1682     {
1683         wxSockAddress*    addr = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SockAddress" );
1684         SV*     buf = ST(2);
1685         wxUint32        nBytes = (wxUint32)SvIV(ST(3));
1686         wxDatagramSocket *    THIS = (wxDatagramSocket *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::DatagramSocket" );
1687         size_t  RETVAL;
1688         dXSTARG;
1689     DO_READ( THIS->RecvFrom( *addr, buffer, nBytes ), buf, nBytes, 0 );
1690         XSprePUSH; PUSHu((UV)RETVAL );
1691     }
1692     XSRETURN(1);
1693 }
1694
1695
1696 XS(XS_Wx__DatagramSocket_SendTo); /* prototype to pass -Wmissing-prototypes */
1697 XS(XS_Wx__DatagramSocket_SendTo)
1698 {
1699 #ifdef dVAR
1700     dVAR; dXSARGS;
1701 #else
1702     dXSARGS;
1703 #endif
1704     if (items != 4)
1705        croak_xs_usage(cv,  "THIS, addr, buf, nBytes");
1706     {
1707         wxSockAddress*    addr = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SockAddress" );
1708         SV*     buf = ST(2);
1709         wxUint32        nBytes = (wxUint32)SvIV(ST(3));
1710         wxDatagramSocket *    THIS = (wxDatagramSocket *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::DatagramSocket" );
1711         size_t  RETVAL;
1712         dXSTARG;
1713     DO_WRITE( THIS->SendTo( *addr, buffer, nBytes ), buf, nBytes );
1714         XSprePUSH; PUSHu((UV)RETVAL );
1715     }
1716     XSRETURN(1);
1717 }
1718
1719
1720 /* INCLUDE: Returning to 'Socket.xs' from 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/DatagramSocket.xsp |' */
1721
1722 #if defined(__WXMSW__)
1723 #undef XS
1724 #define XS( name ) WXXS( name )
1725 #endif
1726 #ifdef __cplusplus
1727 extern "C"
1728 #endif
1729 XS(boot_Wx__Socket); /* prototype to pass -Wmissing-prototypes */
1730 XS(boot_Wx__Socket)
1731 {
1732 #ifdef dVAR
1733     dVAR; dXSARGS;
1734 #else
1735     dXSARGS;
1736 #endif
1737 #if (PERL_REVISION == 5 && PERL_VERSION < 9)
1738     char* file = __FILE__;
1739 #else
1740     const char* file = __FILE__;
1741 #endif
1742
1743     PERL_UNUSED_VAR(cv); /* -W */
1744     PERL_UNUSED_VAR(items); /* -W */
1745     XS_VERSION_BOOTCHECK ;
1746
1747         newXS("Wx::SocketEvent::new", XS_Wx__SocketEvent_new, file);
1748         newXS("Wx::SocketEvent::GetSocket", XS_Wx__SocketEvent_GetSocket, file);
1749         newXS("Wx::SocketEvent::GetSocketEvent", XS_Wx__SocketEvent_GetSocketEvent, file);
1750         newXS("Wx::SocketServer::new", XS_Wx__SocketServer_new, file);
1751         newXS("Wx::SocketServer::Accept", XS_Wx__SocketServer_Accept, file);
1752         newXS("Wx::SocketServer::AcceptWith", XS_Wx__SocketServer_AcceptWith, file);
1753         newXS("Wx::SocketServer::WaitForAccept", XS_Wx__SocketServer_WaitForAccept, file);
1754         newXS("Wx::SocketClient::new", XS_Wx__SocketClient_new, file);
1755         newXS("Wx::SocketClient::Connect", XS_Wx__SocketClient_Connect, file);
1756 #if XSubPPtmpAAAA
1757         newXS("Wx::SocketBase::new", XS_Wx__SocketBase_new, file);
1758 #endif
1759         newXS("Wx::SocketBase::Destroy", XS_Wx__SocketBase_Destroy, file);
1760         newXS("Wx::SocketBase::Ok", XS_Wx__SocketBase_Ok, file);
1761         newXS("Wx::SocketBase::IsConnected", XS_Wx__SocketBase_IsConnected, file);
1762         newXS("Wx::SocketBase::IsDisconnected", XS_Wx__SocketBase_IsDisconnected, file);
1763         newXS("Wx::SocketBase::IsData", XS_Wx__SocketBase_IsData, file);
1764         newXS("Wx::SocketBase::LastCount", XS_Wx__SocketBase_LastCount, file);
1765         newXS("Wx::SocketBase::Notify", XS_Wx__SocketBase_Notify, file);
1766         newXS("Wx::SocketBase::SetTimeout", XS_Wx__SocketBase_SetTimeout, file);
1767         newXS("Wx::SocketBase::Wait", XS_Wx__SocketBase_Wait, file);
1768         newXS("Wx::SocketBase::WaitForRead", XS_Wx__SocketBase_WaitForRead, file);
1769         newXS("Wx::SocketBase::WaitForWrite", XS_Wx__SocketBase_WaitForWrite, file);
1770         newXS("Wx::SocketBase::Read", XS_Wx__SocketBase_Read, file);
1771         newXS("Wx::SocketBase::Close", XS_Wx__SocketBase_Close, file);
1772         newXS("Wx::SocketBase::Discard", XS_Wx__SocketBase_Discard, file);
1773         newXS("Wx::SocketBase::Error", XS_Wx__SocketBase_Error, file);
1774         newXS("Wx::SocketBase::GetFlags", XS_Wx__SocketBase_GetFlags, file);
1775         newXS("Wx::SocketBase::GetLocal", XS_Wx__SocketBase_GetLocal, file);
1776         newXS("Wx::SocketBase::GetPeer", XS_Wx__SocketBase_GetPeer, file);
1777         newXS("Wx::SocketBase::InterruptWait", XS_Wx__SocketBase_InterruptWait, file);
1778         newXS("Wx::SocketBase::LastError", XS_Wx__SocketBase_LastError, file);
1779         newXS("Wx::SocketBase::Peek", XS_Wx__SocketBase_Peek, file);
1780         newXS("Wx::SocketBase::ReadMsg", XS_Wx__SocketBase_ReadMsg, file);
1781         newXS("Wx::SocketBase::RestoreState", XS_Wx__SocketBase_RestoreState, file);
1782         newXS("Wx::SocketBase::SaveState", XS_Wx__SocketBase_SaveState, file);
1783         newXS("Wx::SocketBase::SetFlags", XS_Wx__SocketBase_SetFlags, file);
1784         newXS("Wx::SocketBase::SetNotify", XS_Wx__SocketBase_SetNotify, file);
1785         newXS("Wx::SocketBase::Unread", XS_Wx__SocketBase_Unread, file);
1786         newXS("Wx::SocketBase::WaitForLost", XS_Wx__SocketBase_WaitForLost, file);
1787         newXS("Wx::SocketBase::Write", XS_Wx__SocketBase_Write, file);
1788         newXS("Wx::SocketBase::WriteMsg", XS_Wx__SocketBase_WriteMsg, file);
1789         newXS("Wx::SocketBase::SetEventHandler", XS_Wx__SocketBase_SetEventHandler, file);
1790         newXS("Wx::SockAddress::CLONE", XS_Wx__SockAddress_CLONE, file);
1791         newXS("Wx::SockAddress::DESTROY", XS_Wx__SockAddress_DESTROY, file);
1792         newXS("Wx::SockAddress::Clear", XS_Wx__SockAddress_Clear, file);
1793         newXS("Wx::SockAddress::Type", XS_Wx__SockAddress_Type, file);
1794 #if XSubPPtmpAAAB
1795         newXS("Wx::IPaddress::SetHostname", XS_Wx__IPaddress_SetHostname, file);
1796         newXS("Wx::IPaddress::SetService", XS_Wx__IPaddress_SetService, file);
1797         newXS("Wx::IPaddress::IsLocalHost", XS_Wx__IPaddress_IsLocalHost, file);
1798         newXS("Wx::IPaddress::SetAnyAddress", XS_Wx__IPaddress_SetAnyAddress, file);
1799         newXS("Wx::IPaddress::GetIPAddress", XS_Wx__IPaddress_GetIPAddress, file);
1800         newXS("Wx::IPaddress::GetHostname", XS_Wx__IPaddress_GetHostname, file);
1801         newXS("Wx::IPaddress::GetService", XS_Wx__IPaddress_GetService, file);
1802 #endif
1803         newXS("Wx::IPV4address::new", XS_Wx__IPV4address_new, file);
1804         newXS("Wx::IPV4address::GetOrigHostname", XS_Wx__IPV4address_GetOrigHostname, file);
1805 #if XSubPPtmpAAAC
1806         newXS("Wx::IPV4address::SetBroadcastAddress", XS_Wx__IPV4address_SetBroadcastAddress, file);
1807 #endif
1808 #if XSubPPtmpAAAD
1809         newXS("Wx::IPV6address::new", XS_Wx__IPV6address_new, file);
1810 #endif
1811 #if XSubPPtmpAAAE
1812         newXS("Wx::UNIXaddress::new", XS_Wx__UNIXaddress_new, file);
1813         newXS("Wx::UNIXaddress::GetFilename", XS_Wx__UNIXaddress_GetFilename, file);
1814         newXS("Wx::UNIXaddress::SetFilename", XS_Wx__UNIXaddress_SetFilename, file);
1815 #endif
1816         newXS("Wx::DatagramSocket::new", XS_Wx__DatagramSocket_new, file);
1817         newXS("Wx::DatagramSocket::RecvFrom", XS_Wx__DatagramSocket_RecvFrom, file);
1818         newXS("Wx::DatagramSocket::SendTo", XS_Wx__DatagramSocket_SendTo, file);
1819
1820     /* Initialisation Section */
1821
1822   INIT_PLI_HELPERS( wx_pli_helpers );
1823
1824 #if XSubPPtmpAAAA
1825 #endif
1826 #if XSubPPtmpAAAB
1827 #endif
1828 #if XSubPPtmpAAAC
1829 #endif
1830 #if XSubPPtmpAAAD
1831 #endif
1832 #if XSubPPtmpAAAE
1833 #endif
1834
1835     /* End of Initialisation Section */
1836
1837 #if (PERL_REVISION == 5 && PERL_VERSION >= 9)
1838   if (PL_unitcheckav)
1839        call_list(PL_scopestack_ix, PL_unitcheckav);
1840 #endif
1841     XSRETURN_YES;
1842 }
1843