// Added to keep the linker happy at step A malValuePtr readline(const String& prompt) { String input; if (s_readLine.get(prompt, input)) { return mal::string(input); } return mal::nilValue(); }
int main(int argc, char* argv[]) { String prompt = "user> "; String input; malEnvPtr replEnv(new malEnv); installCore(replEnv); installFunctions(replEnv); makeArgv(replEnv, argc - 2, argv + 2); if (argc > 1) { String filename = escape(argv[1]); safeRep(STRF("(load-file %s)", filename.c_str()), replEnv); return 0; } while (s_readLine.get(prompt, input)) { safeRep(input, replEnv); } return 0; }
int main(int argc, char* argv[]) { String prompt = "user> "; String input; installCore(replEnv); installFunctions(replEnv); makeArgv(replEnv, argc - 2, argv + 2); if (argc > 1) { String filename = escape(argv[1]); safeRep(STRF("(load-file %s)", filename.c_str()), replEnv); return 0; } while (s_readLine.get(prompt, input)) { String out = safeRep(input, replEnv); if (out.length() > 0) std::cout << out << "\n"; } return 0; }
int main(int argc, char* argv[]) { String prompt = "user> "; String input; malEnvPtr replEnv(new malEnv); installCore(replEnv); installFunctions(replEnv); while (s_readLine.get(prompt, input)) { String out; try { out = rep(input, replEnv); } catch (malEmptyInputException&) { continue; // no output } catch (String& s) { out = s; }; std::cout << out << "\n"; } return 0; }