ruby-changes:21842
From: drbrain <ko1@a...>
Date: Tue, 29 Nov 2011 08:45:52 +0900 (JST)
Subject: [ruby-changes:21842] drbrain:r33891 (trunk): * lib/mkmf.rb: Wrap comments to 78 columns and clean up formatting.
drbrain 2011-11-29 08:45:42 +0900 (Tue, 29 Nov 2011) New Revision: 33891 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33891 Log: * lib/mkmf.rb: Wrap comments to 78 columns and clean up formatting. Modified files: trunk/ChangeLog trunk/lib/mkmf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 33890) +++ ChangeLog (revision 33891) @@ -1,3 +1,7 @@ +Tue Nov 29 07:45:26 2011 Eric Hodel <drbrain@s...> + + * lib/mkmf.rb: Wrap comments to 78 columns and clean up formatting. + Tue Nov 29 05:54:18 2011 Eric Hodel <drbrain@s...> * lib/mkmf.rb: Wrap mkmf.rb in module MakeMakefile to clean up Object Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 33890) +++ lib/mkmf.rb (revision 33891) @@ -35,6 +35,10 @@ end # :startdoc: +## +# mkmf.rb is used by ruby C extensions to generate a Makefile which will +# correctly compile and link the C extension to ruby and a third-party +# library. module MakeMakefile CONFIG = RbConfig::MAKEFILE_CONFIG @@ -219,8 +223,8 @@ FileUtils.rm_rf(Dir[*files.flatten], *opt) end - # Returns time stamp of the +target+ file if it exists and is newer - # than or equal to all of +times+. + # Returns time stamp of the +target+ file if it exists and is newer than or + # equal to all of +times+. def modified?(target, times) (t = File.mtime(target)) rescue return nil Array === times or times = [times] @@ -243,12 +247,12 @@ end end -# This is a custom logging module. It generates an mkmf.log file when you -# run your extconf.rb script. This can be useful for debugging unexpected -# failures. -# -# This module and its associated methods are meant for internal use only. -# + # This is a custom logging module. It generates an mkmf.log file when you + # run your extconf.rb script. This can be useful for debugging unexpected + # failures. + # + # This module and its associated methods are meant for internal use only. + # module Logging @log = nil @logfile = 'mkmf.log' @@ -462,8 +466,7 @@ end end - # :nodoc: - def try_link0(src, opt="", *opts, &b) + def try_link0(src, opt="", *opts, &b) # :nodoc: cmd = link_command("", opt) if $universal require 'tmpdir' @@ -480,10 +483,10 @@ end end - # Returns whether or not the +src+ can be compiled as a C source and - # linked with its depending libraries successfully. - # +opt+ is passed to the linker as options. Note that +$CFLAGS+ and +$LDFLAGS+ - # are also passed to the linker. + # Returns whether or not the +src+ can be compiled as a C source and linked + # with its depending libraries successfully. +opt+ is passed to the linker + # as options. Note that +$CFLAGS+ and +$LDFLAGS+ are also passed to the + # linker. # # If a block given, it is called with the source before compilation. You can # modify the source in the block. @@ -496,9 +499,9 @@ rm_f "conftest*", "c0x32*" end - # Returns whether or not the +src+ can be compiled as a C source. - # +opt+ is passed to the C compiler as options. Note that +$CFLAGS+ is - # also passed to the compiler. + # Returns whether or not the +src+ can be compiled as a C source. +opt+ is + # passed to the C compiler as options. Note that +$CFLAGS+ is also passed to + # the compiler. # # If a block given, it is called with the source before compilation. You can # modify the source in the block. @@ -511,12 +514,12 @@ rm_f "conftest*" end - # Returns whether or not the +src+ can be preprocessed with the C preprocessor. - # +opt+ is passed to the preprocessor as options. Note that +$CFLAGS+ is - # also passed to the preprocessor. + # Returns whether or not the +src+ can be preprocessed with the C + # preprocessor. +opt+ is passed to the preprocessor as options. Note that + # +$CFLAGS+ is also passed to the preprocessor. # - # If a block given, it is called with the source before preprocessing. You can - # modify the source in the block. + # If a block given, it is called with the source before preprocessing. You + # can modify the source in the block. # # [+src+] a String which contains a C source # [+opt+] a String which contains preprocessor options @@ -617,12 +620,12 @@ nil end -# You should use +have_func+ rather than +try_func+. -# -# [+func+] a String which contains a symbol name -# [+libs+] a String which contains library names. -# [+headers+] a String or an Array of strings which contains -# names of header files. + # You should use +have_func+ rather than +try_func+. + # + # [+func+] a String which contains a symbol name + # [+libs+] a String which contains library names. + # [+headers+] a String or an Array of strings which contains names of header + # files. def try_func(func, libs, headers = nil, opt = "", &b) headers = cpp_include(headers) case func @@ -660,7 +663,7 @@ SRC end -# You should use +have_var+ rather than +try_var+. + # You should use +have_var+ rather than +try_var+. def try_var(var, headers = nil, opt = "", &b) headers = cpp_include(headers) try_compile(<<"SRC", opt, &b) @@ -672,8 +675,8 @@ SRC end - # Returns whether or not the +src+ can be preprocessed with the C preprocessor and - # matches with +pat+. + # Returns whether or not the +src+ can be preprocessed with the C + # preprocessor and matches with +pat+. # # If a block given, it is called with the source before compilation. You can # modify the source in the block. @@ -682,9 +685,8 @@ # [+src+] a String which contains a C source # [+opt+] a String which contains preprocessor options # - # Note: - # When pat is a Regexp the matching will be checked in process, - # otherwise egrep(1) will be invoked to check it. + # NOTE: When pat is a Regexp the matching will be checked in process, + # otherwise egrep(1) will be invoked to check it. def egrep_cpp(pat, src, opt = "", &b) src = create_tmpsrc(src, &b) xpopen(cpp_command('', opt)) do |f| @@ -723,22 +725,24 @@ SRC end - # Returns whether or not + # Returns whether or not: # * the +src+ can be compiled as a C source, - # * the result object can be linked with its depending libraries successfully, + # * the result object can be linked with its depending libraries + # successfully, # * the linked file can be invoked as an executable # * and the executable exits successfully - # +opt+ is passed to the linker as options. Note that +$CFLAGS+ and +$LDFLAGS+ - # are also passed to the linker. # + # +opt+ is passed to the linker as options. Note that +$CFLAGS+ and + # +$LDFLAGS+ are also passed to the linker. + # # If a block given, it is called with the source before compilation. You can # modify the source in the block. # # [+src+] a String which contains a C source # [+opt+] a String which contains linker options # - # @return true when the executable exits successfully, false when it fails, or - # nil when preprocessing, compilation or link fails. + # Returns true when the executable exits successfully, false when it fails, + # or nil when preprocessing, compilation or link fails. def try_run(src, opt = "", &b) if try_link0(src, opt, &b) xsystem("./conftest") @@ -855,15 +859,15 @@ end # Returns whether or not the given entry point +func+ can be found within - # +lib+. If +func+ is nil, the 'main()' entry point is used by default. - # If found, it adds the library to list of libraries to be used when linking - # your extension. + # +lib+. If +func+ is nil, the <code>main()</code> entry point is used by + # default. If found, it adds the library to list of libraries to be used + # when linking your extension. # # If +headers+ are provided, it will include those header files as the # header files it looks in when searching for +func+. # # The real name of the library to be linked can be altered by - # '--with-FOOlib' configuration option. + # <code>--with-FOOlib</code> configuration option. # def have_library(lib, func = nil, headers = nil, opt = "", &b) func = "main" if !func or func.empty? @@ -883,9 +887,10 @@ end end - # Returns whether or not the entry point +func+ can be found within the library - # +lib+ in one of the +paths+ specified, where +paths+ is an array of strings. - # If +func+ is nil , then the main() function is used as the entry point. + # Returns whether or not the entry point +func+ can be found within the + # library +lib+ in one of the +paths+ specified, where +paths+ is an array + # of strings. If +func+ is nil , then the <code>main()</code> function is + # used as the entry point. # # If +lib+ is found, then the path it was found on is added to the list of # library paths searched and linked against. @@ -913,12 +918,12 @@ end # Returns whether or not the function +func+ can be found in the common - # header files, or within any +headers+ that you provide. If found, a - # macro is passed as a preprocessor constant to the compiler using the - # function name, in uppercase, prepended with 'HAVE_'. + # header files, or within any +headers+ that you provide. If found, a macro + # is passed as a preprocessor constant to the compiler using the function + # name, in uppercase, prepended with +HAVE_+. # - # For example, if have_func('foo') returned true, then the HAVE_FOO - # preprocessor macro would be passed to the compiler. + # For example, if <code>have_func('foo')</code> returned true, then the + # +HAVE_FOO+ preprocessor macro would be passed to the compiler. # def have_func(func, headers = nil, opt = "", &b) checking_for checking_message(func.funcall_style, headers, opt) do @@ -932,12 +937,12 @@ end # Returns whether or not the variable +var+ can be found in the common - # header files, or within any +headers+ that you provide. If found, a - # macro is passed as a preprocessor constant to the compiler using the - # variable name, in uppercase, prepended with 'HAVE_'. + # header files, or within any +headers+ that you provide. If found, a macro + # is passed as a preprocessor constant to the compiler using the variable + # name, in uppercase, prepended with +HAVE_+. # - # For example, if have_var('foo') returned true, then the HAVE_FOO - # preprocessor macro would be passed to the compiler. + # For example, if <code>have_var('foo')</code> returned true, then the + # +HAVE_FOO+ preprocessor macro would be passed to the compiler. # def have_var(var, headers = nil, opt = "", &b) checking_for checking_message(var, headers, opt) do @@ -951,11 +956,11 @@ end # Returns whether or not the given +header+ file can be found on your system. - # If found, a macro is passed as a preprocessor constant to the compiler using - # the header file name, in uppercase, prepended with 'HAVE_'. + # If found, a macro is passed as a preprocessor constant to the compiler + # using the header file name, in uppercase, prepended with +HAVE_+. # - # For example, if have_header('foo.h') returned true, then the HAVE_FOO_H - # preprocessor macro would be passed to the compiler. + # For example, if <code>have_header('foo.h')</code> returned true, then the + # +HAVE_FOO_H+ preprocessor macro would be passed to the compiler. # def have_header(header, preheaders = nil, opt = "", &b) checking_for header do @@ -969,11 +974,12 @@ end # Returns whether or not the given +framework+ can be found on your system. - # If found, a macro is passed as a preprocessor constant to the compiler using - # the framework name, in uppercase, prepended with 'HAVE_FRAMEWORK_'. + # If found, a macro is passed as a preprocessor constant to the compiler + # using the framework name, in uppercase, prepended with +HAVE_FRAMEWORK_+. # - # For example, if have_framework('Ruby') returned true, then the HAVE_FRAMEWORK_RUBY - # preprocessor macro would be passed to the compiler. + # For example, if <code>have_framework('Ruby')</code> returned true, then + # the +HAVE_FRAMEWORK_RUBY+ preprocessor macro would be passed to the + # compiler. # def have_framework(fw, &b) checking_for fw do @@ -992,7 +998,8 @@ # provided, and returns whether or not it was found in those paths. # # If the header is found then the path it was found on is added to the list - # of included directories that are sent to the compiler (via the -I switch). + # of included directories that are sent to the compiler (via the + # <code>-I</code> switch). # def find_header(header, *paths) message = checking_message(header, paths) @@ -1016,17 +1023,19 @@ end # Returns whether or not the struct of type +type+ contains +member+. If - # it does not, or the struct type can't be found, then false is returned. You - # may optionally specify additional +headers+ in which to look for the struct - # (in addition to the common header files). + # it does not, or the struct type can't be found, then false is returned. + # You may optionally specify additional +headers+ in which to look for the + # struct (in addition to the common header files). # - # If found, a macro is passed as a preprocessor constant to the compiler using - # the type name and the member name, in uppercase, prepended with 'HAVE_'. + # If found, a macro is passed as a preprocessor constant to the compiler + # using the type name and the member name, in uppercase, prepended with + # +HAVE_+. # - # For example, if have_struct_member('struct foo', 'bar') returned true, then the - # HAVE_STRUCT_FOO_BAR preprocessor macro would be passed to the compiler. + # For example, if <code>have_struct_member('struct foo', 'bar')</code> + # returned true, then the +HAVE_STRUCT_FOO_BAR+ preprocessor macro would be + # passed to the compiler. # - # HAVE_ST_BAR is also defined for backward compatibility. + # +HAVE_ST_BAR+ is also defined for backward compatibility. # def have_struct_member(type, member, headers = nil, opt = "", &b) checking_for checking_message("#{type}.#{member}", headers) do @@ -1070,11 +1079,11 @@ # You may also pass additional flags to +opt+ which are then passed along to # the compiler. # - # If found, a macro is passed as a preprocessor constant to the compiler using - # the type name, in uppercase, prepended with 'HAVE_TYPE_'. + # If found, a macro is passed as a preprocessor constant to the compiler + # using the type name, in uppercase, prepended with +HAVE_TYPE_+. # - # For example, if have_type('foo') returned true, then the HAVE_TYPE_FOO - # preprocessor macro would be passed to the compiler. + # For example, if <code>have_type('foo')</code> returned true, then the + # +HAVE_TYPE_FOO+ preprocessor macro would be passed to the compiler. # def have_type(type, headers = nil, opt = "", &b) checking_for checking_message(type, headers, opt) do @@ -1102,7 +1111,7 @@ end end - # Returns whether or not the Constant +const+ is defined. + # Returns whether or not the constant +const+ is defined. # # See also +have_const+ # @@ -1123,19 +1132,19 @@ # Returns whether or not the constant +const+ is defined. You may # optionally pass the +type+ of +const+ as <code>[const, type]</code>, - # like as: + # such as: # # have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h") # - # You may also pass additional +headers+ to check against in addition - # to the common header files, and additional flags to +opt+ which are - # then passed along to the compiler. + # You may also pass additional +headers+ to check against in addition to the + # common header files, and additional flags to +opt+ which are then passed + # along to the compiler. # - # If found, a macro is passed as a preprocessor constant to the compiler using - # the type name, in uppercase, prepended with 'HAVE_CONST_'. + # If found, a macro is passed as a preprocessor constant to the compiler + # using the type name, in uppercase, prepended with +HAVE_CONST_+. # - # For example, if have_const('foo') returned true, then the HAVE_CONST_FOO - # preprocessor macro would be passed to the compiler. + # For example, if <code>have_const('foo')</code> returned true, then the + # +HAVE_CONST_FOO+ preprocessor macro would be passed to the compiler. # def have_const(const, headers = nil, opt = "", &b) checking_for checking_message([*const].compact.join(' '), headers, opt) do @@ -1143,8 +1152,8 @@ end end + # :stopdoc: STRING_OR_FAILED_FORMAT = "%s" - # :stopdoc: def STRING_OR_FAILED_FORMAT.%(x) x ? super : "failed" end @@ -1167,15 +1176,16 @@ # :startdoc: - # Returns the size of the given +type+. You may optionally specify additional - # +headers+ to search in for the +type+. + # Returns the size of the given +type+. You may optionally specify + # additional +headers+ to search in for the +type+. # - # If found, a macro is passed as a preprocessor constant to the compiler using - # the type name, in uppercase, prepended with 'SIZEOF_', followed by the type - # name, followed by '=X' where 'X' is the actual size. + # If found, a macro is passed as a preprocessor constant to the compiler + # using the type name, in uppercase, prepended with +SIZEOF_+, followed by + # the type name, followed by <code>=X</code> where "X" is the actual size. # - # For example, if check_sizeof('mystruct') returned 12, then the - # SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler. + # For example, if <code>check_sizeof('mystruct')</code> returned 12, then + # the <code>SIZEOF_MYSTRUCT=12</code> preprocessor macro would be passed to + # the compiler. # def check_sizeof(type, headers = nil, opts = "", &b) typedef, member, prelude = typedef_expr(type, headers) @@ -1191,20 +1201,20 @@ end end - # Returns the signedness of the given +type+. You may optionally - # specify additional +headers+ to search in for the +type+. + # Returns the signedness of the given +type+. You may optionally specify + # additional +headers+ to search in for the +type+. # # If the +type+ is found and is a numeric type, a macro is passed as a - # preprocessor constant to the compiler using the +type+ name, in - # uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ - # name, followed by '=X' where 'X' is positive integer if the +type+ is - # unsigned, or negative integer if the +type+ is signed. + # preprocessor constant to the compiler using the +type+ name, in uppercase, + # prepended with +SIGNEDNESS_OF_+, followed by the +type+ name, followed by + # <code>=X</code> where "X" is positive integer if the +type+ is unsigned + # and a negative integer if the +type+ is signed. # - # For example, if size_t is defined as unsigned, then - # check_signedness('size_t') would returned +1 and the - # SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the - # compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is - # done. + # For example, if +size_t+ is defined as unsigned, then + # <code>check_signedness('size_t')</code> would return +1 and the + # <code>SIGNEDNESS_OF_SIZE_T=+1</code> preprocessor macro would be passed to + # the compiler. The <code>SIGNEDNESS_OF_INT=-1</code> macro would be set + # for <code>check_signedness('int')</code> # def check_signedness(type, headers = nil, opts = nil, &b) typedef, member, prelude = typedef_expr(type, headers) @@ -1219,25 +1229,28 @@ # Returns the convertible integer type of the given +type+. You may # optionally specify additional +headers+ to search in for the +type+. - # _Convertible_ means actually same type, or typedefed from same type. + # _convertible_ means actually the same type, or typedef'd from the same + # type. # - # If the +type+ is a integer type and _convertible_ type is found, - # following macros are passed as preprocessor constants to the - # compiler usi (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/