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.
5 * ANY CHANGES MADE HERE WILL BE LOST!
9 /////////////////////////////////////////////////////////////////////////////
10 // Name: ext/socket/Socket.xs
11 // Purpose: XS for Wx::Socket
12 // Author: Graciliano M. P.
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 /////////////////////////////////////////////////////////////////////////////
21 #define PERL_NO_GET_CONTEXT
23 #include "cpp/wxapi.h"
24 #include "wx/socket.h"
28 #include "cpp/sk_constants.cpp"
29 #include "cpp/socket.h"
31 #ifndef PERL_UNUSED_VAR
32 # define PERL_UNUSED_VAR(var) if (0) var = var
35 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
36 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
38 /* prototype to pass -Wmissing-prototypes */
40 S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
43 S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
45 const GV *const gv = CvGV(cv);
47 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
50 const char *const gvname = GvNAME(gv);
51 const HV *const stash = GvSTASH(gv);
52 const char *const hvname = stash ? HvNAME(stash) : NULL;
55 Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
57 Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
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);
63 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
65 #ifdef PERL_IMPLICIT_CONTEXT
66 #define croak_xs_usage(a,b) S_croak_xs_usage(aTHX_ a,b)
68 #define croak_xs_usage S_croak_xs_usage
73 /* NOTE: the prototype of newXSproto() is different in versions of perls,
74 * so we define a portable version of newXSproto()
77 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
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) */
83 /* INCLUDE: Including 'XS/SocketBase.xs' from 'Socket.xs' */
86 /* INCLUDE: Including 'XS/SocketClient.xs' from 'XS/SocketBase.xs' */
89 /* INCLUDE: Including 'XS/SocketServer.xs' from 'XS/SocketClient.xs' */
92 /* INCLUDE: Including 'XS/SocketEvent.xs' from 'XS/SocketServer.xs' */
95 XS(XS_Wx__SocketEvent_new); /* prototype to pass -Wmissing-prototypes */
96 XS(XS_Wx__SocketEvent_new)
103 if (items < 1 || items > 2)
104 croak_xs_usage(cv, "CLASS, id = 0");
107 char * CLASS = (char *)SvPV_nolen(ST(0));
108 wxSocketEvent * RETVAL;
113 id = (int)SvIV(ST(1));
115 RETVAL = new wxSocketEvent( id ) ;
116 ST(0) = sv_newmortal();
117 wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
124 XS(XS_Wx__SocketEvent_GetSocket); /* prototype to pass -Wmissing-prototypes */
125 XS(XS_Wx__SocketEvent_GetSocket)
133 croak_xs_usage(cv, "THIS");
135 wxSocketEvent * THIS = (wxSocketEvent *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketEvent" );
136 wxSocketBase * RETVAL;
138 RETVAL = THIS->GetSocket();
139 ST(0) = sv_newmortal();
140 wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
147 XS(XS_Wx__SocketEvent_GetSocketEvent); /* prototype to pass -Wmissing-prototypes */
148 XS(XS_Wx__SocketEvent_GetSocketEvent)
156 croak_xs_usage(cv, "THIS");
158 wxSocketEvent * THIS = (wxSocketEvent *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketEvent" );
162 RETVAL = THIS->GetSocketEvent();
163 XSprePUSH; PUSHi((IV)RETVAL);
169 /* INCLUDE: Returning to 'XS/SocketServer.xs' from 'XS/SocketEvent.xs' */
172 XS(XS_Wx__SocketServer_new); /* prototype to pass -Wmissing-prototypes */
173 XS(XS_Wx__SocketServer_new)
180 if (items < 3 || items > 4)
181 croak_xs_usage(cv, "CLASS, host, port, style = 0");
186 char * CLASS = (char *)SvPV_nolen(ST(0));
187 wxSocketServer * RETVAL;
189 WXSTRING_INPUT( host, wxString, ST(1) );
191 WXSTRING_INPUT( port, wxString, ST(2) );
196 style = (long)SvIV(ST(3));
199 addr.Hostname(host) ;
201 RETVAL = new wxPlSocketServer( CLASS , addr , style ) ;
202 ST(0) = sv_newmortal();
203 wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
210 XS(XS_Wx__SocketServer_Accept); /* prototype to pass -Wmissing-prototypes */
211 XS(XS_Wx__SocketServer_Accept)
218 if (items < 1 || items > 2)
219 croak_xs_usage(cv, "THIS, wait = true");
222 wxSocketServer * THIS = (wxSocketServer *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketServer" );
223 wxSocketBase * RETVAL;
228 wait = (bool)SvTRUE(ST(1));
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 );
240 XS(XS_Wx__SocketServer_AcceptWith); /* prototype to pass -Wmissing-prototypes */
241 XS(XS_Wx__SocketServer_AcceptWith)
248 if (items < 2 || items > 3)
249 croak_xs_usage(cv, "THIS, socket, wait = true");
251 wxSocketBase* socket = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SocketBase" );
253 wxSocketServer * THIS = (wxSocketServer *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketServer" );
259 wait = (bool)SvTRUE(ST(2));
261 RETVAL = THIS->AcceptWith( *socket , wait );
262 ST(0) = boolSV(RETVAL);
269 XS(XS_Wx__SocketServer_WaitForAccept); /* prototype to pass -Wmissing-prototypes */
270 XS(XS_Wx__SocketServer_WaitForAccept)
277 if (items < 1 || items > 3)
278 croak_xs_usage(cv, "THIS, seconds = -1, millisecond = 0");
282 wxSocketServer * THIS = (wxSocketServer *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketServer" );
288 seconds = (long)SvIV(ST(1));
294 millisecond = (long)SvIV(ST(2));
297 RETVAL = THIS->WaitForAccept(seconds, millisecond);
298 ST(0) = boolSV(RETVAL);
305 /* INCLUDE: Returning to 'XS/SocketClient.xs' from 'XS/SocketServer.xs' */
308 XS(XS_Wx__SocketClient_new); /* prototype to pass -Wmissing-prototypes */
309 XS(XS_Wx__SocketClient_new)
316 if (items < 1 || items > 2)
317 croak_xs_usage(cv, "CLASS, style = 0");
320 char * CLASS = (char *)SvPV_nolen(ST(0));
321 wxSocketClient * RETVAL;
326 style = (long)SvIV(ST(1));
328 RETVAL = new wxPliSocketClient( CLASS , style ) ;
329 ST(0) = sv_newmortal();
330 wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
337 XS(XS_Wx__SocketClient_Connect); /* prototype to pass -Wmissing-prototypes */
338 XS(XS_Wx__SocketClient_Connect)
345 if (items < 3 || items > 4)
346 croak_xs_usage(cv, "THIS, host, port, wait = 1");
351 wxSocketClient * THIS = (wxSocketClient *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketClient" );
354 WXSTRING_INPUT( host, wxString, ST(1) );
356 WXSTRING_INPUT( port, wxString, ST(2) );
361 wait = (bool)SvTRUE(ST(3));
364 addr.Hostname(host) ;
366 RETVAL = THIS->Connect( addr , wait ) ;
367 ST(0) = boolSV(RETVAL);
374 /* INCLUDE: Returning to 'XS/SocketBase.xs' from 'XS/SocketClient.xs' */
377 #define XSubPPtmpAAAA 1
380 XS(XS_Wx__SocketBase_new); /* prototype to pass -Wmissing-prototypes */
381 XS(XS_Wx__SocketBase_new)
389 croak_xs_usage(cv, "CLASS");
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 );
403 XS(XS_Wx__SocketBase_Destroy); /* prototype to pass -Wmissing-prototypes */
404 XS(XS_Wx__SocketBase_Destroy)
412 croak_xs_usage(cv, "THIS");
414 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
422 XS(XS_Wx__SocketBase_Ok); /* prototype to pass -Wmissing-prototypes */
423 XS(XS_Wx__SocketBase_Ok)
431 croak_xs_usage(cv, "THIS");
433 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
437 ST(0) = boolSV(RETVAL);
444 XS(XS_Wx__SocketBase_IsConnected); /* prototype to pass -Wmissing-prototypes */
445 XS(XS_Wx__SocketBase_IsConnected)
453 croak_xs_usage(cv, "THIS");
455 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
458 RETVAL = THIS->IsConnected();
459 ST(0) = boolSV(RETVAL);
466 XS(XS_Wx__SocketBase_IsDisconnected); /* prototype to pass -Wmissing-prototypes */
467 XS(XS_Wx__SocketBase_IsDisconnected)
475 croak_xs_usage(cv, "THIS");
477 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
480 RETVAL = THIS->IsDisconnected();
481 ST(0) = boolSV(RETVAL);
488 XS(XS_Wx__SocketBase_IsData); /* prototype to pass -Wmissing-prototypes */
489 XS(XS_Wx__SocketBase_IsData)
497 croak_xs_usage(cv, "THIS");
499 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
502 RETVAL = THIS->IsData();
503 ST(0) = boolSV(RETVAL);
510 XS(XS_Wx__SocketBase_LastCount); /* prototype to pass -Wmissing-prototypes */
511 XS(XS_Wx__SocketBase_LastCount)
519 croak_xs_usage(cv, "THIS");
521 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
525 RETVAL = THIS->LastCount();
526 XSprePUSH; PUSHi((IV)RETVAL);
532 XS(XS_Wx__SocketBase_Notify); /* prototype to pass -Wmissing-prototypes */
533 XS(XS_Wx__SocketBase_Notify)
541 croak_xs_usage(cv, "THIS, notify");
543 bool notify = (bool)SvTRUE(ST(1));
544 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
546 THIS->Notify(notify);
552 XS(XS_Wx__SocketBase_SetTimeout); /* prototype to pass -Wmissing-prototypes */
553 XS(XS_Wx__SocketBase_SetTimeout)
561 croak_xs_usage(cv, "THIS, seconds");
563 int seconds = (int)SvIV(ST(1));
564 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
566 THIS->SetTimeout(seconds);
572 XS(XS_Wx__SocketBase_Wait); /* prototype to pass -Wmissing-prototypes */
573 XS(XS_Wx__SocketBase_Wait)
580 if (items < 1 || items > 3)
581 croak_xs_usage(cv, "THIS, seconds = -1, millisecond = 0");
585 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
591 seconds = (long)SvIV(ST(1));
597 millisecond = (long)SvIV(ST(2));
600 RETVAL = THIS->Wait(seconds, millisecond);
601 ST(0) = boolSV(RETVAL);
608 XS(XS_Wx__SocketBase_WaitForRead); /* prototype to pass -Wmissing-prototypes */
609 XS(XS_Wx__SocketBase_WaitForRead)
616 if (items < 1 || items > 3)
617 croak_xs_usage(cv, "THIS, seconds = -1, millisecond = 0");
621 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
627 seconds = (long)SvIV(ST(1));
633 millisecond = (long)SvIV(ST(2));
636 RETVAL = THIS->WaitForRead(seconds, millisecond);
637 ST(0) = boolSV(RETVAL);
644 XS(XS_Wx__SocketBase_WaitForWrite); /* prototype to pass -Wmissing-prototypes */
645 XS(XS_Wx__SocketBase_WaitForWrite)
652 if (items < 1 || items > 3)
653 croak_xs_usage(cv, "THIS, seconds = -1, millisecond = 0");
657 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
663 seconds = (long)SvIV(ST(1));
669 millisecond = (long)SvIV(ST(2));
672 RETVAL = THIS->WaitForWrite(seconds, millisecond);
673 ST(0) = boolSV(RETVAL);
680 XS(XS_Wx__SocketBase_Read); /* prototype to pass -Wmissing-prototypes */
681 XS(XS_Wx__SocketBase_Read)
688 if (items < 3 || items > 4)
689 croak_xs_usage(cv, "THIS, buf, size, leng = 0");
692 size_t size = (size_t)SvUV( ST(2) );
694 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
701 leng = (size_t)SvUV( ST(3) );
703 // Upgrade the SV to scalar if needed. If the scalar is undef
705 SvUPGRADE(buf , SVt_PV) ;
706 // Tell that the scalar is string only (not integer, double, utf8...):
709 // Grow the scalar to receive the data and return a char* point:
710 char* buffer = SvGROW( buf , leng + size + 2 ) ;
712 // To read at the offset the user specified (works even if offset = 0):
713 if ( leng > 0 ) buffer += leng ;
715 THIS->Read( buffer , size ) ;
716 int nread = THIS->LastCount() ;
718 // Null-terminate the buffer, not necessary, but does not hurt:
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().
726 XSprePUSH; PUSHi((IV)RETVAL);
732 XS(XS_Wx__SocketBase_Close); /* prototype to pass -Wmissing-prototypes */
733 XS(XS_Wx__SocketBase_Close)
741 croak_xs_usage(cv, "THIS");
743 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
751 XS(XS_Wx__SocketBase_Discard); /* prototype to pass -Wmissing-prototypes */
752 XS(XS_Wx__SocketBase_Discard)
760 croak_xs_usage(cv, "THIS");
762 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
770 XS(XS_Wx__SocketBase_Error); /* prototype to pass -Wmissing-prototypes */
771 XS(XS_Wx__SocketBase_Error)
779 croak_xs_usage(cv, "THIS");
781 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
784 RETVAL = THIS->Error();
785 ST(0) = boolSV(RETVAL);
792 XS(XS_Wx__SocketBase_GetFlags); /* prototype to pass -Wmissing-prototypes */
793 XS(XS_Wx__SocketBase_GetFlags)
801 croak_xs_usage(cv, "THIS");
803 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
807 RETVAL = THIS->GetFlags();
808 XSprePUSH; PUSHi((IV)RETVAL);
814 XS(XS_Wx__SocketBase_GetLocal); /* prototype to pass -Wmissing-prototypes */
815 XS(XS_Wx__SocketBase_GetLocal)
823 croak_xs_usage(cv, "THIS");
824 PERL_UNUSED_VAR(ax); /* -Wall */
827 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
829 THIS->GetLocal( addr ) ;
830 XPUSHs( sv_2mortal( newSVpv( addr.Hostname().mb_str(), 0 ) ) );
831 XPUSHs( sv_2mortal( newSViv( addr.Service() ) ) );
838 XS(XS_Wx__SocketBase_GetPeer); /* prototype to pass -Wmissing-prototypes */
839 XS(XS_Wx__SocketBase_GetPeer)
847 croak_xs_usage(cv, "THIS");
848 PERL_UNUSED_VAR(ax); /* -Wall */
851 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
853 THIS->GetPeer( addr ) ;
854 XPUSHs( sv_2mortal( newSVpv( addr.Hostname().mb_str(), 0 ) ) );
855 XPUSHs( sv_2mortal( newSViv( addr.Service() ) ) );
862 XS(XS_Wx__SocketBase_InterruptWait); /* prototype to pass -Wmissing-prototypes */
863 XS(XS_Wx__SocketBase_InterruptWait)
871 croak_xs_usage(cv, "THIS");
873 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
875 THIS->InterruptWait();
881 XS(XS_Wx__SocketBase_LastError); /* prototype to pass -Wmissing-prototypes */
882 XS(XS_Wx__SocketBase_LastError)
890 croak_xs_usage(cv, "THIS");
892 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
896 RETVAL = THIS->LastError();
897 XSprePUSH; PUSHi((IV)RETVAL);
903 XS(XS_Wx__SocketBase_Peek); /* prototype to pass -Wmissing-prototypes */
904 XS(XS_Wx__SocketBase_Peek)
911 if (items < 3 || items > 4)
912 croak_xs_usage(cv, "THIS, buf, size, leng = 0");
915 size_t size = (size_t)SvUV( ST(2) );
917 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
924 leng = (size_t)SvUV( ST(3) );
926 SvUPGRADE(buf , SVt_PV) ;
928 char* buffer = SvGROW( buf , leng + size + 2 ) ;
929 if ( leng > 0 ) { buffer += leng ;}
931 THIS->Peek( buffer , size ) ;
932 int nread = THIS->LastCount() ;
935 SvCUR_set( buf , leng + nread ) ;
936 if( THIS->Error() ) XSRETURN_UNDEF ;
938 XSprePUSH; PUSHi((IV)RETVAL);
944 XS(XS_Wx__SocketBase_ReadMsg); /* prototype to pass -Wmissing-prototypes */
945 XS(XS_Wx__SocketBase_ReadMsg)
952 if (items < 3 || items > 4)
953 croak_xs_usage(cv, "THIS, buf, size, leng = 0");
956 size_t size = (size_t)SvUV( ST(2) );
958 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
965 leng = (size_t)SvUV( ST(3) );
967 SvUPGRADE(buf , SVt_PV) ;
969 char* buffer = SvGROW( buf , leng + size + 2 ) ;
970 if ( leng > 0 ) { buffer += leng ;}
972 THIS->ReadMsg( buffer , size ) ;
973 int nread = THIS->LastCount() ;
976 SvCUR_set( buf , leng + nread ) ;
977 if( THIS->Error() ) XSRETURN_UNDEF ;
979 XSprePUSH; PUSHi((IV)RETVAL);
985 XS(XS_Wx__SocketBase_RestoreState); /* prototype to pass -Wmissing-prototypes */
986 XS(XS_Wx__SocketBase_RestoreState)
994 croak_xs_usage(cv, "THIS");
996 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
998 THIS->RestoreState();
1004 XS(XS_Wx__SocketBase_SaveState); /* prototype to pass -Wmissing-prototypes */
1005 XS(XS_Wx__SocketBase_SaveState)
1013 croak_xs_usage(cv, "THIS");
1015 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1023 XS(XS_Wx__SocketBase_SetFlags); /* prototype to pass -Wmissing-prototypes */
1024 XS(XS_Wx__SocketBase_SetFlags)
1032 croak_xs_usage(cv, "THIS, flags");
1034 long flags = (long)SvIV(ST(1));
1035 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1037 THIS->SetFlags(flags);
1043 XS(XS_Wx__SocketBase_SetNotify); /* prototype to pass -Wmissing-prototypes */
1044 XS(XS_Wx__SocketBase_SetNotify)
1052 croak_xs_usage(cv, "THIS, flags");
1054 long flags = (long)SvIV(ST(1));
1055 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1057 THIS->SetNotify(flags);
1063 XS(XS_Wx__SocketBase_Unread); /* prototype to pass -Wmissing-prototypes */
1064 XS(XS_Wx__SocketBase_Unread)
1071 if (items < 2 || items > 3)
1072 croak_xs_usage(cv, "THIS, buf, size = 0");
1076 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1083 size = (long)SvIV(ST(2));
1085 // Upgrade the SV to scalar if needed. If the scalar is undef
1086 // can't use SvGROW.
1087 SvUPGRADE(buf , SVt_PV) ;
1089 if ( size == 0 ) { size = SvCUR(buf) ;}
1090 THIS->Unread( SvPV_nolen(buf) , size ) ;
1091 RETVAL = THIS->LastCount() ;
1092 XSprePUSH; PUSHi((IV)RETVAL);
1098 XS(XS_Wx__SocketBase_WaitForLost); /* prototype to pass -Wmissing-prototypes */
1099 XS(XS_Wx__SocketBase_WaitForLost)
1106 if (items < 1 || items > 3)
1107 croak_xs_usage(cv, "THIS, seconds = -1, millisecond = 0");
1111 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1117 seconds = (long)SvIV(ST(1));
1123 millisecond = (long)SvIV(ST(2));
1126 RETVAL = THIS->WaitForLost(seconds, millisecond);
1127 ST(0) = boolSV(RETVAL);
1134 XS(XS_Wx__SocketBase_Write); /* prototype to pass -Wmissing-prototypes */
1135 XS(XS_Wx__SocketBase_Write)
1142 if (items < 2 || items > 3)
1143 croak_xs_usage(cv, "THIS, buf, size = 0");
1147 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1154 size = (long)SvIV(ST(2));
1156 if ( size == 0 ) { size = SvCUR(buf) ;}
1157 THIS->Write( SvPV_nolen(buf) , size ) ;
1158 RETVAL = THIS->LastCount() ;
1159 XSprePUSH; PUSHi((IV)RETVAL);
1165 XS(XS_Wx__SocketBase_WriteMsg); /* prototype to pass -Wmissing-prototypes */
1166 XS(XS_Wx__SocketBase_WriteMsg)
1173 if (items < 2 || items > 3)
1174 croak_xs_usage(cv, "THIS, buf, size = 0");
1178 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1185 size = (long)SvIV(ST(2));
1187 if ( size == 0 ) { size = SvCUR(buf) ;}
1188 THIS->WriteMsg( SvPV_nolen(buf) , size ) ;
1189 RETVAL = THIS->LastCount() ;
1190 XSprePUSH; PUSHi((IV)RETVAL);
1196 XS(XS_Wx__SocketBase_SetEventHandler); /* prototype to pass -Wmissing-prototypes */
1197 XS(XS_Wx__SocketBase_SetEventHandler)
1204 if (items < 2 || items > 3)
1205 croak_xs_usage(cv, "THIS, evthnd, id = wxID_ANY");
1207 wxEvtHandler* evthnd = (wxEvtHandler *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::EvtHandler" );
1209 wxSocketBase * THIS = (wxSocketBase *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SocketBase" );
1214 id = (int)SvIV(ST(2));
1216 THIS->SetEventHandler( *evthnd , id );
1222 /* INCLUDE: Returning to 'Socket.xs' from 'XS/SocketBase.xs' */
1225 /* INCLUDE: Including 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/SockAddress.xsp |' from 'Socket.xs' */
1228 XS(XS_Wx__SockAddress_CLONE); /* prototype to pass -Wmissing-prototypes */
1229 XS(XS_Wx__SockAddress_CLONE)
1237 croak_xs_usage(cv, "CLASS");
1239 char * CLASS = (char *)SvPV_nolen(ST(0));
1240 wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
1246 XS(XS_Wx__SockAddress_DESTROY); /* prototype to pass -Wmissing-prototypes */
1247 XS(XS_Wx__SockAddress_DESTROY)
1255 croak_xs_usage(cv, "THIS");
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) );
1265 XS(XS_Wx__SockAddress_Clear); /* prototype to pass -Wmissing-prototypes */
1266 XS(XS_Wx__SockAddress_Clear)
1274 croak_xs_usage(cv, "THIS");
1276 wxSockAddress * THIS = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SockAddress" );
1284 XS(XS_Wx__SockAddress_Type); /* prototype to pass -Wmissing-prototypes */
1285 XS(XS_Wx__SockAddress_Type)
1293 croak_xs_usage(cv, "THIS");
1295 wxSockAddress * THIS = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::SockAddress" );
1299 RETVAL = THIS->Type();
1300 XSprePUSH; PUSHi((IV)RETVAL);
1305 #if WXPERL_W_VERSION_GE( 2, 5, 1 )
1306 #define XSubPPtmpAAAB 1
1309 XS(XS_Wx__IPaddress_SetHostname); /* prototype to pass -Wmissing-prototypes */
1310 XS(XS_Wx__IPaddress_SetHostname)
1318 croak_xs_usage(cv, "THIS, name");
1321 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1324 WXSTRING_INPUT( name, wxString, ST(1) );
1325 RETVAL = THIS->Hostname( name );
1326 ST(0) = boolSV(RETVAL);
1333 XS(XS_Wx__IPaddress_SetService); /* prototype to pass -Wmissing-prototypes */
1334 XS(XS_Wx__IPaddress_SetService)
1342 croak_xs_usage(cv, "THIS, port");
1345 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1348 WXSTRING_INPUT( port, wxString, ST(1) );
1349 RETVAL = THIS->Service( port );
1350 ST(0) = boolSV(RETVAL);
1357 XS(XS_Wx__IPaddress_IsLocalHost); /* prototype to pass -Wmissing-prototypes */
1358 XS(XS_Wx__IPaddress_IsLocalHost)
1366 croak_xs_usage(cv, "THIS");
1368 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1371 RETVAL = THIS->IsLocalHost();
1372 ST(0) = boolSV(RETVAL);
1379 XS(XS_Wx__IPaddress_SetAnyAddress); /* prototype to pass -Wmissing-prototypes */
1380 XS(XS_Wx__IPaddress_SetAnyAddress)
1388 croak_xs_usage(cv, "THIS");
1390 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1392 RETVAL = THIS->AnyAddress();
1393 ST(0) = boolSV(RETVAL);
1400 XS(XS_Wx__IPaddress_GetIPAddress); /* prototype to pass -Wmissing-prototypes */
1401 XS(XS_Wx__IPaddress_GetIPAddress)
1409 croak_xs_usage(cv, "THIS");
1411 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1413 RETVAL = THIS->IPAddress();
1414 ST(0) = sv_newmortal();
1415 WXSTRING_OUTPUT( RETVAL, ST(0) );
1422 XS(XS_Wx__IPaddress_GetHostname); /* prototype to pass -Wmissing-prototypes */
1423 XS(XS_Wx__IPaddress_GetHostname)
1431 croak_xs_usage(cv, "THIS");
1433 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1435 RETVAL = THIS->Hostname();
1436 ST(0) = sv_newmortal();
1437 WXSTRING_OUTPUT( RETVAL, ST(0) );
1444 XS(XS_Wx__IPaddress_GetService); /* prototype to pass -Wmissing-prototypes */
1445 XS(XS_Wx__IPaddress_GetService)
1453 croak_xs_usage(cv, "THIS");
1455 wxIPaddress * THIS = (wxIPaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPaddress" );
1456 unsigned short RETVAL;
1458 RETVAL = THIS->Service();
1459 XSprePUSH; PUSHu((UV)RETVAL );
1466 XS(XS_Wx__IPV4address_new); /* prototype to pass -Wmissing-prototypes */
1467 XS(XS_Wx__IPV4address_new)
1475 croak_xs_usage(cv, "CLASS");
1477 char * CLASS = (char *)SvPV_nolen(ST(0));
1478 wxIPV4address * RETVAL;
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) );
1490 XS(XS_Wx__IPV4address_GetOrigHostname); /* prototype to pass -Wmissing-prototypes */
1491 XS(XS_Wx__IPV4address_GetOrigHostname)
1499 croak_xs_usage(cv, "THIS");
1501 wxIPV4address * THIS = (wxIPV4address *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPV4address" );
1503 RETVAL = THIS->OrigHostname();
1504 ST(0) = sv_newmortal();
1505 WXSTRING_OUTPUT( RETVAL, ST(0) );
1511 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
1512 #define XSubPPtmpAAAC 1
1515 XS(XS_Wx__IPV4address_SetBroadcastAddress); /* prototype to pass -Wmissing-prototypes */
1516 XS(XS_Wx__IPV4address_SetBroadcastAddress)
1524 croak_xs_usage(cv, "THIS");
1526 wxIPV4address * THIS = (wxIPV4address *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::IPV4address" );
1528 RETVAL = THIS->BroadcastAddress();
1529 ST(0) = boolSV(RETVAL);
1537 #define XSubPPtmpAAAD 1
1540 XS(XS_Wx__IPV6address_new); /* prototype to pass -Wmissing-prototypes */
1541 XS(XS_Wx__IPV6address_new)
1549 croak_xs_usage(cv, "CLASS");
1551 char * CLASS = (char *)SvPV_nolen(ST(0));
1552 wxIPV6address * RETVAL;
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) );
1565 #define XSubPPtmpAAAE 1
1568 XS(XS_Wx__UNIXaddress_new); /* prototype to pass -Wmissing-prototypes */
1569 XS(XS_Wx__UNIXaddress_new)
1577 croak_xs_usage(cv, "CLASS");
1579 char * CLASS = (char *)SvPV_nolen(ST(0));
1580 wxUNIXaddress * RETVAL;
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) );
1592 XS(XS_Wx__UNIXaddress_GetFilename); /* prototype to pass -Wmissing-prototypes */
1593 XS(XS_Wx__UNIXaddress_GetFilename)
1601 croak_xs_usage(cv, "THIS");
1603 wxUNIXaddress * THIS = (wxUNIXaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::UNIXaddress" );
1605 RETVAL = THIS->Filename();
1606 ST(0) = sv_newmortal();
1607 WXSTRING_OUTPUT( RETVAL, ST(0) );
1614 XS(XS_Wx__UNIXaddress_SetFilename); /* prototype to pass -Wmissing-prototypes */
1615 XS(XS_Wx__UNIXaddress_SetFilename)
1623 croak_xs_usage(cv, "THIS, filename");
1626 wxUNIXaddress * THIS = (wxUNIXaddress *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::UNIXaddress" );
1628 WXSTRING_INPUT( filename, wxString, ST(1) );
1629 THIS->Filename( filename );
1636 /* INCLUDE: Returning to 'Socket.xs' from 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/SockAddress.xsp |' */
1639 /* INCLUDE: Including 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/DatagramSocket.xsp |' from 'Socket.xs' */
1642 XS(XS_Wx__DatagramSocket_new); /* prototype to pass -Wmissing-prototypes */
1643 XS(XS_Wx__DatagramSocket_new)
1650 if (items < 2 || items > 3)
1651 croak_xs_usage(cv, "CLASS, addr, flags = wxSOCKET_NONE");
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;
1659 flags = wxSOCKET_NONE;
1661 flags = (wxSocketFlags)SvIV(ST(2));
1663 RETVAL = new wxPliDatagramSocket( CLASS , *addr, flags );
1664 ST(0) = sv_newmortal();
1665 wxPli_object_2_sv( aTHX_ ST(0), RETVAL );
1672 XS(XS_Wx__DatagramSocket_RecvFrom); /* prototype to pass -Wmissing-prototypes */
1673 XS(XS_Wx__DatagramSocket_RecvFrom)
1681 croak_xs_usage(cv, "THIS, addr, buf, nBytes");
1683 wxSockAddress* addr = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SockAddress" );
1685 wxUint32 nBytes = (wxUint32)SvIV(ST(3));
1686 wxDatagramSocket * THIS = (wxDatagramSocket *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::DatagramSocket" );
1689 DO_READ( THIS->RecvFrom( *addr, buffer, nBytes ), buf, nBytes, 0 );
1690 XSprePUSH; PUSHu((UV)RETVAL );
1696 XS(XS_Wx__DatagramSocket_SendTo); /* prototype to pass -Wmissing-prototypes */
1697 XS(XS_Wx__DatagramSocket_SendTo)
1705 croak_xs_usage(cv, "THIS, addr, buf, nBytes");
1707 wxSockAddress* addr = (wxSockAddress *) wxPli_sv_2_object( aTHX_ ST(1), "Wx::SockAddress" );
1709 wxUint32 nBytes = (wxUint32)SvIV(ST(3));
1710 wxDatagramSocket * THIS = (wxDatagramSocket *) wxPli_sv_2_object( aTHX_ ST(0), "Wx::DatagramSocket" );
1713 DO_WRITE( THIS->SendTo( *addr, buffer, nBytes ), buf, nBytes );
1714 XSprePUSH; PUSHu((UV)RETVAL );
1720 /* INCLUDE: Returning to 'Socket.xs' from 'perl -MExtUtils::XSpp::Cmd -e xspp -- -t ../../typemap.xsp XS/DatagramSocket.xsp |' */
1722 #if defined(__WXMSW__)
1724 #define XS( name ) WXXS( name )
1729 XS(boot_Wx__Socket); /* prototype to pass -Wmissing-prototypes */
1737 #if (PERL_REVISION == 5 && PERL_VERSION < 9)
1738 char* file = __FILE__;
1740 const char* file = __FILE__;
1743 PERL_UNUSED_VAR(cv); /* -W */
1744 PERL_UNUSED_VAR(items); /* -W */
1745 XS_VERSION_BOOTCHECK ;
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);
1757 newXS("Wx::SocketBase::new", XS_Wx__SocketBase_new, file);
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);
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);
1803 newXS("Wx::IPV4address::new", XS_Wx__IPV4address_new, file);
1804 newXS("Wx::IPV4address::GetOrigHostname", XS_Wx__IPV4address_GetOrigHostname, file);
1806 newXS("Wx::IPV4address::SetBroadcastAddress", XS_Wx__IPV4address_SetBroadcastAddress, file);
1809 newXS("Wx::IPV6address::new", XS_Wx__IPV6address_new, file);
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);
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);
1820 /* Initialisation Section */
1822 INIT_PLI_HELPERS( wx_pli_helpers );
1835 /* End of Initialisation Section */
1837 #if (PERL_REVISION == 5 && PERL_VERSION >= 9)
1839 call_list(PL_scopestack_ix, PL_unitcheckav);