|
From: <gb...@us...> - 2008-07-02 08:26:58
|
Revision: 250
http://gearbox.svn.sourceforge.net/gearbox/?rev=250&view=rev
Author: gbiggs
Date: 2008-07-02 01:27:03 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Fixed compilation of flexiport and hokuyo_aist on Windows and with GCC 4.3.
Modified Paths:
--------------
gearbox/trunk/submitted/flexiport/CMakeLists.txt
gearbox/trunk/submitted/flexiport/logfile.cpp
gearbox/trunk/submitted/flexiport/port.cpp
gearbox/trunk/submitted/flexiport/port.h
gearbox/trunk/submitted/flexiport/serialport.cpp
gearbox/trunk/submitted/flexiport/tcpport.cpp
gearbox/trunk/submitted/flexiport/test/serial_example.cpp
gearbox/trunk/submitted/flexiport/test/tcp_example.cpp
gearbox/trunk/submitted/flexiport/timeout.cpp
gearbox/trunk/submitted/flexiport/timeout.h
gearbox/trunk/submitted/flexiport/utils/porttoport.cpp
gearbox/trunk/submitted/hokuyo_aist/CMakeLists.txt
gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.cpp
gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h
gearbox/trunk/submitted/hokuyo_aist/test/example.cpp
Modified: gearbox/trunk/submitted/flexiport/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/flexiport/CMakeLists.txt 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/CMakeLists.txt 2008-07-02 08:27:03 UTC (rev 250)
@@ -9,7 +9,12 @@
OPTION (FLEXIPORT_INCLUDE_SERIAL "Include the serial port in FlexiPort" ON)
OPTION (FLEXIPORT_INCLUDE_TCP "Include the TCP network port in FlexiPort" ON)
- OPTION (FLEXIPORT_INCLUDE_LOGGING "Include the log reader/writer ports in FlexiPort" ON)
+ IF (GBX_OS_WIN)
+ SET (FLEXIPORT_INCLUDE_LOGGING OFF)
+ MESSAGE (STATUS "Flexiport log file system is not currently supported on Windows.")
+ ELSE (GBX_OS_WIN)
+ OPTION (FLEXIPORT_INCLUDE_LOGGING "Include the log reader/writer ports in FlexiPort" ON)
+ ENDIF (GBX_OS_WIN)
MARK_AS_ADVANCED (FLEXIPORT_INCLUDE_SERIAL FLEXIPORT_INCLUDE_TCP)
SET (flexiport_config_h_in ${CMAKE_CURRENT_SOURCE_DIR}/flexiport_config.h.in)
@@ -28,12 +33,8 @@
SET (srcs ${srcs} tcpport.cpp)
ENDIF (FLEXIPORT_INCLUDE_TCP)
IF (FLEXIPORT_INCLUDE_LOGGING)
- IF (NOT GBX_OS_WIN)
- SET (hdrs ${hdrs} logwriterport.h logreaderport.h)
- SET (srcs ${srcs} logwriterport.cpp logreaderport.cpp logfile.cpp)
- ELSE (NOT GBX_OS_WIN)
- MESSAGE (STATUS "Flexiport log file system is not currently supported on Windows.")
- ENDIF (NOT GBX_OS_WIN)
+ SET (hdrs ${hdrs} logwriterport.h logreaderport.h)
+ SET (srcs ${srcs} logwriterport.cpp logreaderport.cpp logfile.cpp)
ENDIF (FLEXIPORT_INCLUDE_LOGGING)
IF (WIN32)
Modified: gearbox/trunk/submitted/flexiport/logfile.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/logfile.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/logfile.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -28,6 +28,8 @@
#include "flexiport.h"
#include "logfile.h"
+#include <cstdlib>
+#include <cstring>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/stat.h>
Modified: gearbox/trunk/submitted/flexiport/port.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/port.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/port.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -28,6 +28,7 @@
#include "port.h"
#include "flexiport.h"
+#include <cstring>
#include <assert.h>
#include <errno.h>
#include <time.h>
Modified: gearbox/trunk/submitted/flexiport/port.h
===================================================================
--- gearbox/trunk/submitted/flexiport/port.h 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/port.h 2008-07-02 08:27:03 UTC (rev 250)
@@ -33,6 +33,12 @@
#if defined (WIN32)
typedef unsigned char uint8_t;
+ typedef unsigned int uint32_t;
+ #if defined (_WIN64)
+ typedef __int64 ssize_t;
+ #else
+ typedef _W64 int ssize_t;
+ #endif
#if defined (FLEXIPORT_EXPORTS)
#define FLEXIPORT_EXPORT __declspec (dllexport)
#else
Modified: gearbox/trunk/submitted/flexiport/serialport.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/serialport.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/serialport.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -40,6 +40,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <cstring>
#include <sstream>
#include <iostream>
using namespace std;
Modified: gearbox/trunk/submitted/flexiport/tcpport.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/tcpport.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/tcpport.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -264,8 +264,13 @@
while (receivedBytes < count)
{
+#if defined (WIN32)
numReceived = recv (_sock, &(reinterpret_cast<char*> (buffer)[receivedBytes]),
+ count, 0); // No MSG_WAITALL on older versions of visual c, it seems
+#else
+ numReceived = recv (_sock, &(reinterpret_cast<char*> (buffer)[receivedBytes]),
count, MSG_WAITALL);
+#endif
if (_debug >= 2)
cerr << "TCPPort::" << __func__ << "() Received " << numReceived << " bytes" << endl;
if (numReceived < 0)
Modified: gearbox/trunk/submitted/flexiport/test/serial_example.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/test/serial_example.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/test/serial_example.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -54,12 +54,12 @@
int main (int argc, char **argv)
{
- int opt;
string portOptions = "type=serial,device=/dev/ttyS0,timeout=1";
#if defined (WIN32)
portOptions = "type=serial,device=COM1,timeout=1";
#else
+ int opt;
// Get some options from the command line
while ((opt = getopt (argc, argv, "o:")) != -1)
{
Modified: gearbox/trunk/submitted/flexiport/test/tcp_example.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/test/tcp_example.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/test/tcp_example.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -180,12 +180,12 @@
int main (int argc, char **argv)
{
- int opt;
string portOptions;
#if defined (WIN32)
portOptions = "";
#else
+ int opt;
// Get some options from the command line
while ((opt = getopt (argc, argv, "o:")) != -1)
{
Modified: gearbox/trunk/submitted/flexiport/timeout.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/timeout.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/timeout.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -25,7 +25,13 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
-#include <time.h>
+#if defined (WIN32)
+ #include <time.h>
+ // timeval is only in WinSock (stupidity)
+ #include <winsock2.h>
+#else
+ #include <sys/time.h>
+#endif
#include "timeout.h"
Modified: gearbox/trunk/submitted/flexiport/timeout.h
===================================================================
--- gearbox/trunk/submitted/flexiport/timeout.h 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/timeout.h 2008-07-02 08:27:03 UTC (rev 250)
@@ -32,6 +32,12 @@
#include <string>
#if defined (WIN32)
+ // No timespec on Windows
+ typedef struct timespec
+ {
+ int tv_sec;
+ int tv_nsec;
+ } timespec;
#if defined (FLEXIPORT_EXPORTS)
#define FLEXIPORT_EXPORT __declspec (dllexport)
#else
Modified: gearbox/trunk/submitted/flexiport/utils/porttoport.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/utils/porttoport.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/flexiport/utils/porttoport.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -25,6 +25,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
+#include <cstdlib>
#include <unistd.h>
#include <iostream>
#include <sstream>
Modified: gearbox/trunk/submitted/hokuyo_aist/CMakeLists.txt
===================================================================
--- gearbox/trunk/submitted/hokuyo_aist/CMakeLists.txt 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/hokuyo_aist/CMakeLists.txt 2008-07-02 08:27:03 UTC (rev 250)
@@ -12,10 +12,10 @@
INCLUDE (${GBX_CMAKE_DIR}/UseBasicRules.cmake)
SET (hdrs hokuyo_aist.h)
- SET (srcs hokuyo_aist.cpp)
+ SET (srcs hokuyo_aist.cpp)
IF (WIN32)
- ADD_DEFINITIONS (-DURG_NZ_EXPORTS)
+ ADD_DEFINITIONS (-DHOKUYO_AIST_EXPORTS)
ENDIF (WIN32)
GBX_ADD_LIBRARY (${libName} SHARED ${srcs})
TARGET_LINK_LIBRARIES (${libName} ${reqLibs})
Modified: gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.cpp
===================================================================
--- gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -31,6 +31,8 @@
#include <flexiport/flexiport.h>
#include <flexiport/port.h>
#include <flexiport/serialport.h>
+
+#include <cstring>
#include <stdarg.h>
#include <stdlib.h>
#include <errno.h>
@@ -1053,7 +1055,7 @@
else if (_scipVersion == 2)
{
// Sanity check the value
- if (speed > 10 & speed != 99)
+ if (speed > 10 && speed != 99)
throw HokuyoError (HOKUYO_ERR_BADARG, "Invalid motor speed.");
char buffer[3];
if (speed == 0)
@@ -1954,7 +1956,7 @@
{
SendCommand ("V", NULL, 0, NULL);
}
- catch (HokuyoError &e)
+ catch (HokuyoError)
{
// That didn't work too well...
if (_verbose)
@@ -1973,7 +1975,7 @@
{
SendCommand ("VV", NULL, 0, NULL);
}
- catch (HokuyoError &e)
+ catch (HokuyoError)
{
throw HokuyoError (HOKUYO_ERR_SCIPVERSION, "SCIP versions 1 and 2 failed.");
}
@@ -2068,7 +2070,7 @@
{
SendCommand ("S", "CIP2.0", 6, NULL);
}
- catch (HokuyoError &e)
+ catch (HokuyoError)
{
if (_verbose)
cerr << "HokuyoLaser::" << __func__ <<
Modified: gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h
===================================================================
--- gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/hokuyo_aist/hokuyo_aist.h 2008-07-02 08:27:03 UTC (rev 250)
@@ -33,6 +33,7 @@
#if defined (WIN32)
typedef unsigned char uint8_t;
+ typedef unsigned int uint32_t;
#if defined (HOKUYO_AIST_EXPORTS)
#define HOKUYO_AIST_EXPORT __declspec (dllexport)
#else
Modified: gearbox/trunk/submitted/hokuyo_aist/test/example.cpp
===================================================================
--- gearbox/trunk/submitted/hokuyo_aist/test/example.cpp 2008-07-02 05:06:14 UTC (rev 249)
+++ gearbox/trunk/submitted/hokuyo_aist/test/example.cpp 2008-07-02 08:27:03 UTC (rev 250)
@@ -35,13 +35,14 @@
{
string portOptions = "type=serial,device=/dev/ttyACM0,timeout=1";
double startAngle = 0.0, endAngle = 0.0;
- int opt, firstStep = -1, lastStep = -1;
+ int firstStep = -1, lastStep = -1;
unsigned int baud = 19200, speed = 0, clusterCount = 1;
bool getNew = false, verbose = false;
#if defined (WIN32)
portOptions = "type=serial,device=COM3,timeout=1";
#else
+ int opt;
// Get some options from the command line
while ((opt = getopt(argc, argv, "b:c:e:f:l:m:no:s:vh")) != -1)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|