[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi libRTI/RTIambassador.cc config.h.cmake CM...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi libRTI/RTIambassador.cc config.h.cmake CM... |
Date: |
Fri, 09 Oct 2009 21:13:56 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 09/10/09 21:13:56
Modified files:
libRTI : RTIambassador.cc
. : config.h.cmake CMakeLists.txt
RTIG : Federation.cc
Log message:
Merge in
patch #6938: Use CMAKE_INSTALL_PREFIX to find files certi installs there
from Mathias Fröhlich.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&r1=3.106&r2=3.107
http://cvs.savannah.gnu.org/viewcvs/certi/config.h.cmake?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/certi/CMakeLists.txt?cvsroot=certi&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.110&r2=3.111
Patches:
Index: libRTI/RTIambassador.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambassador.cc,v
retrieving revision 3.106
retrieving revision 3.107
diff -u -b -r3.106 -r3.107
--- libRTI/RTIambassador.cc 14 Sep 2009 20:51:51 -0000 3.106
+++ libRTI/RTIambassador.cc 9 Oct 2009 21:13:56 -0000 3.107
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambassador.cc,v 3.106 2009/09/14 20:51:51 erk Exp $
+// $Id: RTIambassador.cc,v 3.107 2009/10/09 21:13:56 erk Exp $
// ----------------------------------------------------------------------------
#include "RTI.hh"
@@ -31,8 +31,9 @@
#include "Message.hh"
#include "PrettyDebug.hh"
+#include "config.h"
+
#ifdef _WIN32
-#include <config.h>
#include <stdio.h>
#include <string.h>
#else
@@ -125,11 +126,16 @@
privateRefs->socketUn = new SocketUN(stIgnoreSignal);
privateRefs->is_reentrant = false ;
- const char *rtiaexec = "rtia" ;
- const char *rtiaenv = getenv("CERTI_RTIA");
- const char *rtiacall ;
- if (rtiaenv) rtiacall = rtiaenv ;
- else rtiacall = rtiaexec ;
+
+ std::vector<std::string> rtiaList;
+ const char* env = getenv("CERTI_RTIA");
+ if (env && strlen(env))
+ rtiaList.push_back(std::string(env));
+ env = getenv("CERTI_HOME");
+ if (env && strlen(env))
+ rtiaList.push_back(std::string(env) + "/bin/rtia");
+ rtiaList.push_back(PACKAGE_INSTALL_PREFIX "/bin/rtia");
+ rtiaList.push_back("rtia");
#if defined(RTIA_USE_TCP)
int port = privateRefs->socketUn->listenUN();
@@ -153,10 +159,7 @@
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
- std::stringstream stream;
-#if defined(RTIA_USE_TCP)
- stream << rtiacall << " -p " << port;
-#else
+#if !defined(RTIA_USE_TCP)
SOCKET newPipeFd;
if (!DuplicateHandle(GetCurrentProcess(),
(HANDLE)pipeFd,
@@ -168,12 +171,19 @@
D.Out( pdError, "Cannot duplicate socket for RTIA connection. Abort." );
throw RTI::RTIinternalError( "Cannot duplicate socket for RTIA connection.
Abort." );
}
+#endif
- stream << rtiacall << " -f " << newPipeFd;
+ bool success = false;
+ for (unsigned i = 0; i < rtiaList.size(); ++i) {
+ std::stringstream stream;
+#if defined(RTIA_USE_TCP)
+ stream << rtiaList[i] << ".exe -p " << port;
+#else
+ stream << rtiaList[i] << ".exe -f " << newPipeFd;
#endif
// Start the child process.
- if( !CreateProcess( NULL, // No module name (use command line).
+ if (CreateProcess( NULL, // No module name (use command line).
(char*)stream.str().c_str(), // Command line.
NULL, // Process handle not
inheritable.
NULL, // Thread handle not
inheritable.
@@ -183,12 +193,15 @@
NULL, // Use parent's starting
directory.
&si, // Pointer to STARTUPINFO
structure.
&pi )) // Pointer to
PROCESS_INFORMATION structure.
-
{
+ success = true;
+ break;
+ }
+ }
+ if (!success) {
msg << "CreateProcess - GetLastError()=<"
<< GetLastError() <<"> "
<< "Cannot connect to RTIA.exe";
- //perror("CreateProcess");
throw RTI::RTIinternalError( msg.str().c_str());
}
@@ -229,14 +242,15 @@
#endif
close(fd);
}
+ for (unsigned i = 0; i < rtiaList.size(); ++i)
{
std::stringstream stream;
#if defined(RTIA_USE_TCP)
stream << port;
- execlp(rtiacall, rtiacall, "-p", stream.str().c_str(), NULL);
+ execlp(rtiaList[i].c_str(), rtiaList[i].c_str(), "-p",
stream.str().c_str(), NULL);
#else
stream << pipeFd;
- execlp(rtiacall, rtiacall, "-f", stream.str().c_str(), NULL);
+ execlp(rtiaList[i].c_str(), rtiaList[i].c_str(), "-f",
stream.str().c_str(), NULL);
#endif
}
// unbock the above blocked signals
@@ -3017,4 +3031,4 @@
privateRefs->executeService(&req, &rep);
}
-// $Id: RTIambassador.cc,v 3.106 2009/09/14 20:51:51 erk Exp $
+// $Id: RTIambassador.cc,v 3.107 2009/10/09 21:13:56 erk Exp $
Index: config.h.cmake
===================================================================
RCS file: /sources/certi/certi/config.h.cmake,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- config.h.cmake 10 Oct 2008 07:34:53 -0000 1.3
+++ config.h.cmake 9 Oct 2009 21:13:56 -0000 1.4
@@ -75,6 +75,9 @@
/* Define to the one symbol short name of this package. */
#cmakedefine PACKAGE_TARNAME "@CPACK_PACKAGE_NAME@"
+/* Define to the install prefix. */
+#cmakedefine PACKAGE_INSTALL_PREFIX "@PACKAGE_INSTALL_PREFIX@"
+
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@
Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/CMakeLists.txt,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- CMakeLists.txt 14 Sep 2009 20:51:52 -0000 1.70
+++ CMakeLists.txt 9 Oct 2009 21:13:56 -0000 1.71
@@ -127,6 +127,8 @@
SET(VERSION ${PACKAGE_VERSION})
SET(PACKAGE_BUGREPORT "address@hidden")
+SET(PACKAGE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+
MESSAGE(STATUS "Configuring ${PACKAGE_NAME} version ${PACKAGE_VERSION}")
# FIND PACKAGEs
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.110
retrieving revision 3.111
diff -u -b -r3.110 -r3.111
--- RTIG/Federation.cc 16 Sep 2009 07:55:58 -0000 3.110
+++ RTIG/Federation.cc 9 Oct 2009 21:13:56 -0000 3.111
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: Federation.cc,v 3.110 2009/09/16 07:55:58 erk Exp $
+// $Id: Federation.cc,v 3.111 2009/10/09 21:13:56 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -91,8 +91,8 @@
*
* -# bare filename considered as a path provided through FEDid_name
* -# getenv(CERTI_HOME)+"/share/federations"+ FEDid_name
- * -# default (unix) installation place plus FEDid_name
- * "/usr/local/share/federation/" + FEDid_name
+ * -# installation place plus FEDid_name
+ * PACKAGE_INSTALL_PREFIX + "/share/federation/" + FEDid_name
*/
#ifdef FEDERATION_USES_MULTICAST
@@ -163,8 +163,8 @@
//
// 2 - getenv(CERTI_HOME)+"/share/federations"+ FEDid_name
//
- // 3 - default (unix) installation place plus FEDid_name
- // "/usr/local/share/federation/" + FEDid_name
+ // 3 - Installation place plus FEDid_name
+ // PACKAGE_INSTALL_PREFIX + "/share/federation/" + FEDid_name
//
string filename = FEDid;
bool filefound = false;
@@ -200,18 +200,18 @@
}
filefound = (0==STAT_FUNCTION(filename.c_str(),&file_stat));
}
-#else
+
if (!filefound) {
if (verboseLevel>0) {
cout << " --> cannot access." <<endl;
}
- filename = "/usr/local/share/federations/"+string(FEDid_name);
+ filename = PACKAGE_INSTALL_PREFIX
"\\share\\federations\\"+string(FEDid_name);
if (verboseLevel>0) {
cout << " Now trying..." << filename;
}
filefound = (0==STAT_FUNCTION(filename.c_str(),&file_stat));
}
-
+#else
if (!filefound && (NULL!=getenv("CERTI_HOME"))) {
if (verboseLevel>0) {
cout << " --> cannot access." <<endl;
@@ -222,6 +222,17 @@
}
filefound = (0==STAT_FUNCTION(filename.c_str(),&file_stat));
}
+
+ if (!filefound) {
+ if (verboseLevel>0) {
+ cout << " --> cannot access." <<endl;
+ }
+ filename = PACKAGE_INSTALL_PREFIX
"/share/federations/"+string(FEDid_name);
+ if (verboseLevel>0) {
+ cout << " Now trying..." << filename;
+ }
+ filefound = (0==STAT_FUNCTION(filename.c_str(),&file_stat));
+ }
#endif
if (!filefound) {
@@ -2455,7 +2466,7 @@
cur = cur->xmlChildrenNode ;
- bool status ;
+ bool status = false;
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, NODE_FEDERATE))) {
for (FederateList::iterator i = federates.begin(); i !=
federates.end(); ++i) {
@@ -2580,5 +2591,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.110 2009/09/16 07:55:58 erk Exp $
+// $Id: Federation.cc,v 3.111 2009/10/09 21:13:56 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi libRTI/RTIambassador.cc config.h.cmake CM...,
certi-cvs <=