Implement unicode on console, move readline into driver
This commit is contained in:
@@ -88,10 +88,6 @@ public:
|
||||
//
|
||||
const eng::string &error() const { return error_; }
|
||||
|
||||
// Set the prompt for readline mode.
|
||||
//
|
||||
void set_prompt(const eng::string &prompt);
|
||||
|
||||
// Do not construct your own Channels. Instead,
|
||||
// use methods of class DrivenEngine like new_outgoing_channel.
|
||||
// Channels are referenced by shared_ptr. You can
|
||||
@@ -104,40 +100,22 @@ private:
|
||||
// Constructor is deliberately private. Use
|
||||
// DrivenEngine::new_outgoing_channel to create outgoing socket channels.
|
||||
//
|
||||
|
||||
void feed_readline(std::string_view data);
|
||||
std::string_view peek_outgoing() const;
|
||||
void sent_outgoing(int nbytes);
|
||||
void erase_command();
|
||||
void echo_command();
|
||||
void pump_readline();
|
||||
|
||||
private:
|
||||
static const int READLINE_MAX=512;
|
||||
int chid_;
|
||||
|
||||
// These are the in/out buffers presented to the user.
|
||||
std::shared_ptr<StreamBuffer> sb_in_;
|
||||
std::shared_ptr<StreamBuffer> sb_out_;
|
||||
|
||||
// If this is stdio, we inject tty echoes into the output stream.
|
||||
// This buffer holds the users output interleaved with the tty echoes.
|
||||
// In any other channel, this is just another pointer to sb_out.
|
||||
std::shared_ptr<StreamBuffer> sb_drvout_;
|
||||
|
||||
int port_;
|
||||
bool closed_;
|
||||
eng::string error_;
|
||||
eng::string target_;
|
||||
bool stop_driver_;
|
||||
|
||||
// Readline stuff. Only used on channel 0 (stdio).
|
||||
eng::string desired_command_;
|
||||
eng::string current_command_;
|
||||
eng::string desired_prompt_;
|
||||
eng::string current_prompt_;
|
||||
char readline_lastc_;
|
||||
|
||||
friend class DrivenEngine;
|
||||
};
|
||||
|
||||
@@ -215,9 +193,10 @@ public:
|
||||
// Obtain the stdio channel. There is only one stdio channel.
|
||||
//
|
||||
// DRIVER: the stdio channel is created automatically when the DrivenEngine
|
||||
// is created. The driver is responsible for relaying data into the channel
|
||||
// using drv_get_target, drv_peek_outgoing, drv_sent_outgoing,
|
||||
// drv_recv_incoming.
|
||||
// is created. Stdio should be connected to a console which is in
|
||||
// line-at-a-time mode. The driver is responsible for relaying data from
|
||||
// the console into the stdio channel using drv_peek_outgoing,
|
||||
// drv_sent_outgoing, drv_recv_incoming.
|
||||
//
|
||||
SharedChannel get_stdio_channel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user