[prev in list] [next in list] [prev in thread] [next in thread]
List: ecos-devel
Subject: ConfigTool
From: Simon Maurer <simon.maurer () bbv ! ch>
Date: 2010-02-12 13:06:56
Message-ID: A7B59F6D52627C44813C136D437B083203DED7116117 () TKSSREX01 ! outnet ! ch
[Download RAW message or body]
Hi folks,
Our Apparatus Framework Configtool (http://apfw.sourceforge.net/) is based on the \
eCos Configtool. Thanks a lot for this great tool. For the next release we have \
merged the new sources of the the eCos configtool to our version and fixed some bugs, \
which crashed the application. However, this is the patch which includes the \
bugfixes for the eCos Configtool (wxWidgets version). This patch changes the behavior \
of the path handling, so be careful. I build the Configtool with cygwin 1.7 on \
Windows 7. Maybe some future patches will follow.
kind regards,
Simon Maurer
Index: host/tools/configtool/common/common/build.cxx
===================================================================
--- host/tools/configtool/common/common/build.cxx (revision 1819)
+++ host/tools/configtool/common/common/build.cxx (revision 1831)
@@ -92,7 +92,7 @@
}
return output;
}
-
+/*
#if defined(_WIN32) || defined(__CYGWIN__)
// convert a filepath into a vector of path components
static void path_to_vector (std::string input, std::vector <std::string> & output) {
@@ -150,19 +150,21 @@
return input;
#endif
}
-
+*/
// convert a DOS filepath to a Cygwin filepath
std::string cygpath (const std::string input) {
#if defined(_WIN32) || defined(__CYGWIN__)
- // remove spaces from the DOS filepath
- const std::string path = nospace_path (input);
- std::string output;
+ // remove spaces from the DOS filepath
+ //const std::string path = nospace_path (input);
+ /* all strings which are used in build.cxx coming from \
ecUtils::NativeToPosixPath. This function rmoves spaces in the path. + Makefile \
doesn't work with paths containing spaces*/ + std::string output;
- // convert the DOS filepath to Cygwin notation using Cygwin if \
available +
+ //std::string strCygdrive("/cygdrive");
+ std::string strCygdrive("/");
#if defined(__CYGWIN__) && (ECOS_USE_CYGDRIVE == 0)
- char buffer [MAX_PATH + 1];
- cygwin_conv_to_posix_path (path.c_str (), buffer);
- output = buffer;
+ output = input;
#else
#if ECOS_USE_CYGDRIVE == 1
@@ -201,19 +203,23 @@
RegCloseKey(hKey);
}
#endif
- strCygdrive = strCygdrive + "/";
+ //strCygdrive = strCygdrive + "/";
- for (unsigned int n = 0; n < path.size (); n++) { // for each char
- if ((1 == n) && (':' == path [n])) { // if a DOS \
logical drive letter is present
- output = strCygdrive + (const char) \
tolower(path [0]); // convert to Cygwin notation
- } else {
- output += ('\\' == path [n]) ? '/' : \
path [n]; // convert backslash to slash
- }
- }
+ for (unsigned int n = 0; n < input.size (); n++) { // for each char
+ if ((1 == n) && (':' == input [n])) { // if a DOS logical drive letter is \
present + output = strCygdrive + output; // convert to Cygwin notation
+ } else {
+ output += ('\\' == input [n]) ? '/' : input [n]; // convert backslash to \
slash + }
+ }
#elif ECOS_USE_CYGDRIVE == 2
// Convert to c:/foo/bar notation
- for (unsigned int n = 0; n < path.size (); n++) { // for each char
- output += ('\\' == path [n]) ? '/' : \
path [n]; // convert backslash to slash +
+ char buffer[PATH_MAX];
+ cygwin_conv_to_win32_path(input.c_str(), buffer);
+
+ for (unsigned int n = 0; n < sizeof(buffer) && buffer[n] != '\0'; n++) { // for \
each char + output += ('\\' == buffer [n]) ? '/' : buffer [n]; // convert \
backslash to slash }
#elif ECOS_USE_CYGDRIVE == 3
// Convert to /ecos-x notation, assuming that this mount point will be created
@@ -221,39 +227,36 @@
std::string output1;
- if (path.size() > 1 && path[1] == ':')
- {
+ if (input.size() > 1 && input[1] == ':') {
output1 = "/ecos-";
- output1 += tolower(path[0]);
+ output1 += tolower(input[0]);
output1 += "/";
// Append the rest of the path
- if (path.size() > 2)
- {
+ if (input.size() > 2) {
unsigned int n = 2;
unsigned int i;
- if (path[n] == '\\' || path[n] == '/')
+ if (input[n] == '\\' || input[n] == '/')
n ++;
- for (i = n; i < path.size(); i++)
- output1 += path[i];
+ for (i = n; i < input.size(); i++)
+ output1 += input[i];
}
- }
- else
- output1 = path;
+ } else
+ output1 = input;
for (unsigned int n = 0; n < output1.size (); n++) { // for each char
output += ('\\' == output1 [n]) ? '/' : output1 [n]; // convert \
backslash to slash }
#else
- for (unsigned int n = 0; n < path.size (); n++) { // for each char
- if ((1 == n) && (':' == path [n])) { // if a DOS \
logical drive letter is present
- output = "//" + output; // convert to \
Cygwin notation
- } else {
- output += ('\\' == path [n]) ? '/' : \
path [n]; // convert backslash to slash
- }
- }
+ for (unsigned int n = 0; n < input.size (); n++) { // for each char
+ if ((1 == n) && (':' == input [n])) { // if a DOS logical drive letter is \
present + output = "//" + output; // convert to Cygwin notation
+ } else {
+ output += ('\\' == input [n]) ? '/' : input [n]; // convert backslash to \
slash + }
+ }
#endif
// ECOS_USE_CYGDRIVE
#endif
Index: host/tools/configtool/standalone/wxwin/configtooldoc.cpp
===================================================================
--- host/tools/configtool/standalone/wxwin/configtooldoc.cpp (revision \
1819)
+++ host/tools/configtool/standalone/wxwin/configtooldoc.cpp (revision 1831)
@@ -1158,11 +1158,11 @@
delete pItem;
} else if (bNowLoaded) {// if the package should be loaded
const wxString strVersion(dlg.GetVersion (strPackageName));
- if (bPreviouslyLoaded) { // if the package is already loaded
+ if (bPreviouslyLoaded && (m_items.Find(pItem) != NULL)) { // if the \
package is already loaded
CdlTransactionCallback::set_callback_fn (NULL); // avoid value \
refresh attempts during load/unload bChanged|=pItem->ChangeVersion(strVersion);
CdlTransactionCallback::set_callback_fn (CdlTransactionHandler); \
// restore value refresh
- } else {
+ } else if (!bPreviouslyLoaded) {
// the package was not loaded but should now be loaded
//TRACE (_T("Loading package %s\n"), strMacroName);
try
Index: host/tools/configtool/standalone/wxwin/ecutils.cpp
===================================================================
--- host/tools/configtool/standalone/wxwin/ecutils.cpp (revision 1819)
+++ host/tools/configtool/standalone/wxwin/ecutils.cpp (revision 1831)
@@ -55,6 +55,7 @@
#include "ecutils.h"
#include "wx/listctrl.h"
#include "wx/stream.h"
+#include "wx/vector.h"
#include <float.h> // for DBL_DIG macro
#include <sys/types.h>
@@ -258,6 +259,56 @@
}
#endif
+#if defined(__CYGWIN__)
+WX_DECLARE_VECTOR(wxString, StringVector);
+
+// convert a filepath into a vector of path components
+static void path_to_vector (wxString input, StringVector & output) {
+ wxString component;
+ output.clear ();
+
+ for (unsigned int n = 0; n < input.size (); n++) { // for each char in \
the path + if (('/' == input [n]) || ('\\' == input [n])) \
{ // if char is a directory separator + \
output.push_back (component); // add path component to output vector + \
component.erase (); // clear path component string + } \
else { // char is not a separator + \
component += input [n]; // add char to path component string + \
} + }
+ output.push_back (component); // add final path component to output \
vector +}
+
+// eliminate spaces from a DOS filepath by substituting the
+// short form of path components containing spaces
+wxString nospace_path (const wxString input) {
+ // split the path into a vector of path components
+ StringVector long_path_vector;
+ path_to_vector (input, long_path_vector);
+
+ // convert the path to its short form and split
+ // the result into a vector of path components
+ char buffer [MAX_PATH + 1];
+ GetShortPathNameA (input.c_str (), buffer, sizeof (buffer));
+ StringVector short_path_vector;
+ path_to_vector (buffer, short_path_vector);
+
+ // append the short or long form of each path component to the output string as \
appropriate + wxString output;
+ for (unsigned int n = 0; n < long_path_vector.size (); n++) { // for each \
component of the path + if ((long_path_vector [n].Find (' ') != wxNOT_FOUND) \
&& (n < short_path_vector.size ())) { // if there is a space in the path component + \
output += short_path_vector [n]; // add the short form of the path component + \
} else { // there is no space in the path component + output += \
long_path_vector [n]; // add the long form of the path component + }
+ output += '\\'; // add a directory separator
+ }
+ output.resize (output.size () - 1); // remove the trailing separator
+
+ return output;
+}
+#endif
+
+
const wxString ecUtils::NativeToPosixPath(const wxString & native)
{
#ifdef __CYGWIN__
@@ -266,7 +317,8 @@
else
{
wxString posix;
- cygwin_conv_to_posix_path(native.c_str(), posix.GetWriteBuf(PATH_MAX + 1));
+ posix = nospace_path (native); // replace any directories containing spaces \
with the short path variant + cygwin_conv_to_posix_path(posix.c_str(), \
posix.GetWriteBuf(PATH_MAX + 1)); posix.UngetWriteBuf();
return posix;
}
Index: host/tools/configtool/standalone/wxwin/configitem.cpp
===================================================================
--- host/tools/configtool/standalone/wxwin/configitem.cpp (revision 1819)
+++ host/tools/configtool/standalone/wxwin/configitem.cpp (revision 1831)
@@ -714,33 +714,19 @@
wxGetApp().GetTreeCtrl()->Delete(GetTreeItem());
-#if wxCHECK_VERSION(2, 6, 0)
wxNode* node = pDoc->GetItems().GetFirst();
while (node)
{
ecConfigItem* item = wxDynamicCast(node->GetData(), ecConfigItem);
- if (package == item->GetOwnerPackage() && item != this)
- {
- item->SetTreeItem(wxTreeItemId()); // Make sure we can't attempt to \
paint it
- item->SetCdlItem(NULL); // Make sure we can't access stale data
- delete item; // Delete the item itself
- }
+ //delete item removes itself from the list; => node points to a deallocated \
memmory node = node->GetNext();
- }
-#else
- wxNode* node = pDoc->GetItems().First();
- while (node)
- {
- ecConfigItem* item = wxDynamicCast(node->Data(), ecConfigItem);
if (package == item->GetOwnerPackage() && item != this)
{
- item->SetTreeItem(wxTreeItemId()); // Make sure we can't attempt to \
paint it + //item->SetTreeItem(wxTreeItemId()); // Make sure we can't \
attempt to paint it
item->SetCdlItem(NULL); // Make sure we can't access stale data
delete item; // Delete the item itself
}
- node = node->Next();
}
-#endif
const wxString strMacroName(GetMacro());
//TRACE (wxT("Unloading package %s\n"), strMacroName);
Index: host/tools/configtool/standalone/wxwin/aboutdlg.h
===================================================================
--- host/tools/configtool/standalone/wxwin/aboutdlg.h (revision 1819)
+++ host/tools/configtool/standalone/wxwin/aboutdlg.h (revision 1831)
@@ -74,7 +74,7 @@
* that's already been destroyed)
*/
-class WXDLLEXPORT ecSplashScreen: public wxSplashScreen
+class ecSplashScreen: public wxSplashScreen
{
public:
ecSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, \
wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const \
wxSize& size = wxDefaultSize, long style = \
wxSIMPLE_BORDER|wxFRAME_FLOAT_ON_PARENT);
Index: host/tools/configtool/standalone/wxwin/makefile.gnu
===================================================================
--- host/tools/configtool/standalone/wxwin/makefile.gnu (revision 1819)
+++ host/tools/configtool/standalone/wxwin/makefile.gnu (revision 1831)
@@ -45,30 +45,49 @@
CTBUILDDIR=$(shell pwd)
ECOSSRCDIR=$(INSTALLDIR)/src
CTDIR=$(ECOSSRCDIR)/tools/configtool/standalone/wxwin
+
+ifneq (,$(findstring CYGWIN, $(shell uname)))
TCLDIR=TCLDIR_use_system
+else
+ TCLDIRINC=/usr/include/tcl
+ TCLDIRLIB=/usr/lib
+endif
+
USEEXPERIMENTALCODE=1
-EXTRACPPFLAGS=\
+ifneq (,$(findstring CYGWIN, $(shell uname)))
+ EXTRACPPFLAGS=-I$(TCLDIR)/include
+else
+ EXTRACPPFLAGS=-I$(TCLDIRINC)
+endif
+
+EXTRACPPFLAGS+= \
-I$(TCLDIR)/include \
-I$(INSTALLDIR)/include \
-I$(ECOSSRCDIR)/tools/configtool/common/common \
-I$(ECOSSRCDIR)/tools/Utils/common \
-I$(ECOSSRCDIR)/tools/ecostest/common \
-DecUSE_EXPERIMENTAL_CODE=$(USEEXPERIMENTALCODE)
-EXTRALDFLAGS=-L$(TCLDIR)/lib -L$(INSTALLDIR)/lib -lcdl -lcyginfra -ltcl
+
+ifneq (,$(findstring CYGWIN, $(shell uname)))
+ EXTRALDFLAGS=-L$(TCLDIR)/lib -L$(INSTALLDIR)/lib -lcdl -ltcl
+else
+ EXTRALDFLAGS=-L$(TCLDIRLIB) -L$(INSTALLDIR)/lib -lcdl -ltcl
+endif
+
ifneq (,$(findstring CYGWIN, $(shell uname)))
PROGRAM=configtool.exe
- CPPFLAGS=`$(WXDIR)/bin/wx-config --cppflags` -D_WIN32 -D__WIN32__ -DSTRICT \
-D__USE_W32_SOCKETS
- LDFLAGS=`$(WXDIR)/bin/wx-config --libs std,gizmos` -lshlwapi \
-Wl,--subsystem,windows + CPPFLAGS=`$(WXDIR)/wx-config --static=yes --cppflags` \
-D_WIN32 -D__WIN32__ -DSTRICT -D__USE_W32_SOCKETS + LDFLAGS=`$(WXDIR)/wx-config \
--static=yes --libs std,gizmos` -lwsock32 -lcyginfra -lshlwapi \
-Wl,--subsystem,windows EXTRAOBJECTS=$(CTBUILDDIR)/configtoolres.o
- RCFLAGS=`$(WXDIR)/bin/wx-config --cppflags`
+ RCFLAGS=`$(WXDIR)/wx-config --static=yes --cppflags`
else
PROGRAM=configtool
- CPPFLAGS=`$(WXDIR)/bin/wx-config --cppflags`
- LDFLAGS=`$(WXDIR)/bin/wx-config --libs std,gizmos`
+ CPPFLAGS=`$(WXDIR)/wx-config --cppflags`
+ LDFLAGS=`$(WXDIR)/wx-config --libs std,gizmos`
EXTRAOBJECTS=
- RCFLAGS=`$(WXDIR)/bin/wx-config --cppflags`
+ RCFLAGS=`$(WXDIR)/wx-config --cppflags`
endif
ifeq "$(DEBUG)" ""
Index: host/tools/configtool/standalone/wxwin/configtree.cpp
===================================================================
--- host/tools/configtool/standalone/wxwin/configtree.cpp (revision 1819)
+++ host/tools/configtool/standalone/wxwin/configtree.cpp (revision 1831)
@@ -699,8 +699,8 @@
wxString msg;
msg.Printf("Popping at %d x %d", pt.x, pt.y);
wxLogDebug(msg);
-
- wxGetApp().GetHelpController().DisplayTextPopup(item->GetDescription(), \
wxGetMousePosition()); + if(wxGetApp().HasHelpController())
+ wxGetApp().GetHelpController().DisplayTextPopup(item->GetDescription(), \
wxGetMousePosition()); }
else
event.Skip();
Index: host/tools/ecostest/common/eCosTestPlatform.cpp
===================================================================
--- host/tools/ecostest/common/eCosTestPlatform.cpp (revision 1819)
+++ host/tools/ecostest/common/eCosTestPlatform.cpp (revision 1831)
@@ -30,6 +30,9 @@
#include "eCosTestUtils.h"
#include "eCosTrace.h"
+#include <limits.h>
+
+
std::vector<CeCosTestPlatform> CeCosTestPlatform::arPlatforms;
const CeCosTestPlatform *CeCosTestPlatform::Get(LPCTSTR psz)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic