38 lines
822 B
C++
38 lines
822 B
C++
#ifndef CPCTRL_NONCANONICAL_H
|
|
#define CPCTRL_NONCANONICAL_H
|
|
|
|
#include <algorithm>
|
|
#include <cctype>
|
|
#include <cstring>
|
|
#include <iostream>
|
|
#include <set>
|
|
#include <vector>
|
|
|
|
#if defined(_WIN32)
|
|
#include <windows.h>
|
|
#include <conio.h>
|
|
#else
|
|
#include <termios.h>
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
//#include "GlobalDefs.h"
|
|
extern std::vector<std::string> cmdList;
|
|
|
|
// 平台相关类型定义
|
|
#if defined(_WIN32)
|
|
typedef DWORD terminal_mode_t;
|
|
#else
|
|
typedef struct termios terminal_mode_t;
|
|
#endif
|
|
|
|
// 全局保存终端原始设置
|
|
extern terminal_mode_t original_termios;
|
|
|
|
void restore_terminal();
|
|
void set_noncanonical_mode();
|
|
std::string toLower(const std::string& str);
|
|
std::string tabCompletion(const std::string& currentLine, size_t cursorPos);
|
|
std::string readLine(const std::string& prompt);
|
|
|
|
#endif //CPCTRL_NONCANONICAL_H
|