File: IPC.xsp

package info (click to toggle)
libwx-perl 1%3A0.9928-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,300 kB
  • ctags: 2,322
  • sloc: cpp: 11,044; perl: 8,646; ansic: 710; makefile: 48
file content (358 lines) | stat: -rw-r--r-- 7,687 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#############################################################################
## Name:        XS/IPC.xsp
## Purpose:     XS for IPC
## Author:      Mark Dootson
## Modified by:
## Created:     11/04/2013
## RCS-ID:      $Id: FontEnumerator.xs 2274 2007-11-10 22:37:30Z mbarbon $
## Copyright:   (c)2013 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

// The C++ part is written longhand in "cpp/ipc.h" because
// build::Wx::XSP::Virtual cannot currently auto create a
// Perlish wrapper for methods with *buffer, *buffsize
// type params.

#if wxUSE_IPC

#define wxUSE_DDE_FOR_IPC 1
#include <wx/ipc.h>
#include <cpp/ipc.h>

%typemap{wxIPCFormat}{simple};
%typemap{wxChar*}{simple};

%loadplugin{build::Wx::XSP::Enum};
%EnumExportTag{ipc};

// dummy defines for wxWidgets 2.8.x
#if WXPERL_W_VERSION_LT( 2, 9, 0 )
#define  wxIPC_UTF16TEXT 13
#define  wxIPC_UTF8TEXT  13
#define  wxIPC_UTF32TEXT 13
#endif

enum wxIPCFormat
{
  wxIPC_INVALID,
  wxIPC_TEXT,
  wxIPC_BITMAP,
  wxIPC_METAFILE,
  wxIPC_SYLK,
  wxIPC_DIF,
  wxIPC_TIFF,
  wxIPC_OEMTEXT,
  wxIPC_DIB,
  wxIPC_PALETTE,
  wxIPC_PENDATA,
  wxIPC_RIFF,
  wxIPC_WAVE,
  wxIPC_UNICODETEXT,
  wxIPC_ENHMETAFILE,
  wxIPC_FILENAME,
  wxIPC_LOCALE,
  wxIPC_PRIVATE,
  wxIPC_UTF16TEXT,
  wxIPC_UTF8TEXT,
  wxIPC_UTF32TEXT, 
};


%{

MODULE=Wx PACKAGE=Wx::Connection

void
new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newDefault )
        MATCH_ANY_REDISP( newBuffer )
    END_OVERLOAD( "Wx::Connection::new" )


wxConnection*
newDefault( CLASS )
    char* CLASS
  CODE:
    RETVAL = new wxPlConnection( CLASS );
  OUTPUT: RETVAL
  CLEANUP:
    wxPli_object_set_deleteable( aTHX_ ST(0), true );

wxConnection*
newBuffer( CLASS, buffer )
    char* CLASS
    SV* buffer
  CODE:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = new wxPlConnection( CLASS, (void*)SvPVX(buffer), (size_t)SvCUR(buffer));
#else
    RETVAL = new wxPlConnection( CLASS, (wxChar*)SvPVX(buffer), (int)SvCUR(buffer));
#endif
  OUTPUT: RETVAL
  CLEANUP:
    wxPli_object_set_deleteable( aTHX_ ST(0), true );
    

static void
wxConnection::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );



## // thread OK
void
wxConnection::DESTROY()
  CODE:
    wxPli_thread_sv_unregister( aTHX_ wxPli_get_class( aTHX_ ST(0) ), THIS, ST(0) );
    if( wxPli_object_is_deleteable( aTHX_ ST(0) ) )
        delete THIS;    

#if WXPERL_W_VERSION_GE( 2, 9, 0 )
bool
wxConnection::Execute( data )
    SV* data
  CODE:
    RETVAL = THIS->Execute((void*)SvPVX(data), (size_t)SvLEN(data), wxIPC_TEXT);
  OUTPUT: RETVAL

#else
bool
wxConnection::Execute( data )
    wxString data
  CODE:
    RETVAL = THIS->Execute( data );
  OUTPUT: RETVAL

#endif

void
wxConnection::Request( item, format = wxIPC_TEXT )
    wxString item
    wxIPCFormat format
  PREINIT:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    size_t size;
#else
    int size;
#endif
  PPCODE:
    void *buffer = (void*)THIS->Request(item, &size, format);
    EXTEND( SP, 1 );
    PUSHs( sv_2mortal( newSVpvn( (char*)buffer, size) ) );

bool
wxConnection::Poke( item, data, format = wxIPC_TEXT  )
    wxString item
    SV* data
    wxIPCFormat format
  CODE:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = THIS->Poke(item, (void*)SvPVX(data), (size_t)SvCUR(data), format);
#else
    RETVAL = THIS->Poke(item, (wxChar*)SvPVX(data), (int)SvCUR(data), format);
#endif
  OUTPUT: RETVAL
    

bool
wxConnection::StartAdvise( item )
    wxString item

bool
wxConnection::StopAdvise( item )
    wxString item

