Skip to content

Commit 9c35ede

Browse files
committed
2 parents 71348b7 + eb1a1c0 commit 9c35ede

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/main.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@
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

1934
void *cast_module_symbol(std::string (*t_path)())
2035
{
@@ -31,9 +46,9 @@ void *cast_module_symbol(std::string (*t_path)())
3146

3247
std::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-
113113
void 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

Comments
 (0)