Merge branch 'upstream-kwsys' into update-kwsys
This commit is contained in:
commit
588d705cb1
|
@ -428,6 +428,58 @@ const char* DynamicLoader::LastError()
|
|||
} // namespace KWSYS_NAMESPACE
|
||||
#endif
|
||||
|
||||
#ifdef __MINT__
|
||||
#define DYNAMICLOADER_DEFINED 1
|
||||
#define _GNU_SOURCE /* for program_invocation_name */
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <errno.h>
|
||||
#include <dld.h>
|
||||
|
||||
namespace KWSYS_NAMESPACE
|
||||
{
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname )
|
||||
{
|
||||
char *name = (char *)calloc(1, strlen(libname) + 1);
|
||||
dld_init(program_invocation_name);
|
||||
strncpy(name, libname, strlen(libname));
|
||||
dld_link(libname);
|
||||
return (void *)name;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
|
||||
{
|
||||
dld_unlink_by_file((char *)lib, 0);
|
||||
free(lib);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
|
||||
DynamicLoader::LibraryHandle lib, const char* sym)
|
||||
{
|
||||
// Hack to cast pointer-to-data to pointer-to-function.
|
||||
union
|
||||
{
|
||||
void* pvoid;
|
||||
DynamicLoader::SymbolPointer psym;
|
||||
} result;
|
||||
result.pvoid = dld_get_symbol(sym);
|
||||
return result.psym;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char* DynamicLoader::LastError()
|
||||
{
|
||||
return dld_strerror(dld_errno);
|
||||
}
|
||||
|
||||
} // namespace KWSYS_NAMESPACE
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// 6. Implementation for default UNIX machines.
|
||||
// if nothing has been defined then use this
|
||||
|
|
|
@ -399,7 +399,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr)
|
|||
if ( last_slash > 0 )
|
||||
{
|
||||
//kwsys_ios::cout << "I can skip: " << fexpr.substr(0, last_slash)
|
||||
//<< kwsys_ios::endl;
|
||||
// << kwsys_ios::endl;
|
||||
skip = last_slash;
|
||||
}
|
||||
if ( skip == 0 )
|
||||
|
|
|
@ -272,6 +272,7 @@ namespace KWSYS_NAMESPACE
|
|||
|
||||
// Create one public symbol in this object file to avoid warnings from
|
||||
// archivers.
|
||||
void IOStreamSymbolToAvoidWarning();
|
||||
void IOStreamSymbolToAvoidWarning()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ static inline void kwsysProcess_usleep(unsigned int msec)
|
|||
* pipes' file handles to be non-blocking and just poll them directly
|
||||
* without select().
|
||||
*/
|
||||
#if !defined(__BEOS__) && !defined(__VMS)
|
||||
#if !defined(__BEOS__) && !defined(__VMS) && !defined(__MINT__)
|
||||
# define KWSYSPE_USE_SELECT 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2466,7 +2466,9 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
|
|||
#endif
|
||||
}
|
||||
|
||||
void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
|
||||
#if USE_CPUID
|
||||
// Used only in USE_CPUID implementation below.
|
||||
static void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
|
||||
{
|
||||
// Because some manufacturers have leading white space - we have to post-process the name.
|
||||
kwsys_stl::string::size_type pos = str.find_first_not_of(" ");
|
||||
|
@ -2475,6 +2477,7 @@ void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
|
|||
str = str.substr(pos);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** */
|
||||
bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
|
||||
|
|
|
@ -3037,7 +3037,7 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path)
|
|||
path.erase(path.end()-1, path.end());
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
SystemToolsAppendComponents(
|
||||
kwsys_stl::vector<kwsys_stl::string>& out_components,
|
||||
kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
|
||||
|
@ -4704,7 +4704,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL,
|
|||
// ----------------------------------------------------------------------
|
||||
// These must NOT be initialized. Default initialization to zero is
|
||||
// necessary.
|
||||
unsigned int SystemToolsManagerCount;
|
||||
static unsigned int SystemToolsManagerCount;
|
||||
SystemToolsTranslationMap *SystemTools::TranslationMap;
|
||||
SystemToolsTranslationMap *SystemTools::LongPathMap;
|
||||
#ifdef __CYGWIN__
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
#include <stddef.h> /* size_t */
|
||||
#include <string.h> /* strcmp */
|
||||
|
||||
void* random_ptr = reinterpret_cast<void*>(0x123);
|
||||
static void* random_ptr = reinterpret_cast<void*>(0x123);
|
||||
|
||||
int argument(const char* arg, const char* value, void* call_data)
|
||||
static int argument(const char* arg, const char* value, void* call_data)
|
||||
{
|
||||
kwsys_ios::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << kwsys_ios::endl;
|
||||
if ( call_data != random_ptr )
|
||||
|
@ -37,7 +37,7 @@ int argument(const char* arg, const char* value, void* call_data)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int unknown_argument(const char* argument, void* call_data)
|
||||
static int unknown_argument(const char* argument, void* call_data)
|
||||
{
|
||||
kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl;
|
||||
if ( call_data != random_ptr )
|
||||
|
@ -48,12 +48,12 @@ int unknown_argument(const char* argument, void* call_data)
|
|||
return 1;
|
||||
}
|
||||
|
||||
bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; }
|
||||
bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
|
||||
bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
|
||||
bool CompareTwoItemsOnList(const char* i1,
|
||||
static bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; }
|
||||
static bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
|
||||
static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
|
||||
static bool CompareTwoItemsOnList(const char* i1,
|
||||
const char* i2) { return strcmp(i1, i2) == 0; }
|
||||
bool CompareTwoItemsOnList(const kwsys_stl::string& i1,
|
||||
static bool CompareTwoItemsOnList(const kwsys_stl::string& i1,
|
||||
const kwsys_stl::string& i2) { return i1 == i2; }
|
||||
|
||||
int testCommandLineArguments(int argc, char* argv[])
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// left on disk.
|
||||
#include <testSystemTools.h>
|
||||
|
||||
kwsys_stl::string GetLibName(const char* lname)
|
||||
static kwsys_stl::string GetLibName(const char* lname)
|
||||
{
|
||||
// Construct proper name of lib
|
||||
kwsys_stl::string slname;
|
||||
|
|
|
@ -47,7 +47,7 @@ int runChild(const char* cmd[], int state, int exception, int value,
|
|||
int share, int output, int delay, double timeout, int poll,
|
||||
int repeat, int disown);
|
||||
|
||||
int test1(int argc, const char* argv[])
|
||||
static int test1(int argc, const char* argv[])
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
fprintf(stdout, "Output on stdout from test returning 0.\n");
|
||||
|
@ -55,7 +55,7 @@ int test1(int argc, const char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test2(int argc, const char* argv[])
|
||||
static int test2(int argc, const char* argv[])
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
fprintf(stdout, "Output on stdout from test returning 123.\n");
|
||||
|
@ -63,7 +63,7 @@ int test2(int argc, const char* argv[])
|
|||
return 123;
|
||||
}
|
||||
|
||||
int test3(int argc, const char* argv[])
|
||||
static int test3(int argc, const char* argv[])
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
fprintf(stdout, "Output before sleep on stdout from timeout test.\n");
|
||||
|
@ -80,7 +80,7 @@ int test3(int argc, const char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test4(int argc, const char* argv[])
|
||||
static int test4(int argc, const char* argv[])
|
||||
{
|
||||
/* Prepare a pointer to an invalid address. Don't use null, because
|
||||
dereferencing null is undefined behaviour and compilers are free to
|
||||
|
@ -109,7 +109,7 @@ int test4(int argc, const char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test5(int argc, const char* argv[])
|
||||
static int test5(int argc, const char* argv[])
|
||||
{
|
||||
int r;
|
||||
const char* cmd[4];
|
||||
|
@ -132,7 +132,7 @@ int test5(int argc, const char* argv[])
|
|||
}
|
||||
|
||||
#define TEST6_SIZE (4096*2)
|
||||
void test6(int argc, const char* argv[])
|
||||
static void test6(int argc, const char* argv[])
|
||||
{
|
||||
int i;
|
||||
char runaway[TEST6_SIZE+1];
|
||||
|
@ -156,7 +156,7 @@ void test6(int argc, const char* argv[])
|
|||
delaying 1/10th of a second should ever have to poll. */
|
||||
#define MINPOLL 5
|
||||
#define MAXPOLL 20
|
||||
int test7(int argc, const char* argv[])
|
||||
static int test7(int argc, const char* argv[])
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
fprintf(stdout, "Output on stdout before sleep.\n");
|
||||
|
@ -176,7 +176,7 @@ int test7(int argc, const char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test8(int argc, const char* argv[])
|
||||
static int test8(int argc, const char* argv[])
|
||||
{
|
||||
/* Create a disowned grandchild to test handling of processes
|
||||
that exit before their children. */
|
||||
|
@ -200,7 +200,7 @@ int test8(int argc, const char* argv[])
|
|||
return r;
|
||||
}
|
||||
|
||||
int test8_grandchild(int argc, const char* argv[])
|
||||
static int test8_grandchild(int argc, const char* argv[])
|
||||
{
|
||||
(void)argc; (void)argv;
|
||||
fprintf(stdout, "Output on stdout from grandchild before sleep.\n");
|
||||
|
@ -221,7 +221,7 @@ int test8_grandchild(int argc, const char* argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
int runChild2(kwsysProcess* kp,
|
||||
static int runChild2(kwsysProcess* kp,
|
||||
const char* cmd[], int state, int exception, int value,
|
||||
int share, int output, int delay, double timeout,
|
||||
int poll, int disown)
|
||||
|
@ -505,7 +505,7 @@ int main(int argc, const char* argv[])
|
|||
fprintf(stderr, "Output on stderr after test %d.\n", n);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
#if _WIN32
|
||||
#if defined(_WIN32)
|
||||
if(argv0) { free(argv0); }
|
||||
#endif
|
||||
return r;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <string.h> /* strcmp */
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char* toUnixPaths[][2] =
|
||||
static const char* toUnixPaths[][2] =
|
||||
{
|
||||
{ "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
|
||||
{ "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
|
||||
|
@ -52,7 +52,7 @@ const char* toUnixPaths[][2] =
|
|||
{0, 0}
|
||||
};
|
||||
|
||||
bool CheckConvertToUnixSlashes(kwsys_stl::string input,
|
||||
static bool CheckConvertToUnixSlashes(kwsys_stl::string input,
|
||||
kwsys_stl::string output)
|
||||
{
|
||||
kwsys_stl::string result = input;
|
||||
|
@ -69,14 +69,14 @@ bool CheckConvertToUnixSlashes(kwsys_stl::string input,
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char* checkEscapeChars[][4] =
|
||||
static const char* checkEscapeChars[][4] =
|
||||
{
|
||||
{ "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2"},
|
||||
{ " {} ", "{}", "#", " #{#} "},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
bool CheckEscapeChars(kwsys_stl::string input,
|
||||
static bool CheckEscapeChars(kwsys_stl::string input,
|
||||
const char *chars_to_escape,
|
||||
char escape_char,
|
||||
kwsys_stl::string output)
|
||||
|
@ -95,7 +95,7 @@ bool CheckEscapeChars(kwsys_stl::string input,
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool CheckFileOperations()
|
||||
static bool CheckFileOperations()
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
|
@ -129,7 +129,7 @@ bool CheckFileOperations()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool CheckStringOperations()
|
||||
static bool CheckStringOperations()
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
|
@ -329,7 +329,7 @@ bool CheckStringOperations()
|
|||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
bool CheckPutEnv(const char* env, const char* name, const char* value)
|
||||
static bool CheckPutEnv(const char* env, const char* name, const char* value)
|
||||
{
|
||||
if(!kwsys::SystemTools::PutEnv(env))
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ bool CheckPutEnv(const char* env, const char* name, const char* value)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CheckUnPutEnv(const char* env, const char* name)
|
||||
static bool CheckUnPutEnv(const char* env, const char* name)
|
||||
{
|
||||
if(!kwsys::SystemTools::UnPutEnv(env))
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ bool CheckUnPutEnv(const char* env, const char* name)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CheckEnvironmentOperations()
|
||||
static bool CheckEnvironmentOperations()
|
||||
{
|
||||
bool res = true;
|
||||
res &= CheckPutEnv("A=B", "A", "B");
|
||||
|
|
Loading…
Reference in New Issue