ConfigFile.cpp now compiles (needed another stdlib mapping, _wcsnicmp(), and to change an assignment to a constructor call)
This commit is contained in:
Родитель
575339add8
Коммит
2d045268d1
|
@ -222,7 +222,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
for (auto iter = readerConfig.begin(); iter != readerConfig.end(); ++iter)
|
||||
{
|
||||
auto pair = *iter;
|
||||
ConfigParameters temp = iter->second;
|
||||
ConfigParameters temp (iter->second);
|
||||
// see if we have a config parameters that contains a "dim" element, it's a sub key, use it
|
||||
if (temp.ExistsCurrent("dim"))
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
for (auto iter = config.begin(); iter != config.end(); ++iter)
|
||||
{
|
||||
auto pair = *iter;
|
||||
ConfigParameters temp = iter->second;
|
||||
ConfigParameters temp (iter->second);
|
||||
// see if we have a config parameters that contains a "key" element, if so use it
|
||||
if (temp.ExistsCurrent(key))
|
||||
{
|
||||
|
|
|
@ -146,13 +146,14 @@ msra::strfun::cstring charpath (const std::wstring & p)
|
|||
}
|
||||
static inline FILE* _wfopen (const wchar_t * path, const wchar_t * mode) { return fopen(charpath(path), charpath(mode)); }
|
||||
// --- basic string functions
|
||||
static inline wchar_t* wcstok_s (wchar_t* s, const wchar_t* delim, wchar_t** ptr) { return ::wcstok(s, delim, ptr); }
|
||||
static inline int _stricmp (const char * a, const char * b) { return ::strcasecmp (a, b); }
|
||||
static inline int _strnicmp (const char * a, const char * b, wchar_t n) { return ::strncasecmp (a, b, n); }
|
||||
static inline int _wcsicmp (const wchar_t * a, const wchar_t * b) { return ::wcscasecmp (a, b); }
|
||||
static inline int64_t _strtoi64 (const char * s, char ** ep, int r) { return strtoll (s, ep, r); } // TODO: check if correct
|
||||
static inline uint64_t _strtoui64 (const char * s, char ** ep, int r) { return strtoull (s, ep, r); } // TODO: correct for size_t?
|
||||
// -- other
|
||||
static inline wchar_t* wcstok_s (wchar_t* s, const wchar_t* delim, wchar_t** ptr) { return ::wcstok(s, delim, ptr); }
|
||||
static inline int _stricmp (const char * a, const char * b) { return ::strcasecmp (a, b); }
|
||||
static inline int _strnicmp (const char * a, const char * b, size_t n) { return ::strncasecmp (a, b, n); }
|
||||
static inline int _wcsicmp (const wchar_t * a, const wchar_t * b) { return ::wcscasecmp (a, b); }
|
||||
static inline int _wcsnicmp (const wchar_t * a, const wchar_t * b, size_t n) { return ::wcsncasecmp (a, b, n); }
|
||||
static inline int64_t _strtoi64 (const char * s, char ** ep, int r) { return strtoll (s, ep, r); } // TODO: check if correct
|
||||
static inline uint64_t _strtoui64 (const char * s, char ** ep, int r) { return strtoull (s, ep, r); } // TODO: correct for size_t?
|
||||
// -- other
|
||||
static inline void Sleep (size_t ms) { std::this_thread::sleep_for (std::chrono::milliseconds (ms)); }
|
||||
#endif
|
||||
|
||||
|
@ -976,41 +977,41 @@ static inline bool LogicError(const char * format, ...)
|
|||
vsprintf(buffer, format, args);
|
||||
throw std::logic_error(buffer);
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// dynamic loading of modules
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef _WIN32
|
||||
class Plugin
|
||||
{
|
||||
HMODULE m_hModule; // module handle for the writer DLL
|
||||
std::wstring m_dllName; // name of the writer DLL
|
||||
public:
|
||||
Plugin() { m_hModule = NULL; }
|
||||
FARPROC Load(const std::string & plugin, const std::string & proc)
|
||||
{
|
||||
m_dllName = msra::strfun::utf16(plugin);
|
||||
m_dllName += L".dll";
|
||||
m_hModule = LoadLibrary(m_dllName.c_str());
|
||||
if (m_hModule == NULL)
|
||||
RuntimeError("Plugin not found: %s", msra::strfun::utf8(m_dllName));
|
||||
|
||||
// create a variable of each type just to call the proper templated version
|
||||
return GetProcAddress(m_hModule, proc.c_str());
|
||||
}
|
||||
~Plugin() { if (m_hModule) FreeLibrary(m_hModule); }
|
||||
};
|
||||
#else
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
void * Load(const std::string & plugin, const std::string & proc)
|
||||
{
|
||||
RuntimeError("Plugins not implemented on Linux yet");
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
class Plugin
|
||||
{
|
||||
HMODULE m_hModule; // module handle for the writer DLL
|
||||
std::wstring m_dllName; // name of the writer DLL
|
||||
public:
|
||||
Plugin() { m_hModule = NULL; }
|
||||
FARPROC Load(const std::string & plugin, const std::string & proc)
|
||||
{
|
||||
m_dllName = msra::strfun::utf16(plugin);
|
||||
m_dllName += L".dll";
|
||||
m_hModule = LoadLibrary(m_dllName.c_str());
|
||||
if (m_hModule == NULL)
|
||||
RuntimeError("Plugin not found: %s", msra::strfun::utf8(m_dllName));
|
||||
|
||||
// create a variable of each type just to call the proper templated version
|
||||
return GetProcAddress(m_hModule, proc.c_str());
|
||||
}
|
||||
~Plugin() { if (m_hModule) FreeLibrary(m_hModule); }
|
||||
};
|
||||
#else
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
void * Load(const std::string & plugin, const std::string & proc)
|
||||
{
|
||||
RuntimeError("Plugins not implemented on Linux yet");
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _BASETYPES_
|
||||
|
|
Загрузка…
Ссылка в новой задаче