Rev 1620 | Rev 1647 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1620 | Rev 1642 | ||
|---|---|---|---|
| Line 34... | Line 34... | ||
| 34 | 34 | ||
| 35 | #include "net/Manager.h" |
35 | #include "net/Manager.h" |
| 36 | #include "net/Subscriber.h" |
36 | #include "net/Subscriber.h" |
| 37 | #include "net/types.h" |
37 | #include "net/types.h" |
| 38 | 38 | ||
| 39 | #include " |
39 | #include "common/common.h" |
| 40 | 40 | ||
| 41 | #include <readline/readline.h> |
41 | #include <readline/readline.h> |
| 42 | #include <readline/history.h> |
42 | #include <readline/history.h> |
| 43 | 43 | ||
| 44 | using namespace atom; |
44 | using namespace atom; |
| Line 48... | Line 48... | ||
| 48 | void CleanUp(); |
48 | void CleanUp(); |
| 49 | 49 | ||
| 50 | char* AutoCompleteGet(const char* text, int state); |
50 | char* AutoCompleteGet(const char* text, int state); |
| 51 | static char** AutoComplete(const char* text, int start, int end); |
51 | static char** AutoComplete(const char* text, int start, int end); |
| 52 | 52 | ||
| 53 |
|
53 | common::StringList autocomplete_list; |
| 54 | char* buffer = NULL; |
54 | char* buffer = NULL; |
| 55 | bool waiting_for_autocomplete = false; |
55 | bool waiting_for_autocomplete = false; |
| 56 | boost::condition on_message_condition; |
56 | boost::condition on_message_condition; |
| 57 | boost::mutex guard_mutex; |
57 | boost::mutex guard_mutex; |
| 58 | std::string prompt; |
58 | std::string prompt; |
| Line 109... | Line 109... | ||
| 109 | 109 | ||
| 110 | kill(getpid(), SIGTERM); |
110 | kill(getpid(), SIGTERM); |
| 111 | } |
111 | } |
| 112 | } |
112 | } |
| 113 | 113 | ||
| 114 | void SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, |
114 | void SlotOnNewDataHandler(net::ClientId client_id, net::ServerId server_id, common::Byteset data) |
| 115 | { |
115 | { |
| 116 | prompt_id = -1; |
116 | prompt_id = -1; |
| 117 | 117 | ||
| 118 | std::string s(data.ToCharString()); |
118 | std::string s(data.ToCharString()); |
| 119 | 119 | ||
| Line 129... | Line 129... | ||
| 129 | boost::algorithm::split(autocomplete_list, s, boost::is_any_of("\n"), boost::algorithm::token_compress_on); |
129 | boost::algorithm::split(autocomplete_list, s, boost::is_any_of("\n"), boost::algorithm::token_compress_on); |
| 130 | } |
130 | } |
| 131 | } |
131 | } |
| 132 | else |
132 | else |
| 133 | { |
133 | { |
| 134 |
|
134 | common::StringList lines; |
| 135 | 135 | ||
| 136 | boost::algorithm::split(lines, s, boost::is_any_of("\n"), boost::algorithm::token_compress_on); |
136 | boost::algorithm::split(lines, s, boost::is_any_of("\n"), boost::algorithm::token_compress_on); |
| 137 | 137 | ||
| 138 | for (unsigned int n = 0; n < lines.size(); n++) |
138 | for (unsigned int n = 0; n < lines.size(); n++) |
| 139 | { |
139 | { |
| 140 |
|
140 | common::StringList parts; |
| 141 | 141 | ||
| 142 | boost::algorithm::split(parts, lines[n], boost::is_any_of(";"), boost::algorithm::token_compress_off); |
142 | boost::algorithm::split(parts, lines[n], boost::is_any_of(";"), boost::algorithm::token_compress_off); |
| 143 | 143 | ||
| 144 | if (parts[0].length() == 1 && parts[0] == "P") |
144 | if (parts[0].length() == 1 && parts[0] == "P") |
| 145 | { |
145 | { |