Replace '#ifdef __linux__' by '#ifndef WIN32', etc. to fix compilation on Mac OS X (hint by Alex on ros-dev)

svn path=/trunk/; revision=34891
This commit is contained in:
Colin Finck 2008-07-28 08:32:04 +00:00
parent a9f6591d2c
commit 795b09cde7
6 changed files with 23 additions and 23 deletions

View file

@ -14,7 +14,7 @@ namespace System_
{ {
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b))
#ifdef __linux__ #ifndef WIN32
const char * NamedPipeReader::s_LineBreak = "\x0A\0"; const char * NamedPipeReader::s_LineBreak = "\x0A\0";
#else #else
const char * NamedPipeReader::s_LineBreak = "\x0D\x0A\0"; const char * NamedPipeReader::s_LineBreak = "\x0D\x0A\0";
@ -46,7 +46,7 @@ namespace System_
cerr << "NamedPipeReader::openPipe> pipe already open" << endl; cerr << "NamedPipeReader::openPipe> pipe already open" << endl;
return false; return false;
} }
#ifndef __linux__ #ifdef WIN32
h_Pipe = CreateFile(PipeCmd.c_str(), h_Pipe = CreateFile(PipeCmd.c_str(),
GENERIC_WRITE | GENERIC_READ, GENERIC_WRITE | GENERIC_READ,
0, 0,
@ -105,7 +105,7 @@ namespace System_
cerr << "NamedPipeReader::closePipe> pipe is not open" << endl; cerr << "NamedPipeReader::closePipe> pipe is not open" << endl;
return false; return false;
} }
#ifdef __linux__ #ifndef WIN32
close(h_Pipe); close(h_Pipe);
#else #else
DisconnectNamedPipe(h_Pipe); DisconnectNamedPipe(h_Pipe);
@ -274,7 +274,7 @@ namespace System_
bool NamedPipeReader::readPipe(char * buffer, int bufferlength, long & bytesread) bool NamedPipeReader::readPipe(char * buffer, int bufferlength, long & bytesread)
{ {
#ifdef __linux__ #ifndef WIN32
long cbRead = read(h_Pipe, long cbRead = read(h_Pipe,
buffer, buffer,
(bufferlength-1) * sizeof(char)); (bufferlength-1) * sizeof(char));

View file

@ -38,7 +38,7 @@ namespace System_
} }
} }
#ifdef __linux__ #ifndef WIN32
if (s_Entries.size()) if (s_Entries.size())
{ {
long secs = s_Entries[i]->tm.tv_sec - tm.tv_sec; long secs = s_Entries[i]->tm.tv_sec - tm.tv_sec;
@ -54,7 +54,7 @@ namespace System_
void OsSupport::cancelAlarms() void OsSupport::cancelAlarms()
{ {
#ifndef __linux__ #ifdef WIN32
if (s_hThread) if (s_hThread)
{ {
TerminateThread(s_hThread, 0); TerminateThread(s_hThread, 0);
@ -73,7 +73,7 @@ namespace System_
} }
#ifndef __linux__ #ifdef WIN32
HANDLE OsSupport::s_hThread = 0; HANDLE OsSupport::s_hThread = 0;
static HANDLE hTimer; static HANDLE hTimer;

View file

@ -10,7 +10,7 @@
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at) * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
*/ */
#ifndef __linux__ #ifdef WIN32
#include <windows.h> #include <windows.h>
#else #else
#include <unistd.h> #include <unistd.h>
@ -140,7 +140,7 @@ namespace System_
OsSupport() OsSupport()
{} {}
#ifdef __linux__ #ifndef WIN32
static struct sigaction s_sact; static struct sigaction s_sact;
#else #else
static HANDLE s_hThread; static HANDLE s_hThread;

View file

@ -46,7 +46,7 @@ namespace Sysreg_
string RosBootTest::XEN_CONFIG_FILE = "XEN_CONFIG_FILE"; string RosBootTest::XEN_CONFIG_FILE = "XEN_CONFIG_FILE";
string RosBootTest::XEN_CONFIG_NAME = "XEN_CONFIG_NAME"; string RosBootTest::XEN_CONFIG_NAME = "XEN_CONFIG_NAME";
#ifdef __linux__ #ifndef WIN32
string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_LIN"; string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_LIN";
#else #else
string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_WIN"; string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_WIN";
@ -117,7 +117,7 @@ namespace Sysreg_
img = "output-i386"; img = "output-i386";
EnvironmentVariable::getValue("ROS_OUTPUT", img); EnvironmentVariable::getValue("ROS_OUTPUT", img);
#ifdef __linux__ #ifndef WIN32
img += "/ros.hd"; img += "/ros.hd";
#else #else
img += "\\ros.hd"; img += "\\ros.hd";
@ -159,7 +159,7 @@ namespace Sysreg_
} }
#ifdef __linux__ #ifndef WIN32
qemuimgdir += "/qemu-img"; qemuimgdir += "/qemu-img";
#else #else
@ -176,7 +176,7 @@ namespace Sysreg_
const char * options[] = {NULL, const char * options[] = {NULL,
"create", "create",
"-f", "-f",
#ifdef __linux__ #ifndef WIN32
"raw", "raw",
#else #else
"vmdk", "vmdk",
@ -241,7 +241,7 @@ namespace Sysreg_
{ {
string::size_type pos; string::size_type pos;
#ifdef __linux__ #ifndef WIN32
pos = m_EmuPath.find_last_of("/"); pos = m_EmuPath.find_last_of("/");
#else #else
pos = m_EmuPath.find_last_of("\\"); pos = m_EmuPath.find_last_of("\\");
@ -266,7 +266,7 @@ namespace Sysreg_
m_MaxMem = "64"; m_MaxMem = "64";
} }
#ifdef __linux__ #ifndef WIN32
if (mktemp(pipename)) if (mktemp(pipename))
{ {
@ -332,7 +332,7 @@ namespace Sysreg_
return false; return false;
} }
#ifdef __linux__ #ifndef WIN32
/* on linux we need get pid in order to be able /* on linux we need get pid in order to be able
* to terminate the emulator in case of errors * to terminate the emulator in case of errors
* on windows we can get pid as return of CreateProcess * on windows we can get pid as return of CreateProcess
@ -369,7 +369,7 @@ namespace Sysreg_
{ {
pipe = pipe.substr(0, pos); pipe = pipe.substr(0, pos);
} }
#ifdef __linux__ #ifndef WIN32
m_Src = pipe; m_Src = pipe;
#else #else
m_Src = "\\\\.\\pipe\\" + pipe.substr(0, pos); m_Src = "\\\\.\\pipe\\" + pipe.substr(0, pos);
@ -577,7 +577,7 @@ namespace Sysreg_
return false; return false;
} }
} }
#ifdef __linux__ #ifndef WIN32
if (mkfifo(m_Src.c_str(), 400)) if (mkfifo(m_Src.c_str(), 400))
{ {
/* /*
@ -802,7 +802,7 @@ namespace Sysreg_
cleanup(conf_parser); cleanup(conf_parser);
return false; return false;
} }
#ifdef __linux__ #ifndef WIN32
/* /*
* For linux systems we can only * For linux systems we can only
* check if the emulator runs by * check if the emulator runs by
@ -832,7 +832,7 @@ namespace Sysreg_
} }
#endif #endif
OsSupport::cancelAlarms(); OsSupport::cancelAlarms();
#ifdef __linux__ #ifndef WIN32
// OsSupport::setAlarm (m_MaxTime, m_Pid); // OsSupport::setAlarm (m_MaxTime, m_Pid);
// OsSupport::setAlarm(m_MaxTime, getpid()); // OsSupport::setAlarm(m_MaxTime, getpid());
#else #else

View file

@ -30,12 +30,12 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
#ifndef __linux__ #ifdef WIN32
#include <io.h> #include <io.h>
#include <errno.h> #include <errno.h>
#endif #endif
#ifdef __linux__ #ifndef WIN32
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#if defined(__FreeBSD__) || defined(__APPLE__) #if defined(__FreeBSD__) || defined(__APPLE__)

View file

@ -13,7 +13,7 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#ifndef __linux__ #ifdef WIN32
#define popen _popen #define popen _popen
#define pclose _pclose #define pclose _pclose
#endif #endif