1 #############################################################################
3 ## Purpose: XS for Wx::Process and Wx::ProcessEvent and Wx::Execute
4 ## Author: Mattia Barbon
7 ## RCS-ID: $Id: Process.xs 2186 2007-08-19 21:13:06Z mbarbon $
8 ## Copyright: (c) 2002-2004, 2006-2007 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 #############################################################################
13 #include <wx/process.h>
14 #include "cpp/process.h"
17 MODULE=Wx PACKAGE=Wx::ProcessEvent
20 wxProcessEvent::new( id = 0, pid = 0, status = 0 )
26 wxProcessEvent::GetPid()
29 wxProcessEvent::GetExitCode()
31 MODULE=Wx PACKAGE=Wx::Process
34 wxProcess::new( parent = 0, id = -1 )
38 RETVAL = new wxPliProcess( CLASS, parent, id );
48 wxProcess::CloseOutput()
54 wxProcess::GetErrorStream()
57 wxProcess::GetInputStream()
60 wxProcess::GetOutputStream()
63 wxProcess::IsErrorAvailable()
66 wxProcess::IsInputAvailable()
69 wxProcess::IsInputOpened()
71 #if WXPERL_W_VERSION_LT( 2, 5, 4 )
72 #define wxKILL_NOCHILDREN 0
76 Kill( pid, signal = wxSIGNONE, flags = wxKILL_NOCHILDREN )
81 #if WXPERL_W_VERSION_GE( 2, 5, 4 )
82 RETVAL = wxProcess::Kill( pid, signal, flags );
84 RETVAL = wxProcess::Kill( pid, signal );
93 RETVAL = wxProcess::Exists( pid );
98 wxProcess::OnTerminate( pid, status )
102 THIS->wxProcess::OnTerminate( pid, status );
105 wxProcess::Redirect()
108 Open( cmd, flags = wxEXEC_ASYNC )
112 RETVAL = wxProcess::Open( cmd, flags );
116 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
123 MODULE=Wx PACKAGE=Wx PREFIX=wx
126 wxExecuteCommand( command, sync = wxEXEC_ASYNC, callback = 0 )
131 RETVAL = wxExecute( command, sync, callback );
138 wxExecuteArgs( args, sync = wxEXEC_ASYNC, callback = 0 )
147 n = wxPli_av_2_wxcharparray( aTHX_ args, &t );
148 argv = new wxChar*[n+1];
149 memcpy( argv, t, n*sizeof(char*) );
151 RETVAL = wxExecute( argv, sync, callback );
152 for( i = 0; i < n; ++i )
162 wxExecuteArgs( args, sync = wxEXEC_ASYNC, callback = 0 )
171 n = wxPli_av_2_charparray( aTHX_ args, &t );
172 argv = new char*[n+1];
173 memcpy( argv, t, n*sizeof(char*) );
175 RETVAL = wxExecute( argv, sync, callback );
176 for( i = 0; i < n; ++i )
186 wxExecuteStdout( command )
193 code = wxExecute( command, out );
194 ret = wxPli_stringarray_2_av( aTHX_ out );
196 PUSHs( sv_2mortal( newSViv( code ) ) );
197 PUSHs( sv_2mortal( newRV_noinc( (SV*)ret ) ) );
200 wxExecuteStdoutStderr( command )
203 wxArrayString out, err;
207 code = wxExecute( command, out, err );
208 rout = wxPli_stringarray_2_av( aTHX_ out );
209 rerr = wxPli_stringarray_2_av( aTHX_ err );
211 PUSHs( sv_2mortal( newSViv( code ) ) );
212 PUSHs( sv_2mortal( newRV_noinc( (SV*)rout ) ) );
213 PUSHs( sv_2mortal( newRV_noinc( (SV*)rerr ) ) );