Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Log.xs
1 #############################################################################
2 ## Name:        XS/Log.xs
3 ## Purpose:     XS for Wx::Log and derived classes
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     29/10/2000
7 ## RCS-ID:      $Id: Log.xs 2626 2009-10-18 22:48:17Z mbarbon $
8 ## Copyright:   (c) 2000-2003, 2005-2007, 2009 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 #include <wx/log.h>
14 #include "cpp/log.h"
15
16 MODULE=Wx PACKAGE=Wx::Log
17
18 void
19 wxLog::Destroy()
20   CODE:
21     delete THIS;
22
23 void
24 AddTraceMask( mask )
25     wxString mask
26   CODE:
27     wxLog::AddTraceMask( mask );
28
29 void
30 ClearTraceMasks()
31   CODE:
32     wxLog::ClearTraceMasks();
33
34 void
35 RemoveTraceMask( mask )
36     wxString mask
37   CODE:
38     wxLog::RemoveTraceMask( mask );
39
40 bool
41 IsAllowedTraceMask( mask )
42     wxString mask
43   CODE:
44     RETVAL = wxLog::IsAllowedTraceMask( mask );
45   OUTPUT:
46     RETVAL
47
48 wxLog*
49 GetActiveTarget()
50   CODE:
51     RETVAL = wxLog::GetActiveTarget();
52   OUTPUT:
53     RETVAL
54
55 wxLog*
56 SetActiveTarget( target )
57     wxLog* target
58   CODE:
59     RETVAL = wxLog::SetActiveTarget( target );
60   OUTPUT:
61     RETVAL
62
63 void
64 DontCreateOnDemand()
65   CODE:
66     wxLog::DontCreateOnDemand();
67
68 void
69 wxLog::Flush()
70
71 void
72 wxLog::FlushActive()
73
74 bool
75 wxLog::HasPendingMessages()
76
77 void
78 wxLog::SetVerbose( verbose = true )
79     bool verbose
80
81 bool
82 wxLog::GetVerbose()
83
84 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
85
86 void
87 _SetTimestamp( format, buffer )
88     wxString format
89     SV* buffer
90   CODE:
91     wxLog::SetTimestamp( format );
92
93 wxString
94 wxLog::GetTimestamp();
95
96 #else
97
98 void
99 _SetTimestamp( format, buffer )
100     SV* format
101     SV* buffer
102   CODE:
103     if( SvOK( ST(0) ) ) {
104         const wxString format_tmp = ( SvUTF8( format ) ) ?
105                   ( wxString( SvPVutf8_nolen( format ), wxConvUTF8 ) )
106                 : ( wxString( SvPV_nolen( format ), wxConvLibc ) );
107         const wxChar* fmt = (const wxChar*)format_tmp.c_str();
108         STRLEN size = wxStrlen( fmt ) * sizeof(wxChar) + sizeof(wxChar);
109         SvUPGRADE( buffer, SVt_PV );
110         wxLog::SetTimestamp( wxStrcpy( (wxChar*)SvGROW( buffer, size ),
111                              fmt ) );
112     } else {
113         wxLog::SetTimestamp( NULL );
114     }
115
116 const wxChar*
117 wxLog::GetTimestamp()
118
119 #endif
120
121 void
122 SetTraceMask( mask )
123     wxTraceMask mask
124   CODE:
125     wxLog::SetTraceMask( mask );
126
127 wxTraceMask
128 GetTraceMask()
129   CODE:
130     RETVAL = wxLog::GetTraceMask();
131   OUTPUT:
132     RETVAL
133
134 MODULE=Wx PACKAGE=Wx::PlLog
135
136 wxPlLog*
137 wxPlLog::new()
138   CODE:
139     RETVAL = new wxPlLog( CLASS );
140   OUTPUT:
141     RETVAL
142
143 MODULE=Wx PACKAGE=Wx::LogTextCtrl
144
145 wxLogTextCtrl*
146 wxLogTextCtrl::new( ctrl )
147     wxTextCtrl* ctrl
148
149 MODULE=Wx PACKAGE=Wx::LogNull
150
151 wxLogNull*
152 wxLogNull::new()
153
154 static void
155 wxLogNull::CLONE()
156   CODE:
157     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
158
159 ## // thread OK
160 void
161 wxLogNull::DESTROY()
162   CODE:
163     wxPli_thread_sv_unregister( aTHX_ "Wx::LogNull", THIS, ST(0) );
164     delete THIS;
165
166 MODULE=Wx PACKAGE=Wx::LogGui
167
168 wxLogGui*
169 wxLogGui::new()
170
171 MODULE=Wx PACKAGE=Wx::LogWindow
172
173 wxLogWindow*
174 wxLogWindow::new( parent, title, show = true, passtoold = true )
175     wxFrame* parent
176     wxString title
177     bool show
178     bool passtoold
179
180 MODULE=Wx PACKAGE=Wx
181
182 # this is a test for INTERFACE:
183 # in this specific case it saves around 256 bytes / function,
184 # more for more complex typemaps / longer parameter lists
185
186 #if 0
187
188 #define XSINTERFACE__wxstring( _ret, _cv, _f ) \
189   ( ( void (*)( const wxString& ) ) _f)
190
191 #define XSINTERFACE__wxstring_SET( _cv, _f ) \
192   ( CvXSUBANY( _cv ).any_ptr = (void*) _f ) 
193
194 #undef dXSFUNCTION
195 #define dXSFUNCTION( a ) \
196   void (*XSFUNCTION)( const wxString& )
197
198 void
199 interface__wxstring( string )
200     wxString string
201   INTERFACE_MACRO:
202     XSINTERFACE__wxstring
203     XSINTERFACE__wxstring_SET
204   INTERFACE:
205     wxLogError wxLogFatalError wxLogWarning
206     wxLogVerbose wxLogDebug
207     wxLogMessage
208     
209 #else
210
211 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
212
213 void
214 wxLogError( string )
215     wxString string
216
217 void
218 wxLogFatalError( string )
219     wxString string
220
221 void
222 wxLogWarning( string )
223     wxString string
224
225 void
226 wxLogMessage( string )
227     wxString string
228
229 void
230 wxLogVerbose( string )
231     wxString string
232
233 void
234 wxLogDebug( string )
235     wxString string
236
237 #else
238
239 void
240 wxLogError( string )
241     const wxChar* string
242
243 void
244 wxLogFatalError( string )
245     const wxChar* string
246
247 void
248 wxLogWarning( string )
249     const wxChar* string
250
251 void
252 wxLogMessage( string )
253     const wxChar* string
254
255 void
256 wxLogVerbose( string )
257     const wxChar* string
258
259 void
260 wxLogDebug( string )
261     const wxChar* string
262
263 #endif
264
265 #endif
266
267 void
268 wxLogStatusFrame( frame, string )
269     wxFrame* frame
270     const wxChar* string
271   CODE:
272     wxLogStatus( frame, string );
273
274 void
275 wxLogStatus( string )
276     const wxChar* string
277
278 #if WXPERL_W_VERSION_LE( 2, 5, 0 )
279
280 void
281 wxLogTrace( string )
282     const wxChar* string
283
284 #endif
285
286 void
287 wxLogTraceMask( mask, string )
288     const wxChar* mask
289     const wxChar* string
290   CODE:
291     wxLogTrace( mask, string );
292
293 void
294 wxLogSysError( string )
295     const wxChar* string
296
297 MODULE=Wx PACKAGE=Wx PREFIX=wx
298
299 unsigned long
300 wxSysErrorCode()
301
302 const wxChar*
303 wxSysErrorMsg( errCode = 0 )
304     unsigned long errCode
305
306 MODULE=Wx PACKAGE=Wx::LogChain
307
308 wxLogChain*
309 wxLogChain::new( logger )
310     wxLog* logger
311
312 wxLog*
313 wxLogChain::GetOldLog()
314
315 bool
316 wxLogChain::IsPassingMessages()
317
318 void
319 wxLogChain::PassMessages( passMessages )
320     bool passMessages
321
322 void
323 wxLogChain::SetLog( logger )
324     wxLog* logger
325
326 MODULE=Wx PACKAGE=Wx::LogPassThrough
327
328 wxLogPassThrough*
329 wxLogPassThrough::new()
330
331 MODULE=Wx PACKAGE=Wx::PlLogPassThrough
332
333 wxPlLogPassThrough*
334 wxPlLogPassThrough::new()
335   CODE:
336     RETVAL = new wxPlLogPassThrough( CLASS );
337   OUTPUT:
338     RETVAL
339
340 MODULE=Wx PACKAGE=Wx::LogStderr
341
342 wxLogStderr*
343 wxLogStderr::new( fp = NULL )
344     FILE* fp;