]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/unix/execute.h
declare file-related APIs missing under Palm (pflib-missing.diff part of patch 1894861)
[wxWidgets.git] / include / wx / unix / execute.h
... / ...
CommitLineData
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
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_UNIX_EXECUTE_H
11#define _WX_UNIX_EXECUTE_H
12
13#include "wx/unix/pipe.h"
14
15class WXDLLIMPEXP_FWD_BASE wxProcess;
16class wxStreamTempInputBuffer;
17
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
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{
31 int pid; // pid of the process
32 int tag; // port dependent value
33 wxProcess *process; // if !NULL: notified on process termination
34 int exitcode; // the exit code
35
36#ifdef wxHAS_GENERIC_PROCESS_CALLBACK
37 wxEndProcessFDIOHandler *fdioHandler;
38#endif
39};
40
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
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)
80extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data);
81
82// This function is called to associate the port-specific callback with the
83// child process. The return valus is port-specific.
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.
95extern WXDLLIMPEXP_CORE int wxAddProcessCallback(wxEndProcessData *proc_data, int fd);
96
97#if defined(__WXMAC__) || defined(__WXCOCOA__)
98// For ports (e.g. DARWIN) which can add callbacks based on the pid
99extern int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid);
100#endif
101
102#endif // _WX_UNIX_EXECUTE_H