bool
wxConnection::Advise( item, data, format = wxIPC_TEXT )
    wxString item
    SV* data
    wxIPCFormat format
  CODE:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = THIS->Advise(item, (void*)SvPVX(data), (size_t)SvCUR(data), format);
#else
    RETVAL = THIS->Advise(item, (wxChar*)SvPVX(data), (int)SvCUR(data), format);
#endif
  OUTPUT: RETVAL


bool
wxConnection::Disconnect()
  CODE:
    wxPli_object_set_deleteable( aTHX_ ST(0), true );
    RETVAL = THIS->Disconnect();
  OUTPUT: RETVAL

bool
wxConnection::GetConnected()

void
wxConnection::SetConnected( connected )
    bool connected

bool
wxConnection::OnStartAdvise( topic, item )
    wxString topic
    wxString item
  CODE:
    RETVAL = ((wxPlConnection*)THIS)->base_OnStartAdvise(topic, item);
  OUTPUT: RETVAL

bool
wxConnection::OnStopAdvise( topic, item )
    wxString topic
    wxString item
  CODE:
    RETVAL = ((wxPlConnection*)THIS)->base_OnStopAdvise(topic, item);
  OUTPUT: RETVAL


bool
wxConnection::OnDisconnect()
  CODE:
    RETVAL = ((wxPlConnection*)THIS)->base_OnDisconnect();
  OUTPUT: RETVAL


bool
wxConnection::OnExecute(topic, data, format)
    wxString topic
    SV* data
    wxIPCFormat format
  CODE:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = ((wxPlConnection*)THIS)->base_OnExecute(topic, (void*)SvPVX(data), (size_t)SvLEN(data), format);
#else
    RETVAL = ((wxPlConnection*)THIS)->base_OnExecute(topic, (wxChar*)SvPVX(data), (int)SvLEN(data), format);
#endif
  OUTPUT: RETVAL

#if WXPERL_W_VERSION_GE( 2, 9, 0 )

bool
wxConnection::OnExec(topic, data)
    wxString topic
    wxString data
  CODE:
    RETVAL = ((wxPlConnection*)THIS)->base_OnExec(topic, data);
  OUTPUT: RETVAL

#endif

void
wxConnection::OnRequest(topic, item, format)
    wxString topic
    wxString item
    wxIPCFormat format
  PREINIT:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    size_t size;
#else
    int size;
#endif
  PPCODE:
    void *buffer = (void*)((wxPlConnection*)THIS)->base_OnRequest(topic, item, &size, format);
    EXTEND( SP, 1 );
    PUSHs( sv_2mortal( newSVpvn( (char*)buffer, size ) ) );

bool
wxConnection::OnPoke(topic, item, data, format)
    wxString topic
    wxString item
    SV* data
    wxIPCFormat format
  CODE:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = ((wxPlConnection*)THIS)->base_OnPoke(topic, item, (void*)SvPVX(data), (size_t)SvLEN(data), format);
#else
    RETVAL = ((wxPlConnection*)THIS)->base_OnPoke(topic, item, (wxChar*)SvPVX(data), (int)SvLEN(data), format);
#endif
  OUTPUT: RETVAL


bool
wxConnection::OnAdvise(topic, item, data, format)
    wxString topic
    wxString item
    SV* data
    wxIPCFormat format
  CODE:
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = ((wxPlConnection*)THIS)->base_OnAdvise(topic, item, (void*)SvPVX(data), (size_t)SvLEN(data), format);
#else
    RETVAL = ((wxPlConnection*)THIS)->base_OnAdvise(topic, item, (wxChar*)SvPVX(data), (int)SvLEN(data), format);
#endif
  OUTPUT: RETVAL


MODULE=Wx PACKAGE=Wx::Server

wxServer*
new( CLASS )
    char* CLASS
  CODE:
    RETVAL = new wxPlServer( CLASS );
  OUTPUT: RETVAL

void
wxServer::Destroy()
  CODE:
    delete THIS;

bool
wxServer::Create( servicename )
    wxString servicename


wxConnection*
wxServer::OnAcceptConnection( topic )
    wxString topic
  CODE:
    RETVAL = (wxConnection*)((wxPlServer*)THIS)->base_OnAcceptConnection(topic);
  OUTPUT: RETVAL


MODULE=Wx PACKAGE=Wx::Client

wxClient*
new( CLASS )
    char* CLASS
  CODE:
    RETVAL = new wxPlClient( CLASS );
  OUTPUT: RETVAL

void
wxClient::Destroy()
  CODE:
    delete THIS;

bool
wxClient::ValidHost( host )
    wxString host

wxConnection*
wxClient::MakeConnection(host, server, topic )
    wxString host
    wxString server
    wxString topic
  CODE:
    RETVAL = (wxConnection*)THIS->MakeConnection(host, server, topic );
  OUTPUT: RETVAL

wxConnection*
wxClient::OnMakeConnection( )
  CODE:
    RETVAL = (wxConnection*)((wxPlClient*)THIS)->base_OnMakeConnection();
  OUTPUT: RETVAL

%}


#endif