/////////////////////////////////////////////////////////////////////////////
// Name: samples/console/console.cpp
-// Purpose: a sample console (as opposed to GUI) progam using wxWidgets
+// Purpose: A sample console (as opposed to GUI) program using wxWidgets
// Author: Vadim Zeitlin
// Modified by:
// Created: 04.10.99
#define TEST_CMDLINE
#define TEST_DATETIME
#define TEST_DIR
- #define TEST_DLLLOADER
+ #define TEST_DYNLIB
#define TEST_ENVIRON
#define TEST_EXECUTE
#define TEST_FILE
#define TEST_WCHAR
#define TEST_ZIP
#else // #if TEST_ALL
- #define TEST_STACKWALKER
+ #define TEST_STDPATHS
#endif
// some tests are interactive, define this to run them
#ifdef __UNIX__
static const wxChar *ROOTDIR = _T("/");
static const wxChar *TESTDIR = _T("/usr/local/share");
-#elif defined(__WXMSW__)
+#elif defined(__WXMSW__) || defined(__DOS__) || defined(__OS2__)
static const wxChar *ROOTDIR = _T("c:\\");
static const wxChar *TESTDIR = _T("d:\\");
#else
wxPuts(wxEmptyString);
}
+#if TEST_ALL
+
static void TestDirEnum()
{
wxPuts(_T("*** Testing wxDir::GetFirst/GetNext ***"));
TestDirEnumHelper(dirNo);
}
+#endif // TEST_ALL
+
class DirPrintTraverser : public wxDirTraverser
{
public:
dir.Traverse(traverser, wxEmptyString, wxDIR_DIRS | wxDIR_HIDDEN);
}
+#if TEST_ALL
+
static void TestDirExists()
{
wxPuts(_T("*** Testing wxDir::Exists() ***"));
}
}
+#endif // TEST_ALL
+
#endif // TEST_DIR
// ----------------------------------------------------------------------------
// wxDllLoader
// ----------------------------------------------------------------------------
-#ifdef TEST_DLLLOADER
+#ifdef TEST_DYNLIB
#include "wx/dynlib.h"
}
else
{
- typedef int (*wxStrlenType)(const char *);
+ typedef int (wxSTDCALL *wxStrlenType)(const char *);
wxStrlenType pfnStrlen = (wxStrlenType)lib.GetSymbol(FUNC_NAME);
if ( !pfnStrlen )
{
wxPuts(_T("... ok"));
}
}
+
+#ifdef __WXMSW__
+ static const wxChar *FUNC_NAME_AW = _T("lstrlen");
+
+ typedef int (wxSTDCALL *wxStrlenTypeAorW)(const wxChar *);
+ wxStrlenTypeAorW
+ pfnStrlenAorW = (wxStrlenTypeAorW)lib.GetSymbolAorW(FUNC_NAME_AW);
+ if ( !pfnStrlenAorW )
+ {
+ wxPrintf(_T("ERROR: function '%s' wasn't found in '%s'.\n"),
+ FUNC_NAME_AW, LIB_NAME);
+ }
+ else
+ {
+ if ( pfnStrlenAorW(_T("foobar")) != 6 )
+ {
+ wxPrintf(_T("ERROR: loaded function is not wxStrlen()!\n"));
+ }
+ }
+#endif // __WXMSW__
}
}
#endif
-#endif // TEST_DLLLOADER
+#endif // TEST_DYNLIB
// ----------------------------------------------------------------------------
// wxGet/SetEnv
#ifdef TEST_FILETIME
-#include <wx/filename.h>
-#include <wx/datetime.h>
+#include "wx/filename.h"
+#include "wx/datetime.h"
static void TestFileGetTimes()
{
#ifdef TEST_ODBC
-#include <wx/db.h>
+#include "wx/db.h"
static void TestDbOpen()
{
wxON_BLOCK_EXIT2(function2, 3.14, 'p');
Object obj;
- wxON_BLOCK_EXIT_OBJ0(obj, &Object::method0);
- wxON_BLOCK_EXIT_OBJ1(obj, &Object::method1, 7);
- wxON_BLOCK_EXIT_OBJ2(obj, &Object::method2, 2.71, 'e');
+ wxON_BLOCK_EXIT_OBJ0(obj, Object::method0);
+ wxON_BLOCK_EXIT_OBJ1(obj, Object::method1, 7);
+ wxON_BLOCK_EXIT_OBJ2(obj, Object::method2, 2.71, 'e');
wxScopeGuard dismissed = wxMakeGuard(function0);
dismissed.Dismiss();
wxPrintf(_T("Data dir (sys local):\t%s\n"), stdp.GetLocalDataDir().c_str());
wxPrintf(_T("Data dir (user):\t%s\n"), stdp.GetUserDataDir().c_str());
wxPrintf(_T("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir().c_str());
+ wxPrintf(_T("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir().c_str());
wxPrintf(_T("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir().c_str());
+ wxPrintf(_T("Resources dir:\t\t%s\n"), stdp.GetResourcesDir().c_str());
+ wxPrintf(_T("Localized res. dir:\t%s\n"),
+ stdp.GetLocalizedResourcesDir(_T("fr")).c_str());
+ wxPrintf(_T("Message catalogs dir:\t%s\n"),
+ stdp.GetLocalizedResourcesDir
+ (
+ _T("fr"),
+ wxStandardPaths::ResourceCat_Messages
+ ).c_str());
}
#endif // TEST_STDPATHS
wxPrintf(_T("Full name from wxVCard API: %s\n"), value.c_str());
- // now show how to deal with multiply occuring properties
+ // now show how to deal with multiply occurring properties
DumpVCardAddresses(vcard);
DumpVCardPhoneNumbers(vcard);
TestDirTraverse();
#endif // TEST_DIR
-#ifdef TEST_DLLLOADER
+#ifdef TEST_DYNLIB
TestDllLoad();
TestDllListLoaded();
-#endif // TEST_DLLLOADER
+#endif // TEST_DYNLIB
#ifdef TEST_ENVIRON
TestEnvironment();
wxUnusedVar(argv);
return 0;
}
-