From ac21c8b0631e807bd4f301d37a1b443a0692ee72 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Tue, 7 Jan 2014 17:35:58 -0600 Subject: [PATCH] fix building main.cpp when readline is available This changes around the pragma conditionals to make sure that certain symbols (such as "default_search_path") are defined even if the system has readline available during builds. --- src/main.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0a84cd09..edb19a6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,18 @@ char *mystrdup (const char *s) { return d; // Return the new string } +char* readline(const char* p) +{ + std::string retval; + std::cout << p ; + std::getline(std::cin, retval); + return std::cin.eof() ? NULL : mystrdup(retval.c_str()); +} + +void add_history(const char*){} +void using_history(){} +#endif + void *cast_module_symbol(std::string (*t_path)()) { union cast_union @@ -101,19 +113,6 @@ std::string default_search_path() #endif } - -char* readline(const char* p) -{ - std::string retval; - std::cout << p ; - std::getline(std::cin, retval); - return std::cin.eof() ? NULL : mystrdup(retval.c_str()); -} - -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;