BUILD: Support libedit readline wrapper
This is used in Mac OS X. Thanks to waltervn for pointing this out and testing.
This commit is contained in:
parent
781017b114
commit
5686d606f0
2 changed files with 28 additions and 1 deletions
19
configure
vendored
19
configure
vendored
|
@ -3667,6 +3667,25 @@ fi
|
||||||
if test "$_readline" = yes ; then
|
if test "$_readline" = yes ; then
|
||||||
LIBS="$LIBS $READLINE_LIBS $_READLINE_LIBS"
|
LIBS="$LIBS $READLINE_LIBS $_READLINE_LIBS"
|
||||||
INCLUDES="$INCLUDES $READLINE_CFLAGS"
|
INCLUDES="$INCLUDES $READLINE_CFLAGS"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check the type of rl_completion_entry_function.
|
||||||
|
# It can be int(*)(const char *, int) or char *(*)(const char *, int).
|
||||||
|
#
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <readline/readline.h>
|
||||||
|
#include <readline/history.h>
|
||||||
|
|
||||||
|
int readline_completionFunction(const char *, int);
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
char *x = readline("");
|
||||||
|
rl_completion_entry_function = &readline_completionFunction;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cc_check -c && add_line_to_config_h '#define USE_READLINE_INT_COMPLETION'
|
||||||
|
|
||||||
fi
|
fi
|
||||||
define_in_config_h_if_yes "$_readline" 'USE_READLINE'
|
define_in_config_h_if_yes "$_readline" 'USE_READLINE'
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,14 @@ Debugger *g_readline_debugger;
|
||||||
char *readline_completionFunction(const char *text, int state) {
|
char *readline_completionFunction(const char *text, int state) {
|
||||||
return g_readline_debugger->readlineComplete(text, state);
|
return g_readline_debugger->readlineComplete(text, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_READLINE_INT_COMPLETION
|
||||||
|
typedef int RLCompFunc_t(const char *, int);
|
||||||
|
#else
|
||||||
|
typedef char *RLCompFunc_t(const char *, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -162,7 +170,7 @@ void Debugger::enter() {
|
||||||
// TODO: add support for saving/loading history?
|
// TODO: add support for saving/loading history?
|
||||||
|
|
||||||
g_readline_debugger = this;
|
g_readline_debugger = this;
|
||||||
rl_completion_entry_function = &readline_completionFunction;
|
rl_completion_entry_function = (RLCompFunc_t *)&readline_completionFunction;
|
||||||
|
|
||||||
char *line_read = 0;
|
char *line_read = 0;
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue