llvm/lldb/source/Core/IOHandler.cpp

//===-- IOHandler.cpp -----------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Core/IOHandler.h"

#if defined(__APPLE__)
#include <deque>
#endif
#include <string>

#include "lldb/Core/Debugger.h"
#include "lldb/Host/Config.h"
#include "lldb/Host/File.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Utility/AnsiTerminal.h"
#include "lldb/Utility/Predicate.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-forward.h"

#if LLDB_ENABLE_LIBEDIT
#include "lldb/Host/Editline.h"
#endif
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "llvm/ADT/StringRef.h"

#ifdef _WIN32
#include "lldb/Host/windows/windows.h"
#endif

#include <memory>
#include <mutex>
#include <optional>

#include <cassert>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <type_traits>

usingnamespacelldb;
usingnamespacelldb_private;
StringRef;

IOHandler::IOHandler(Debugger &debugger, IOHandler::Type type)
    :{}

IOHandler::IOHandler(Debugger &debugger, IOHandler::Type type,
                     const lldb::FileSP &input_sp,
                     const lldb::StreamFileSP &output_sp,
                     const lldb::StreamFileSP &error_sp, uint32_t flags)
    :{}

IOHandler::~IOHandler() = default;

int IOHandler::GetInputFD() {}

int IOHandler::GetOutputFD() {}

int IOHandler::GetErrorFD() {}

FILE *IOHandler::GetInputFILE() {}

FILE *IOHandler::GetOutputFILE() {}

FILE *IOHandler::GetErrorFILE() {}

FileSP IOHandler::GetInputFileSP() {}

StreamFileSP IOHandler::GetOutputStreamFileSP() {}

StreamFileSP IOHandler::GetErrorStreamFileSP() {}

bool IOHandler::GetIsInteractive() {}

bool IOHandler::GetIsRealTerminal() {}

void IOHandler::SetPopped(bool b) {}

void IOHandler::WaitForPop() {}

void IOHandler::PrintAsync(const char *s, size_t len, bool is_stdout) {}

bool IOHandlerStack::PrintAsync(const char *s, size_t len, bool is_stdout) {}

IOHandlerConfirm::IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt,
                                   bool default_response)
    :{}

IOHandlerConfirm::~IOHandlerConfirm() = default;

void IOHandlerConfirm::IOHandlerComplete(IOHandler &io_handler,
                                         CompletionRequest &request) {}

void IOHandlerConfirm::IOHandlerInputComplete(IOHandler &io_handler,
                                              std::string &line) {}

std::optional<std::string>
IOHandlerDelegate::IOHandlerSuggestion(IOHandler &io_handler,
                                       llvm::StringRef line) {}

void IOHandlerDelegate::IOHandlerComplete(IOHandler &io_handler,
                                          CompletionRequest &request) {}

IOHandlerEditline::IOHandlerEditline(
    Debugger &debugger, IOHandler::Type type,
    const char *editline_name, // Used for saving history files
    llvm::StringRef prompt, llvm::StringRef continuation_prompt,
    bool multi_line, bool color, uint32_t line_number_start,
    IOHandlerDelegate &delegate)
    :{}

IOHandlerEditline::IOHandlerEditline(
    Debugger &debugger, IOHandler::Type type, const lldb::FileSP &input_sp,
    const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp,
    uint32_t flags,
    const char *editline_name, // Used for saving history files
    llvm::StringRef prompt, llvm::StringRef continuation_prompt,
    bool multi_line, bool color, uint32_t line_number_start,
    IOHandlerDelegate &delegate)
    :{}

IOHandlerEditline::~IOHandlerEditline() {}

void IOHandlerEditline::Activate() {}

void IOHandlerEditline::Deactivate() {}

void IOHandlerEditline::TerminalSizeChanged() {}

// Split out a line from the buffer, if there is a full one to get.
static std::optional<std::string> SplitLine(std::string &line_buffer) {}

// If the final line of the file ends without a end-of-line, return
// it as a line anyway.
static std::optional<std::string> SplitLineEOF(std::string &line_buffer) {}

bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {}

#if LLDB_ENABLE_LIBEDIT
bool IOHandlerEditline::IsInputCompleteCallback(Editline *editline,
                                                StringList &lines) {
  return m_delegate.IOHandlerIsInputComplete(*this, lines);
}

int IOHandlerEditline::FixIndentationCallback(Editline *editline,
                                              const StringList &lines,
                                              int cursor_position) {
  return m_delegate.IOHandlerFixIndentation(*this, lines, cursor_position);
}

std::optional<std::string>
IOHandlerEditline::SuggestionCallback(llvm::StringRef line) {
  return m_delegate.IOHandlerSuggestion(*this, line);
}

void IOHandlerEditline::AutoCompleteCallback(CompletionRequest &request) {
  m_delegate.IOHandlerComplete(*this, request);
}
#endif

const char *IOHandlerEditline::GetPrompt() {}

bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) {}

const char *IOHandlerEditline::GetContinuationPrompt() {}

void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) {}

void IOHandlerEditline::SetBaseLineNumber(uint32_t line) {}

uint32_t IOHandlerEditline::GetCurrentLineIndex() const {}

StringList IOHandlerEditline::GetCurrentLines() const {}

bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) {}

// Each IOHandler gets to run until it is done. It should read data from the
// "in" and place output into "out" and "err and return when done.
void IOHandlerEditline::Run() {}

void IOHandlerEditline::Cancel() {}

bool IOHandlerEditline::Interrupt() {}

void IOHandlerEditline::GotEOF() {}

void IOHandlerEditline::PrintAsync(const char *s, size_t len, bool is_stdout) {}