aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/replxx/src/escape.hxx
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-03 17:45:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-03 17:45:58 +0100
commit669cd52f685282289590200daed3fc89466e7206 (patch)
tree792c26273dd54dab61b5e94693e1895ff9c5440c /contrib/replxx/src/escape.hxx
parent8a240656d8378ac20e4c4c3ae61d1a9c33488a20 (diff)
downloadrspamd-669cd52f685282289590200daed3fc89466e7206.tar.gz
rspamd-669cd52f685282289590200daed3fc89466e7206.zip
[Rework] Replace linenoise with replxx
Source: https://github.com/AmokHuginnsson/replxx
Diffstat (limited to 'contrib/replxx/src/escape.hxx')
-rw-r--r--contrib/replxx/src/escape.hxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/contrib/replxx/src/escape.hxx b/contrib/replxx/src/escape.hxx
new file mode 100644
index 000000000..659739532
--- /dev/null
+++ b/contrib/replxx/src/escape.hxx
@@ -0,0 +1,37 @@
+#ifndef REPLXX_ESCAPE_HXX_INCLUDED
+#define REPLXX_ESCAPE_HXX_INCLUDED 1
+
+namespace replxx {
+
+namespace EscapeSequenceProcessing {
+
+// This is a typedef for the routine called by doDispatch(). It takes the
+// current character
+// as input, does any required processing including reading more characters and
+// calling other
+// dispatch routines, then eventually returns the final (possibly extended or
+// special) character.
+//
+typedef char32_t (*CharacterDispatchRoutine)(char32_t);
+
+// This structure is used by doDispatch() to hold a list of characters to test
+// for and
+// a list of routines to call if the character matches. The dispatch routine
+// list is one
+// longer than the character list; the final entry is used if no character
+// matches.
+//
+struct CharacterDispatch {
+ unsigned int len; // length of the chars list
+ const char* chars; // chars to test
+ CharacterDispatchRoutine* dispatch; // array of routines to call
+};
+
+char32_t doDispatch(char32_t c);
+
+}
+
+}
+
+#endif
+