1515#include < readline/readline.h>
1616#include < readline/history.h>
1717#else
18+ char * readline (const char * p)
19+ {
20+ std::string retval;
21+ std::cout << p ;
22+ std::getline (std::cin, retval);
23+ #ifdef BOOST_MSVC
24+ return std::cin.eof () ? NULL : _strdup (retval.c_str ());
25+ #else
26+ return std::cin.eof () ? NULL : strdup (retval.c_str ());
27+ #endif
28+ }
29+ void add_history (const char *){}
30+ void using_history (){}
31+ #endif
32+
1833
1934void *cast_module_symbol (std::string (*t_path)())
2035{
@@ -31,9 +46,9 @@ void *cast_module_symbol(std::string (*t_path)())
3146
3247std::string default_search_path ()
3348{
34- #ifdef CHAISCRIPT_WINDOWS
35- TCHAR path[2048 ];
36- int size = GetModuleFileName (0 , path, sizeof (path)-1 );
49+ #ifdef CHAISCRIPT_WINDOWS // force no unicode
50+ CHAR path[4096 ];
51+ int size = GetModuleFileNameA (0 , path, sizeof (path)-1 );
3752
3853 std::string exepath (path, size);
3954
@@ -95,21 +110,6 @@ std::string default_search_path()
95110}
96111
97112
98- char * readline (const char * p)
99- {
100- std::string retval;
101- std::cout << p ;
102- std::getline (std::cin, retval);
103- #ifdef BOOST_MSVC
104- return std::cin.eof () ? NULL : _strdup (retval.c_str ());
105- #else
106- return std::cin.eof () ? NULL : strdup (retval.c_str ());
107- #endif
108- }
109- void add_history (const char *){}
110- void using_history (){}
111- #endif
112-
113113void help (int n) {
114114 if ( n >= 0 ) {
115115 std::cout << " ChaiScript evaluator. To evaluate an expression, type it and press <enter>." << std::endl;
0 commit comments