- }
- else if ( start == wxT("QUIT") )
- {
- break; // get out of here!
- }
- else // !list
- {
- wxChar ch = ftp->SendCommand(buf);
- wxPrintf(wxT("Command %s"), ch ? wxT("succeeded") : wxT("failed"));
- if ( ch )
- {
- wxPrintf(wxT(" (return code %c)"), ch);
- }
-
- wxPrintf(wxT(", server reply:\n%s\n\n"), ftp->GetLastResult().c_str());
- }
- }
-
- wxPuts(wxT("\n"));
-}
-#endif // TEST_INTERACTIVE
-#endif // TEST_FTP
-
-// ----------------------------------------------------------------------------
-// stack backtrace
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_STACKWALKER
-
-#if wxUSE_STACKWALKER
-
-#include "wx/stackwalk.h"
-
-class StackDump : public wxStackWalker
-{
-public:
- StackDump(const char *argv0)
- : wxStackWalker(argv0)
- {
- }
-
- virtual void Walk(size_t skip = 1, size_t maxdepth = wxSTACKWALKER_MAX_DEPTH)
- {
- wxPuts(wxT("Stack dump:"));
-
- wxStackWalker::Walk(skip, maxdepth);
- }
-
-protected:
- virtual void OnStackFrame(const wxStackFrame& frame)
- {
- printf("[%2d] ", (int) frame.GetLevel());
-
- wxString name = frame.GetName();
- if ( !name.empty() )
- {
- printf("%-20.40s", (const char*)name.mb_str());
- }
- else
- {
- printf("0x%08lx", (unsigned long)frame.GetAddress());
- }
-
- if ( frame.HasSourceLocation() )
- {
- printf("\t%s:%d",
- (const char*)frame.GetFileName().mb_str(),
- (int)frame.GetLine());
- }
-
- puts("");
-
- wxString type, val;
- for ( size_t n = 0; frame.GetParam(n, &type, &name, &val); n++ )
- {
- printf("\t%s %s = %s\n", (const char*)type.mb_str(),
- (const char*)name.mb_str(),
- (const char*)val.mb_str());
- }
- }
-};
-
-static void TestStackWalk(const char *argv0)
-{
- wxPuts(wxT("*** Testing wxStackWalker ***"));
-
- StackDump dump(argv0);
- dump.Walk();
-
- wxPuts("\n");
-}
-
-#endif // wxUSE_STACKWALKER
-
-#endif // TEST_STACKWALKER
-
-// ----------------------------------------------------------------------------
-// standard paths
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_STDPATHS
-
-#include "wx/stdpaths.h"
-#include "wx/wxchar.h" // wxPrintf
-
-static void TestStandardPaths()
-{
- wxPuts(wxT("*** Testing wxStandardPaths ***"));
-
- wxTheApp->SetAppName(wxT("console"));
-
- wxStandardPathsBase& stdp = wxStandardPaths::Get();
- wxPrintf(wxT("Config dir (sys):\t%s\n"), stdp.GetConfigDir().c_str());
- wxPrintf(wxT("Config dir (user):\t%s\n"), stdp.GetUserConfigDir().c_str());
- wxPrintf(wxT("Data dir (sys):\t\t%s\n"), stdp.GetDataDir().c_str());
- wxPrintf(wxT("Data dir (sys local):\t%s\n"), stdp.GetLocalDataDir().c_str());
- wxPrintf(wxT("Data dir (user):\t%s\n"), stdp.GetUserDataDir().c_str());
- wxPrintf(wxT("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir().c_str());
- wxPrintf(wxT("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir().c_str());
- wxPrintf(wxT("Executable path:\t%s\n"), stdp.GetExecutablePath().c_str());
- wxPrintf(wxT("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir().c_str());
- wxPrintf(wxT("Resources dir:\t\t%s\n"), stdp.GetResourcesDir().c_str());
- wxPrintf(wxT("Localized res. dir:\t%s\n"),
- stdp.GetLocalizedResourcesDir(wxT("fr")).c_str());
- wxPrintf(wxT("Message catalogs dir:\t%s\n"),
- stdp.GetLocalizedResourcesDir
- (
- wxT("fr"),
- wxStandardPaths::ResourceCat_Messages
- ).c_str());
-
- wxPuts("\n");
-}
-
-#endif // TEST_STDPATHS
-
-// ----------------------------------------------------------------------------
-// wxVolume tests
-// ----------------------------------------------------------------------------
-
-#if !defined(__WIN32__) || !wxUSE_FSVOLUME
- #undef TEST_VOLUME
-#endif
-
-#ifdef TEST_VOLUME
-
-#include "wx/volume.h"
-
-static const wxChar *volumeKinds[] =
-{
- wxT("floppy"),
- wxT("hard disk"),
- wxT("CD-ROM"),
- wxT("DVD-ROM"),
- wxT("network volume"),
- wxT("other volume"),
-};
-
-static void TestFSVolume()
-{
- wxPuts(wxT("*** Testing wxFSVolume class ***"));
-
- wxArrayString volumes = wxFSVolume::GetVolumes();
- size_t count = volumes.GetCount();
-
- if ( !count )
- {
- wxPuts(wxT("ERROR: no mounted volumes?"));
- return;
- }
-
- wxPrintf(wxT("%u mounted volumes found:\n"), count);
-
- for ( size_t n = 0; n < count; n++ )
- {
- wxFSVolume vol(volumes[n]);
- if ( !vol.IsOk() )
- {
- wxPuts(wxT("ERROR: couldn't create volume"));
- continue;
- }
-
- wxPrintf(wxT("%u: %s (%s), %s, %s, %s\n"),
- n + 1,
- vol.GetDisplayName().c_str(),
- vol.GetName().c_str(),
- volumeKinds[vol.GetKind()],
- vol.IsWritable() ? wxT("rw") : wxT("ro"),
- vol.GetFlags() & wxFS_VOL_REMOVABLE ? wxT("removable")
- : wxT("fixed"));
- }
-
- wxPuts("\n");
-}
-
-#endif // TEST_VOLUME
-
-// ----------------------------------------------------------------------------
-// date time
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_DATETIME
-
-#include "wx/math.h"
-#include "wx/datetime.h"
-
-#if TEST_INTERACTIVE
-
-static void TestDateTimeInteractive()
-{
- wxPuts(wxT("\n*** interactive wxDateTime tests ***"));
-
- wxChar buf[128];
-
- for ( ;; )
- {
- wxPrintf(wxT("Enter a date (or 'quit' to escape): "));
- if ( !wxFgets(buf, WXSIZEOF(buf), stdin) )