ruby-changes:24085
From: nobu <ko1@a...>
Date: Tue, 19 Jun 2012 18:22:06 +0900 (JST)
Subject: [ruby-changes:24085] nobu:r36136 (trunk): ext/readline/extconf.rb: no global names
nobu 2012-06-19 18:21:58 +0900 (Tue, 19 Jun 2012) New Revision: 36136 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36136 Log: ext/readline/extconf.rb: no global names * ext/readline/extconf.rb (readline): get rid of polluting global namespace. Modified files: trunk/ext/readline/extconf.rb Index: ext/readline/extconf.rb =================================================================== --- ext/readline/extconf.rb (revision 36135) +++ ext/readline/extconf.rb (revision 36136) @@ -1,26 +1,26 @@ require "mkmf" -$readline_headers = ["stdio.h"] +readline = Struct.new(:headers, :extra_check).new(["stdio.h"]) -def have_readline_header(header) - if have_header(header, &$readline_extra_check) - $readline_headers.push(header) +def readline.have_header(header) + if super(header, &extra_check) + headers.push(header) return true else return false end end -def have_readline_var(var) - return have_var(var, $readline_headers) +def readline.have_var(var) + return super(var, headers) end -def have_readline_func(func) - return have_func(func, $readline_headers) +def readline.have_func(func) + return super(func, headers) end -def have_readline_macro(macro) - return have_macro(macro, $readline_headers) +def readline.have_macro(macro) + return super(macro, headers) end dir_config('curses') @@ -37,66 +37,66 @@ case enable_libedit when true # --enable-libedit - unless (have_readline_header("editline/readline.h") || - have_readline_header("readline/readline.h")) && + unless (readline.have_header("editline/readline.h") || + readline.have_header("readline/readline.h")) && have_library("edit", "readline") raise "libedit not found" end when false # --disable-libedit - unless ((have_readline_header("readline/readline.h") && - have_readline_header("readline/history.h")) && + unless ((readline.have_header("readline/readline.h") && + readline.have_header("readline/history.h")) && have_library("readline", "readline")) raise "readline not found" end else # does not specify - unless ((have_readline_header("readline/readline.h") && - have_readline_header("readline/history.h")) && + unless ((readline.have_header("readline/readline.h") && + readline.have_header("readline/history.h")) && (have_library("readline", "readline") || have_library("edit", "readline"))) || - (have_readline_header("editline/readline.h") && + (readline.have_header("editline/readline.h") && have_library("edit", "readline")) raise "readline nor libedit not found" end end -have_readline_func("rl_getc") -have_readline_func("rl_getc_function") -have_readline_func("rl_filename_completion_function") -have_readline_func("rl_username_completion_function") -have_readline_func("rl_completion_matches") -have_readline_func("rl_refresh_line") -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") -have_readline_var("rl_editing_mode") -have_readline_var("rl_line_buffer") -have_readline_var("rl_point") +readline.have_func("rl_getc") +readline.have_func("rl_getc_function") +readline.have_func("rl_filename_completion_function") +readline.have_func("rl_username_completion_function") +readline.have_func("rl_completion_matches") +readline.have_func("rl_refresh_line") +readline.have_var("rl_deprep_term_function") +readline.have_var("rl_completion_append_character") +readline.have_var("rl_basic_word_break_characters") +readline.have_var("rl_completer_word_break_characters") +readline.have_var("rl_basic_quote_characters") +readline.have_var("rl_completer_quote_characters") +readline.have_var("rl_filename_quote_characters") +readline.have_var("rl_attempted_completion_over") +readline.have_var("rl_library_version") +readline.have_var("rl_editing_mode") +readline.have_var("rl_line_buffer") +readline.have_var("rl_point") # workaround for native windows. -/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_event_hook") -/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_sigwinch") -/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_signals") -have_readline_var("rl_pre_input_hook") -have_readline_var("rl_special_prefixes") -have_readline_func("rl_cleanup_after_signal") -have_readline_func("rl_free_line_state") -have_readline_func("rl_clear_signals") -have_readline_func("rl_set_screen_size") -have_readline_func("rl_get_screen_size") -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") -have_readline_func("rl_redisplay") -have_readline_func("rl_insert_text") -have_readline_macro("RL_PROMPT_START_IGNORE") -have_readline_macro("RL_PROMPT_END_IGNORE") +/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_event_hook") +/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_sigwinch") +/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_signals") +readline.have_var("rl_pre_input_hook") +readline.have_var("rl_special_prefixes") +readline.have_func("rl_cleanup_after_signal") +readline.have_func("rl_free_line_state") +readline.have_func("rl_clear_signals") +readline.have_func("rl_set_screen_size") +readline.have_func("rl_get_screen_size") +readline.have_func("rl_vi_editing_mode") +readline.have_func("rl_emacs_editing_mode") +readline.have_func("replace_history_entry") +readline.have_func("remove_history") +readline.have_func("clear_history") +readline.have_func("rl_redisplay") +readline.have_func("rl_insert_text") +readline.have_macro("RL_PROMPT_START_IGNORE") +readline.have_macro("RL_PROMPT_END_IGNORE") create_makefile("readline") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/