MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / readline_simple

Function readline_simple

common/console.cpp:1046–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044 }
1045
1046 static bool readline_simple(std::string & line, bool multiline_input) {
1047#if defined(_WIN32)
1048 std::wstring wline;
1049 if (!std::getline(std::wcin, wline)) {
1050 // Input stream is bad or EOF received
1051 line.clear();
1052 GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
1053 return false;
1054 }
1055
1056 int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wline[0], (int)wline.size(), NULL, 0, NULL, NULL);
1057 line.resize(size_needed);
1058 WideCharToMultiByte(CP_UTF8, 0, &wline[0], (int)wline.size(), &line[0], size_needed, NULL, NULL);
1059#else
1060 if (!std::getline(std::cin, line)) {
1061 // Input stream is bad or EOF received
1062 line.clear();
1063 return false;
1064 }
1065#endif
1066 if (!line.empty()) {
1067 char last = line.back();
1068 if (last == '/') { // Always return control on '/' symbol
1069 line.pop_back();
1070 return false;
1071 }
1072 if (last == '\\') { // '\\' changes the default action
1073 line.pop_back();
1074 multiline_input = !multiline_input;
1075 }
1076 }
1077 line += '\n';
1078
1079 // By default, continue input if multiline_input is set
1080 return multiline_input;
1081 }
1082
1083 bool readline(std::string & line, bool multiline_input) {
1084 if (simple_io) {

Callers 1

readlineFunction · 0.85

Calls 4

clearMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected