diff --git a/src/main.cpp b/src/main.cpp index 5a99dae..163adbe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,21 @@ #include #include #else +char* readline(const char* p) +{ + std::string retval; + std::cout << p ; + std::getline(std::cin, retval); +#ifdef BOOST_MSVC + return std::cin.eof() ? NULL : _strdup(retval.c_str()); +#else + return std::cin.eof() ? NULL : strdup(retval.c_str()); +#endif +} +void add_history(const char*){} +void using_history(){} +#endif + void *cast_module_symbol(std::string (*t_path)()) { @@ -31,9 +46,9 @@ void *cast_module_symbol(std::string (*t_path)()) std::string default_search_path() { -#ifdef CHAISCRIPT_WINDOWS - TCHAR path[2048]; - int size = GetModuleFileName(0, path, sizeof(path)-1); +#ifdef CHAISCRIPT_WINDOWS // force no unicode + CHAR path[4096]; + int size = GetModuleFileNameA(0, path, sizeof(path)-1); std::string exepath(path, size); @@ -95,21 +110,6 @@ std::string default_search_path() } -char* readline(const char* p) -{ - std::string retval; - std::cout << p ; - std::getline(std::cin, retval); -#ifdef BOOST_MSVC - return std::cin.eof() ? NULL : _strdup(retval.c_str()); -#else - return std::cin.eof() ? NULL : strdup(retval.c_str()); -#endif -} -void add_history(const char*){} -void using_history(){} -#endif - void help(int n) { if ( n >= 0 ) { std::cout << "ChaiScript evaluator. To evaluate an expression, type it and press ." << std::endl;