]> git.saurik.com Git - wxWidgets.git/blame - include/wx/unix/execute.h
update mac gl, after rev 50900
[wxWidgets.git] / include / wx / unix / execute.h
CommitLineData
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 15class WXDLLIMPEXP_FWD_BASE wxProcess;
e2478fde
VZ
16class wxStreamTempInputBuffer;
17
46c7e1a1
VS
18#if defined(__WXDFB__) || defined(__WXX11__)
19 #define wxHAS_GENERIC_PROCESS_CALLBACK 1
20#endif
21
22#ifdef wxHAS_GENERIC_PROCESS_CALLBACK
23struct wxEndProcessFDIOHandler;
24#endif
25
518b5d2f
VZ
26// if pid > 0, the execution is async and the data is freed in the callback
27// executed when the process terminates, if pid < 0, the execution is
28// synchronous and the caller (wxExecute) frees the data
29struct wxEndProcessData
30{
46c7e1a1
VS
31 int pid; // pid of the process
32 int tag; // port dependent value
518b5d2f
VZ
33 wxProcess *process; // if !NULL: notified on process termination
34 int exitcode; // the exit code
46c7e1a1
VS
35
36#ifdef wxHAS_GENERIC_PROCESS_CALLBACK
37 wxEndProcessFDIOHandler *fdioHandler;
38#endif
518b5d2f
VZ
39};
40
e2478fde
VZ
41// struct in which information is passed from wxExecute() to wxAppTraits
42// methods
43struct wxExecuteData
44{
45 wxExecuteData()
46 {
47 flags =
48 pid = 0;
49
50 process = NULL;
51
52#if wxUSE_STREAMS
53 bufOut =
54 bufErr = NULL;
55#endif // wxUSE_STREAMS
56 }
57
58 // wxExecute() flags
59 int flags;
60
61 // the pid of the child process
62 int pid;
63
64 // the associated process object or NULL
65 wxProcess *process;
66
67 // pipe used for end process detection
68 wxPipe pipeEndProcDetect;
69
70#if wxUSE_STREAMS
71 // the input buffer bufOut is connected to stdout, this is why it is
72 // called bufOut and not bufIn
73 wxStreamTempInputBuffer *bufOut,
74 *bufErr;
75#endif // wxUSE_STREAMS
76};
77
518b5d2f
VZ
78// this function is called when the process terminates from port specific
79// callback function and is common to all ports (src/unix/utilsunx.cpp)
20123d49 80extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data);
518b5d2f 81
46c7e1a1 82// This function is called to associate the port-specific callback with the
518b5d2f 83// child process. The return valus is port-specific.
46c7e1a1
VS
84//
85// The file descriptor 'fd' is descriptor of a dummy pipe opened between the
86// parent and the child. No data are written to or read from this pipe, its
87// sole purpose is that the child process will close it when it terminates and
88// the parent will be notified about it if it looks at 'fd' (e.g. using
89// select()).
90//
91// wxAddProcessCallback() does whatever is necessary to ensure that 'fd' is
92// periodically (typically every event loop iteration) checked for its status
93// and that wxHandleProcessTermination() is called once 'fd' indicates the
94// child terminated.
20123d49 95extern WXDLLIMPEXP_CORE int wxAddProcessCallback(wxEndProcessData *proc_data, int fd);
e2478fde 96
c7135017 97#if defined(__WXMAC__) || defined(__WXCOCOA__)
c8023fed
DE
98// For ports (e.g. DARWIN) which can add callbacks based on the pid
99extern int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid);
6213bde1 100#endif
518b5d2f
VZ
101
102#endif // _WX_UNIX_EXECUTE_H