]>
Commit | Line | Data |
---|---|---|
518b5d2f VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: unix/execute.h | |
3 | // Purpose: private details of wxExecute() implementation | |
4 | // Author: Vadim Zeitlin | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin | |
65571936 | 7 | // Licence: wxWindows licence |
518b5d2f VZ |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | #ifndef _WX_UNIX_EXECUTE_H | |
11 | #define _WX_UNIX_EXECUTE_H | |
12 | ||
e2478fde VZ |
13 | #include "wx/unix/pipe.h" |
14 | ||
b5dbe15d | 15 | class WXDLLIMPEXP_FWD_BASE wxProcess; |
e2478fde VZ |
16 | class wxStreamTempInputBuffer; |
17 | ||
518b5d2f VZ |
18 | // if pid > 0, the execution is async and the data is freed in the callback |
19 | // executed when the process terminates, if pid < 0, the execution is | |
20 | // synchronous and the caller (wxExecute) frees the data | |
21 | struct wxEndProcessData | |
22 | { | |
23 | int pid, // pid of the process | |
24 | tag; // port dependent value | |
25 | wxProcess *process; // if !NULL: notified on process termination | |
26 | int exitcode; // the exit code | |
27 | }; | |
28 | ||
e2478fde VZ |
29 | // struct in which information is passed from wxExecute() to wxAppTraits |
30 | // methods | |
31 | struct wxExecuteData | |
32 | { | |
33 | wxExecuteData() | |
34 | { | |
35 | flags = | |
36 | pid = 0; | |
37 | ||
38 | process = NULL; | |
39 | ||
40 | #if wxUSE_STREAMS | |
41 | bufOut = | |
42 | bufErr = NULL; | |
43 | #endif // wxUSE_STREAMS | |
44 | } | |
45 | ||
46 | // wxExecute() flags | |
47 | int flags; | |
48 | ||
49 | // the pid of the child process | |
50 | int pid; | |
51 | ||
52 | // the associated process object or NULL | |
53 | wxProcess *process; | |
54 | ||
55 | // pipe used for end process detection | |
56 | wxPipe pipeEndProcDetect; | |
57 | ||
58 | #if wxUSE_STREAMS | |
59 | // the input buffer bufOut is connected to stdout, this is why it is | |
60 | // called bufOut and not bufIn | |
61 | wxStreamTempInputBuffer *bufOut, | |
62 | *bufErr; | |
63 | #endif // wxUSE_STREAMS | |
64 | }; | |
65 | ||
518b5d2f VZ |
66 | // this function is called when the process terminates from port specific |
67 | // callback function and is common to all ports (src/unix/utilsunx.cpp) | |
20123d49 | 68 | extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data); |
518b5d2f VZ |
69 | |
70 | // this function is called to associate the port-specific callback with the | |
71 | // child process. The return valus is port-specific. | |
20123d49 | 72 | extern WXDLLIMPEXP_CORE int wxAddProcessCallback(wxEndProcessData *proc_data, int fd); |
e2478fde | 73 | |
f7ef0602 | 74 | #if defined(__DARWIN__) && (defined(__WXMAC__) || defined(__WXCOCOA__)) |
c8023fed DE |
75 | // For ports (e.g. DARWIN) which can add callbacks based on the pid |
76 | extern int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid); | |
6213bde1 | 77 | #endif |
518b5d2f VZ |
78 | |
79 | #endif // _WX_UNIX_EXECUTE_H |