]> git.saurik.com Git - wxWidgets.git/blame - src/unix/baseunix.cpp
added missing wxUSE_XXX checks
[wxWidgets.git] / src / unix / baseunix.cpp
CommitLineData
e2478fde 1///////////////////////////////////////////////////////////////////////////////
de6185e2 2// Name: src/unix/baseunix.cpp
e2478fde
VZ
3// Purpose: misc stuff only used in console applications under Unix
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 23.06.2003
7// RCS-ID: $Id$
8// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
65571936 9// License: wxWindows licence
e2478fde
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20// for compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#ifndef WX_PRECOMP
8df6de97
VS
28 #include "wx/log.h"
29 #include "wx/intl.h"
de6185e2 30 #include "wx/utils.h"
e2478fde
VZ
31#endif //WX_PRECOMP
32
33#include "wx/apptrait.h"
8df6de97 34#include "wx/unix/execute.h"
b46b1d59 35#include "wx/evtloop.h"
8e913f79
VZ
36
37#if wxUSE_TIMER
38 #include "wx/unix/private/timer.h"
39#endif // wxUSE_TIMER
e2478fde
VZ
40
41// for waitpid()
42#include <sys/types.h>
43#include <sys/wait.h>
44
45// ============================================================================
46// wxConsoleAppTraits implementation
47// ============================================================================
48
49// ----------------------------------------------------------------------------
50// wxExecute support
51// ----------------------------------------------------------------------------
52
53bool wxConsoleAppTraits::CreateEndProcessPipe(wxExecuteData& WXUNUSED(data))
54{
55 // nothing to do, so always ok
56 return true;
57}
58
59bool
60wxConsoleAppTraits::IsWriteFDOfEndProcessPipe(wxExecuteData& WXUNUSED(data),
61 int WXUNUSED(fd))
62{
63 // we don't have any pipe
64 return false;
65}
66
67void
68wxConsoleAppTraits::DetachWriteFDOfEndProcessPipe(wxExecuteData& WXUNUSED(data))
69{
70 // nothing to do
71}
72
73
74int
75wxConsoleAppTraits::WaitForChild(wxExecuteData& execData)
76{
77 wxASSERT_MSG( execData.flags & wxEXEC_SYNC,
78 wxT("async execution not supported yet") );
79
80 int exitcode = 0;
81 if ( waitpid(execData.pid, &exitcode, 0) == -1 || !WIFEXITED(exitcode) )
82 {
83 wxLogSysError(_("Waiting for subprocess termination failed"));
84 }
85
86 return exitcode;
87}
88
8e913f79
VZ
89#if wxUSE_TIMER
90
b46b1d59 91wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
c2ca375c
VZ
92{
93 // this doesn't work yet as there is no main loop in console applications
94 // (but it will be added later)
95 return new wxUnixTimerImpl(timer);
96}
b46b1d59 97
8e913f79
VZ
98#endif // wxUSE_TIMER
99
2ddff00c 100wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
b46b1d59
VZ
101{
102 return new wxEventLoop();
103}
104