mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
7eb66d1c7b
readline library. * ext/readline/readline.c (hist_get, hist_each, Init_readline): The offset specified for the argument of history_get() might be different in GNU Readline and libedit. If use libedit, it was corrected that the computational method of the offset specified for the argument of history_get() when the Readline module was initialized was decided. (hist_get, hist_set): If use libedit, accesses first an input content in history when specifies the negative offset for the argument of history_get() or replace_history_entry(). Then checks the offset is negative in ruby. (rb_remove_history): When compiling, it corrects it to warning when libedit is used. (hist_clear, Init_readline): added Readline::HISTORY.clear method. [ruby-dev:35551] * test/readline/test_readline_history.rb: added unit test for Readline::HISTORY. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
70 lines
2.2 KiB
Ruby
70 lines
2.2 KiB
Ruby
require "mkmf"
|
|
|
|
$readline_headers = ["stdio.h"]
|
|
|
|
def have_readline_header(header)
|
|
if have_header(header)
|
|
$readline_headers.push(header)
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
def have_readline_var(var)
|
|
return have_var(var, $readline_headers)
|
|
end
|
|
|
|
def have_readline_func(func)
|
|
return have_func(func, $readline_headers)
|
|
end
|
|
|
|
dir_config('curses')
|
|
dir_config('ncurses')
|
|
dir_config('termcap')
|
|
dir_config("readline")
|
|
enable_libedit = enable_config("libedit")
|
|
have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
|
|
have_library("ncurses", "tgetnum") ||
|
|
have_library("termcap", "tgetnum") ||
|
|
have_library("curses", "tgetnum")
|
|
|
|
if enable_libedit
|
|
unless (have_readline_header("editline/readline.h") ||
|
|
have_readline_header("readline/readline.h")) &&
|
|
have_library("edit", "readline")
|
|
exit
|
|
end
|
|
else
|
|
unless ((have_readline_header("readline/readline.h") &&
|
|
have_readline_header("readline/history.h")) &&
|
|
(have_library("readline", "readline") ||
|
|
have_library("edit", "readline"))) ||
|
|
(have_readline_header("editline/readline.h") &&
|
|
have_library("edit", "readline"))
|
|
exit
|
|
end
|
|
end
|
|
|
|
have_readline_func("rl_filename_completion_function")
|
|
have_readline_func("rl_username_completion_function")
|
|
have_readline_func("rl_completion_matches")
|
|
have_readline_var("rl_deprep_term_function")
|
|
have_readline_var("rl_completion_append_character")
|
|
have_readline_var("rl_basic_word_break_characters")
|
|
have_readline_var("rl_completer_word_break_characters")
|
|
have_readline_var("rl_basic_quote_characters")
|
|
have_readline_var("rl_completer_quote_characters")
|
|
have_readline_var("rl_filename_quote_characters")
|
|
have_readline_var("rl_attempted_completion_over")
|
|
have_readline_var("rl_library_version")
|
|
# workaround for native windows.
|
|
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_event_hook")
|
|
have_readline_func("rl_cleanup_after_signal")
|
|
have_readline_func("rl_clear_signals")
|
|
have_readline_func("rl_vi_editing_mode")
|
|
have_readline_func("rl_emacs_editing_mode")
|
|
have_readline_func("replace_history_entry")
|
|
have_readline_func("remove_history")
|
|
have_readline_func("clear_history")
|
|
create_makefile("readline")
|